feat: add 哔嘀影视

This commit is contained in:
nczitzk 2021-01-05 18:20:35 +08:00
parent b1ae777b87
commit 4797a74207
3 changed files with 148 additions and 0 deletions

View File

@ -495,6 +495,74 @@ pageClass: routes
<Route author="ranpox" example="/iqiyi/dongman/a_19rrh1sifx" path="/iqiyi/dongman/:id" :paramsDesc="['动漫 id, 可在该动漫主页 URL 中找到(不包括`.html`)']"/>
## 哔嘀影视
### 首页
<Route author="nczitzk" example="/bde4" path="/bde4/:type?/:caty?/:area?/:year?/:order?" :paramsDesc="['资源分类,见下表,默认为 `all` 即不限', '影视类型,见下表,默认为 `all` 即不限','制片地区,见下表,默认为 `all` 即不限','上映时间此处填写年份不小于2000默认为 `all` 即不限','影视排序,见下表,默认为更新时间']">
#### 资源分类
| 不限 | 电影 | 电视剧 |
| ---- | ---- | ------ |
| 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 |
</Route>
## 播客 IBC 岩手放送| IBC ラジオ イヤーマイッタマイッタ
### IBC 岩手放送| IBC ラジオ イヤーマイッタマイッタ

View File

@ -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;

77
lib/routes/bde4/index.js Normal file
View File

@ -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 += `<div class="item">${downloadLink.downloadCategory.name}: <a href="${downloadLink.url}">${downloadLink.url}</a></div>`;
}
const torrents = content('#download-wrapper').nextAll('.list').eq(0);
item.description = content('.info0').html() + `<div><b>下载地址:</b>${downloadLinks}</div>` + `${torrents.html() ? `<div><b>种子列表:</b>${torrents.html()}</div>` : ''}`;
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,
};
};