feat: 低端影视 各作品列表页面路由 (#3908)

This commit is contained in:
hoilc
2020-02-07 03:31:30 +08:00
committed by GitHub
parent c8afd2088f
commit 201d6cbdfe
4 changed files with 85 additions and 3 deletions

View File

@@ -1077,4 +1077,34 @@
},
],
},
'ddrk.me': {
_name: '低端影视',
www: [
{
title: '首页',
docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi',
source: '/',
target: '/ddrk/index',
},
{
title: '标签',
docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi',
source: '/tag/:tag',
target: '/ddrk/tag/:tag',
},
{
title: '分类',
docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi',
source: ['/category/:category', '/category/:uplevel/:category'],
target: '/ddrk/category/:category',
},
{
title: '影视剧集更新',
docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi',
source: ['/:name', '/:name/:season'],
target: (params) => `/ddrk/update/${params.name}${params.season ? '/' + params.season : ''}`,
verification: (params) => params.name !== 'category' && params.name !== 'tag' && params.name !== 'ddrklogin' && params.name !== 'about' && params.name !== 'deleted',
},
],
},
});

View File

@@ -295,9 +295,21 @@ pageClass: routes
## 低端影视
### 影视剧集
### 影视剧集更新
<Route author="saintwinkle" example="/ddrk/silicon-valley/6" path="/ddrk/:name/:season?" :paramsDesc="['影视名称,可以在 URL 中找到','季数,可以在 URL 中找到,剧集没有分季时不用填写,或是默认输出第一季的内容']" />
<Route author="saintwinkle" example="/ddrk/update/silicon-valley/6" path="/ddrk/update/:name/:season?" :paramsDesc="['影视名称,可以在 URL 中找到','季数,可以在 URL 中找到,剧集没有分季时不用填写,或是默认输出第一季的内容']" radar="1" />
### 首页
<Route author="hoilc" example="/ddrk/index" path="/ddrk/index" radar="1" />
### 分类
<Route author="hoilc" example="/ddrk/category/jp-drama" path="/ddrk/category/:category" :paramsDesc="['分类 ID, 可在 URL 中找到, 注意, 如果有两级分类, 只需要填写第二级即可']" radar="1" />
### 标签
<Route author="hoilc" example="/ddrk/tag/石原里美" path="/ddrk/tag/:tag" :paramsDesc="['标签名, 可在 URL 中找到']" radar="1" />
## 电影首发站

View File

@@ -2113,7 +2113,10 @@ router.get('/yahoo-news/:region/:category?', require('./routes/yahoo-news/index'
router.get('/baijing', require('./routes/baijing'));
// 低端影视
router.get('/ddrk/:name/:season?', require('./routes/ddrk/index'));
router.get('/ddrk/update/:name/:season?', require('./routes/ddrk/index'));
router.get('/ddrk/tag/:tag', require('./routes/ddrk/list'));
router.get('/ddrk/category/:category', require('./routes/ddrk/list'));
router.get('/ddrk/index', require('./routes/ddrk/list'));
// 公主链接日服公告
router.get('/pcr/news', require('./routes/pcr/news'));

37
lib/routes/ddrk/list.js Normal file
View File

@@ -0,0 +1,37 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const md5 = require('@/utils/md5');
module.exports = async (ctx) => {
const url = ctx.params.tag ? `https://ddrk.me/tag/${encodeURIComponent(ctx.params.tag)}/` : ctx.params.category ? `https://ddrk.me/category/${ctx.params.category}/` : 'https://ddrk.me/';
const response = await got(url);
const $ = cheerio.load(response.data);
const title = $('title').html();
const list = $('.post-box-list .post-box-container').toArray();
ctx.state.data = {
title: title,
link: url,
item: list.map((single, index) => {
const item = $(single);
const name = item.find('.post-box-title').text();
const poster = item
.find('.post-box-image')
.attr('style')
.match(/url\((.*?)\)/)[1];
const text = item.find('.post-box-text p').html();
const time = new Date();
time.setMinutes(time.getMinutes() - index);
return {
title: name,
author: '低端影视',
description: `<img src="${poster}" style="max-width: 100%;" >${text ? text : ''}`,
link: item.find('.post-box-title a').attr('href'),
pubDate: time,
guid: md5(name),
};
}),
};
};