From 4797a7420749ca0ce8bbabad21e294b4080dca9e Mon Sep 17 00:00:00 2001 From: nczitzk Date: Tue, 5 Jan 2021 18:20:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E5=93=94=E5=98=80=E5=BD=B1?= =?UTF-8?q?=E8=A7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/multimedia.md | 68 +++++++++++++++++++++++++++++++++++ lib/router.js | 3 ++ lib/routes/bde4/index.js | 77 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 lib/routes/bde4/index.js diff --git a/docs/multimedia.md b/docs/multimedia.md index d36583f23..bec28475e 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -495,6 +495,74 @@ pageClass: routes +## 哔嘀影视 + +### 首页 + + + +#### 资源分类 + +| 不限 | 电影 | 电视剧 | +| ---- | ---- | ------ | +| all | 0 | 1 | + +#### 影视类型 + +| 不限 | 动作 | 爱情 | 喜剧 | 科幻 | 恐怖 | +| ---- | ------- | ------ | ---- | ------ | ------ | +| all | dongzuo | aiqing | xiju | kehuan | kongbu | + +| 战争 | 武侠 | 魔幻 | 剧情 | 动画 | 惊悚 | +| --------- | ----- | ------ | ------ | ------- | -------- | +| zhanzheng | wuxia | mohuan | juqing | donghua | jingsong | + +| 3D | 灾难 | 悬疑 | 警匪 | 文艺 | 青春 | +| -- | ------ | ------ | ------- | ----- | -------- | +| 3D | zainan | xuanyi | jingfei | wenyi | qingchun | + +| 冒险 | 犯罪 | 纪录 | 古装 | 奇幻 | 国语 | +| ------- | ------ | ---- | -------- | ------ | ----- | +| maoxian | fanzui | jilu | guzhuang | qihuan | guoyu | + +| 综艺 | 历史 | 运动 | 原创压制 | +| ------ | ----- | ------- | ---------- | +| zongyi | lishi | yundong | yuanchuang | + +| 美剧 | 韩剧 | 国产电视剧 | 日剧 | 英剧 | 德剧 | +| ----- | ----- | ---------- | ---- | ------ | ---- | +| meiju | hanju | guoju | riju | yingju | deju | + +| 俄剧 | 巴剧 | 加剧 | 西剧 | 意大利剧 | 泰剧 | +| ---- | ---- | ----- | ---- | -------- | ----- | +| eju | baju | jiaju | xiju | yidaliju | taiju | + +| 港台剧 | 法剧 | 澳剧 | +| --------- | ---- | ---- | +| gangtaiju | faju | aoju | + +#### 制片地区 + +| 大陆 | 中国香港 | 中国台湾 | +| ---- | -------- | -------- | + +| 美国 | 英国 | 日本 | 韩国 | 法国 | +| ---- | ---- | ---- | ---- | ---- | + +| 印度 | 德国 | 西班牙 | 意大利 | 澳大利亚 | +| ---- | ---- | ------ | ------ | -------- | + +| 比利时 | 瑞典 | 荷兰 | 丹麦 | 加拿大 | 俄罗斯 | +| ------ | ---- | ---- | ---- | ------ | ------ | + +#### 影视排序 + +| 更新时间 | 豆瓣评分 | +| -------- | -------- | +| 0 | 1 | + + + ## 播客 IBC 岩手放送| IBC ラジオ イヤーマイッタマイッタ ### IBC 岩手放送| IBC ラジオ イヤーマイッタマイッタ diff --git a/lib/router.js b/lib/router.js index 5bb0f656c..622a1acb7 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3780,4 +3780,7 @@ router.get('/nace/blog/:sort?', require('./routes/nace/blog')); // Caixin Latest router.get('/caixin/latest', require('./routes/caixin/latest')); +// 哔嘀影视 +router.get('/bde4/:type?/:caty?/:area?/:year?/:order?', require('./routes/bde4/index')); + module.exports = router; diff --git a/lib/routes/bde4/index.js b/lib/routes/bde4/index.js new file mode 100644 index 000000000..f7533d3cb --- /dev/null +++ b/lib/routes/bde4/index.js @@ -0,0 +1,77 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const type = ctx.params.type || 'all'; + const caty = ctx.params.caty || 'all'; + const area = ctx.params.area || 'all'; + const year = ctx.params.year || 'all'; + const order = ctx.params.order || '0'; + + const rootUrl = 'https://bde4.cc'; + const currentUrl = `${rootUrl}/s/${caty}?${type === 'all' ? '' : '&type=' + type}${area === 'all' ? '' : '&area=' + area}${year === 'all' ? '' : '&year=' + year}&order=${order}`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + let jsessionid = ''; + + const list = $('.card a') + .slice(0, 15) + .map((_, item) => { + item = $(item); + const link = item.attr('href').split(';jsessionid='); + jsessionid = link[1]; + return { + title: item.attr('title'), + link: `${rootUrl}${link[0]}`, + pubDate: new Date(item.parent().find('.meta span').text()).toUTCString(), + }; + }) + .get(); + + const headers = { + cookie: `JSESSIONID=${jsessionid}`, + }; + + const items = await Promise.all( + list.map( + async (item) => + await ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + headers, + }); + const downloadResponse = await got({ + method: 'get', + url: `${rootUrl}/downloadInfo/list?mid=${item.link.split('/')[4].split('.')[0]}`, + headers, + }); + const content = cheerio.load(detailResponse.data); + + let downloadLinks = ''; + for (const downloadLink of downloadResponse.data) { + downloadLinks += `
${downloadLink.downloadCategory.name}: ${downloadLink.url}
`; + } + + const torrents = content('#download-wrapper').nextAll('.list').eq(0); + + item.description = content('.info0').html() + `
下载地址:${downloadLinks}
` + `${torrents.html() ? `
种子列表:${torrents.html()}
` : ''}`; + item.enclosure_url = torrents.html() ? torrents.find('a.header').eq(0).attr('href') : downloadResponse.data.pop().url; + item.enclosure_type = 'application/x-bittorrent'; + + return item; + }) + ) + ); + + ctx.state.data = { + title: '哔嘀影视', + link: currentUrl, + item: items, + }; +};