|
|
|
@ -12,7 +12,6 @@ async function request(reqUrl, agentSp) {
|
|
|
|
method: 'get',
|
|
|
|
method: 'get',
|
|
|
|
headers: {
|
|
|
|
headers: {
|
|
|
|
'User-Agent': agentSp || UA,
|
|
|
|
'User-Agent': agentSp || UA,
|
|
|
|
'referer': url
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return res.content;
|
|
|
|
return res.content;
|
|
|
|
@ -55,22 +54,7 @@ async function home(filter) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function homeVod() {
|
|
|
|
async function homeVod() {
|
|
|
|
const html = await request(url);
|
|
|
|
return '{}';
|
|
|
|
const $ = load(html);
|
|
|
|
|
|
|
|
const items = $('div.v-list a.item');
|
|
|
|
|
|
|
|
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
|
|
|
|
|
|
|
let videos = _.map(items, (item) => {
|
|
|
|
|
|
|
|
const img = $(item).find('img:first')[0];
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
vod_id: item.attribs.href,
|
|
|
|
|
|
|
|
vod_name: img.attribs.alt,
|
|
|
|
|
|
|
|
vod_pic: jsBase + base64Encode(img.attribs['data-src']),
|
|
|
|
|
|
|
|
vod_remarks: '',
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return JSON.stringify({
|
|
|
|
|
|
|
|
list: videos,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function category(tid, pg, filter, extend) {
|
|
|
|
async function category(tid, pg, filter, extend) {
|
|
|
|
@ -101,85 +85,50 @@ async function category(tid, pg, filter, extend) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function detail(id) {
|
|
|
|
async function detail(id) {
|
|
|
|
const html = await request(url + id);
|
|
|
|
const html = await request(url + id);
|
|
|
|
const $ = load(html);
|
|
|
|
const $ = load(html);
|
|
|
|
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
|
|
|
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
|
|
|
const detail = $('div.detail');
|
|
|
|
const detail = $('div.detail > .meta');
|
|
|
|
const remarks = $('span#line-tips').text();
|
|
|
|
let vod = {
|
|
|
|
let vod = {
|
|
|
|
vod_id: id,
|
|
|
|
vod_id: id,
|
|
|
|
vod_pic: jsBase + base64Encode($('div.item-root > img')[0].attribs['data-src']),
|
|
|
|
vod_pic: jsBase + base64Encode($('div.item-root > img')[0].attribs['data-src']),
|
|
|
|
vod_remarks: '',
|
|
|
|
vod_remarks: '',
|
|
|
|
};
|
|
|
|
vod_content: remarks || '',
|
|
|
|
for (const info of detail) {
|
|
|
|
vod_name: $(detail).find('h2').text().trim(),
|
|
|
|
if ($(info).hasClass('title')) {
|
|
|
|
vod_year: $(detail).find('h3:nth-child(3)').text(),
|
|
|
|
vod.vod_name = info.children[0].data;
|
|
|
|
vod_area: $(detail).find('h3:nth-child(4)').text(),
|
|
|
|
} else if ($(info).hasClass('year')) {
|
|
|
|
vod_actor: $(detail).find('h3:nth-child(5)').text(),
|
|
|
|
vod.vod_area = info.children[0].data;
|
|
|
|
};
|
|
|
|
} else if ($(info).hasClass('country')) {
|
|
|
|
const res = await req(url + '/api/getResN?videoId=' + id.substring(id.lastIndexOf('/') + 1) + '&mtype=2', {
|
|
|
|
vod.vod_area = info.children[0].data;
|
|
|
|
headers: {
|
|
|
|
} else if ($(info).hasClass('celebrity')) {
|
|
|
|
Referer: 'play',
|
|
|
|
vod.vod_actor = info.children[0].data;
|
|
|
|
'User-Agent': UA,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const list = JSON.parse(res.content).data.list;
|
|
|
|
const res = await req(url + '/api/getResN?videoId=' + id.substring(id.lastIndexOf('/') + 1) + '&mtype=2', {
|
|
|
|
let playlist = {};
|
|
|
|
headers: {
|
|
|
|
let arr = []
|
|
|
|
Referer: url,
|
|
|
|
for (const l of list) {
|
|
|
|
'User-Agent': UA,
|
|
|
|
const flagData = JSON.parse(l.resData);
|
|
|
|
},
|
|
|
|
for (const f of flagData) {
|
|
|
|
});
|
|
|
|
const from = f.flag;
|
|
|
|
const list = JSON.parse(res.content).data.list;
|
|
|
|
const urls = f.url;
|
|
|
|
let playlist = {};
|
|
|
|
if (!from || !urls) continue;
|
|
|
|
for (const l of list) {
|
|
|
|
if (playlist[from]) continue;
|
|
|
|
const flagData = JSON.parse(l.resData);
|
|
|
|
playlist[from] = urls;
|
|
|
|
for (const f of flagData) {
|
|
|
|
}
|
|
|
|
const from = f.flag;
|
|
|
|
}
|
|
|
|
const urls = f.url;
|
|
|
|
for (var key in playlist) {
|
|
|
|
if (!from || !urls) continue;
|
|
|
|
if ('kuaikan' == key) {
|
|
|
|
if (playlist[from]) continue;
|
|
|
|
arr.push({
|
|
|
|
playlist[from] = urls;
|
|
|
|
flag: '快看',
|
|
|
|
}
|
|
|
|
url: playlist[key],
|
|
|
|
}
|
|
|
|
sort: 1
|
|
|
|
vod.vod_play_from = _.keys(playlist).join('$$$');
|
|
|
|
})
|
|
|
|
vod.vod_play_url = _.values(playlist).join('$$$');
|
|
|
|
} else if ('bfzym3u8' == key) {
|
|
|
|
return JSON.stringify({
|
|
|
|
arr.push({
|
|
|
|
list: [vod],
|
|
|
|
flag: '暴风',
|
|
|
|
});
|
|
|
|
url: playlist[key],
|
|
|
|
|
|
|
|
sort: 2
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else if ('ffm3u8' == key) {
|
|
|
|
|
|
|
|
arr.push({
|
|
|
|
|
|
|
|
flag: '非凡',
|
|
|
|
|
|
|
|
url: playlist[key],
|
|
|
|
|
|
|
|
sort: 3
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else if ('lzm3u8' == key) {
|
|
|
|
|
|
|
|
arr.push({
|
|
|
|
|
|
|
|
flag: '量子',
|
|
|
|
|
|
|
|
url: playlist[key],
|
|
|
|
|
|
|
|
sort: 4
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
arr.push({
|
|
|
|
|
|
|
|
flag: key,
|
|
|
|
|
|
|
|
url: playlist[key],
|
|
|
|
|
|
|
|
sort: 5
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
arr.sort((a, b) => a.sort - b.sort);
|
|
|
|
|
|
|
|
let playFrom = [];
|
|
|
|
|
|
|
|
let playList = [];
|
|
|
|
|
|
|
|
arr.map(val => {
|
|
|
|
|
|
|
|
playFrom.push(val.flag);
|
|
|
|
|
|
|
|
playList.push(val.url);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
vod.vod_play_from = playFrom.join("$$$");
|
|
|
|
|
|
|
|
vod.vod_play_url = playList.join("$$$");
|
|
|
|
|
|
|
|
return JSON.stringify({
|
|
|
|
|
|
|
|
list: [vod],
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function base64Encode(text) {
|
|
|
|
function base64Encode(text) {
|
|
|
|
@ -221,28 +170,21 @@ async function play(flag, id, flags) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function search(wd, quick, pg) {
|
|
|
|
async function search(wd, quick) {
|
|
|
|
if (pg <= 0 || typeof(pg) == 'undefined') pg = 1;
|
|
|
|
const html = await request(url + '/search?q=' + wd);
|
|
|
|
const html = await request(url + '/search?q=' + wd + '&p=' + pg);
|
|
|
|
|
|
|
|
const $ = load(html);
|
|
|
|
const $ = load(html);
|
|
|
|
const items = $('div.media');
|
|
|
|
const items = $('div.media > div.media-left > a');
|
|
|
|
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
|
|
|
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
|
|
|
let videos = _.map(items, (item) => {
|
|
|
|
let videos = _.map(items, (item) => {
|
|
|
|
const a = $(item).find('a:first')[0];
|
|
|
|
|
|
|
|
const img = $(item).find('img:first')[0];
|
|
|
|
const img = $(item).find('img:first')[0];
|
|
|
|
const remarks = $($(item).find('span.label')[0]).text().trim();
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
vod_id: a.attribs.href,
|
|
|
|
vod_id: item.attribs.href,
|
|
|
|
vod_name: img.attribs.alt,
|
|
|
|
vod_name: img.attribs.alt,
|
|
|
|
vod_pic: jsBase + base64Encode(img.attribs['data-src']),
|
|
|
|
vod_pic: jsBase + base64Encode(img.attribs['data-src']),
|
|
|
|
vod_remarks: remarks || '',
|
|
|
|
vod_remarks: '',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const hasMore = $('div.page-more > a:contains(下一页)').length > 0;
|
|
|
|
|
|
|
|
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
|
|
|
|
|
|
|
return JSON.stringify({
|
|
|
|
return JSON.stringify({
|
|
|
|
page: parseInt(pg),
|
|
|
|
|
|
|
|
pagecount: pgCount,
|
|
|
|
|
|
|
|
list: videos,
|
|
|
|
list: videos,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|