parent
db1865ad39
commit
d8ae8d8d44
|
|
@ -1,5 +1,4 @@
|
|||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import { doGot, genSize } from './util';
|
||||
|
||||
|
|
@ -38,31 +37,29 @@ async function handler(ctx) {
|
|||
}
|
||||
|
||||
const host = `https://www.${domain}bt0.com`;
|
||||
const _link = `${host}/mv/${number}.html`;
|
||||
const _link = `${host}/prod/core/system/getVideoDetail/${number}`;
|
||||
|
||||
const $ = load(await doGot(0, host, _link));
|
||||
const name = $('span.info-title.lh32').text();
|
||||
const items = $('div.container .container .col-md-10.tex_l')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const torrent_info = item.find('.torrent-title').first();
|
||||
const _title = torrent_info.text();
|
||||
const len = item.find('.tag-sm.tag-size.text-center').first().text();
|
||||
return {
|
||||
title: _title,
|
||||
guid: _title,
|
||||
description: `${_title}[${len}]`,
|
||||
link: host + torrent_info.attr('href'),
|
||||
pubDate: item.find('.tag-sm.tag-download.text-center').eq(1).text(),
|
||||
enclosure_type: 'application/x-bittorrent',
|
||||
enclosure_url: item.find('.col-md-3 a').first().attr('href'),
|
||||
enclosure_length: genSize(len),
|
||||
};
|
||||
});
|
||||
const data = (await doGot(0, host, _link)).data;
|
||||
const items = Object.values(data.ecca).flatMap((item) =>
|
||||
item.map((i) => ({
|
||||
title: i.zname,
|
||||
guid: i.zname,
|
||||
description: `${i.zname}[${i.zsize}]`,
|
||||
link: `${host}/tr/${i.id}.html`,
|
||||
pubDate: i.ezt,
|
||||
enclosure_type: 'application/x-bittorrent',
|
||||
enclosure_url: i.zlink,
|
||||
enclosure_length: genSize(i.zsize),
|
||||
category: strsJoin(i.zqxd, i.text_html, i.audio_html, i.new === 1 ? '新' : ''),
|
||||
}))
|
||||
);
|
||||
return {
|
||||
title: name,
|
||||
link: _link,
|
||||
title: data.title,
|
||||
link: `${host}/mv/${number}.html`,
|
||||
item: items,
|
||||
};
|
||||
}
|
||||
|
||||
function strsJoin(...strings) {
|
||||
return strings.filter((str) => str !== '').join(',');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import { doGot, genSize } from './util';
|
||||
import { parseRelativeDate } from '@/utils/parse-date';
|
||||
|
||||
const categoryDict = {
|
||||
1: '电影',
|
||||
2: '电视剧',
|
||||
3: '周热门',
|
||||
4: '月热门',
|
||||
5: '年度热门',
|
||||
3: '近日热门',
|
||||
4: '本周热门',
|
||||
5: '本月热门',
|
||||
};
|
||||
|
||||
export const route: Route = {
|
||||
path: '/tlist/:sc/:domain?',
|
||||
categories: ['multimedia'],
|
||||
example: '/bt0/tlist/1',
|
||||
parameters: { sc: '分类(1-5), 1:电影, 2:电视剧, 3:周热门, 4:月热门, 5:年度热门', domain: '数字1-9, 比如1表示请求域名为 1bt0.com, 默认为 2' },
|
||||
parameters: { sc: '分类(1-5), 1:电影, 2:电视剧, 3:近日热门, 4:本周热门, 5:本月热门', domain: '数字1-9, 比如1表示请求域名为 1bt0.com, 默认为 2' },
|
||||
features: {
|
||||
requireConfig: false,
|
||||
requirePuppeteer: false,
|
||||
|
|
@ -45,30 +45,23 @@ async function handler(ctx) {
|
|||
}
|
||||
|
||||
const host = `https://www.${domain}bt0.com`;
|
||||
const _link = `${host}/tlist.php?sc=${sc}`;
|
||||
const _link = `${host}/prod/core/system/getTList?sc=${sc}`;
|
||||
|
||||
const $ = load(await doGot(0, host, _link));
|
||||
const items = $('div.left.bf100.hig90.ov_hid.po_rel.trall3.dou3')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const ah = item.find('a');
|
||||
const _title = ah.eq(1).text();
|
||||
const ds = item.find('.huise2.fs12 .left');
|
||||
return {
|
||||
title: _title,
|
||||
guid: _title,
|
||||
description: `${ds.eq(0).text()} ${ds.eq(1).text()}<br>${ds.eq(2).text()}<br>${ds.eq(3).text()}<br>${ds.eq(4).text()}`,
|
||||
link: host + ah.eq(1).attr('href'),
|
||||
pubDate: item.find('.bghuise9').first().text(),
|
||||
enclosure_type: 'application/x-bittorrent',
|
||||
enclosure_url: ah.eq(2).attr('href'),
|
||||
enclosure_length: genSize(item.find('.marl10.bgzise').first().text()),
|
||||
};
|
||||
});
|
||||
const data = await doGot(0, host, _link);
|
||||
const items = data.data.list.map((item) => ({
|
||||
title: item.zname,
|
||||
guid: item.zname,
|
||||
description: `《${item.title}》 导演: ${item.daoyan}<br>编剧: ${item.bianji}<br>演员: ${item.yanyuan}<br>简介: ${item.conta.trim()}`,
|
||||
link: host + item.aurl,
|
||||
pubDate: item.eztime.endsWith('前') ? parseRelativeDate(item.eztime) : item.eztime,
|
||||
enclosure_type: 'application/x-bittorrent',
|
||||
enclosure_url: item.zlink,
|
||||
enclosure_length: genSize(item.zsize),
|
||||
itunes_item_image: item.epic,
|
||||
}));
|
||||
return {
|
||||
title: `不太灵-最新资源列表-${categoryDict[sc]}`,
|
||||
link: _link,
|
||||
link: `${host}/tlist/${sc}_1.html`,
|
||||
item: items,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,12 @@ async function doGot(num, host, link) {
|
|||
cookieJar,
|
||||
});
|
||||
const data = response.data;
|
||||
const regex = /document\.cookie\s*=\s*"([^"]*)"/;
|
||||
const match = data.match(regex);
|
||||
if (match) {
|
||||
if (typeof data === 'string') {
|
||||
const regex = /document\.cookie\s*=\s*"([^"]*)"/;
|
||||
const match = data.match(regex);
|
||||
if (!match) {
|
||||
throw new Error('api error');
|
||||
}
|
||||
cookieJar.setCookieSync(match[1], host);
|
||||
return doGot(++num, host, link);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue