feat(route): add 人人影视-今日播出 (#9619)

* feat(route): add 人人影视-今日播出

* feat(route): 人人影视-今日更新 v2 standard

* refactor: migrate to v2

* fix: apply suggestion
This commit is contained in:
bao1991213 2022-04-27 23:01:32 +08:00 committed by GitHub
parent 5adab5e8ae
commit bba6a46d19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 122 additions and 72 deletions

View File

@ -1290,13 +1290,19 @@ JavDB 有多个备用域名,本路由默认使用永久域名 <https://javdb.c
## 人人影视
### 评测推荐
### 影视资讯
<Route author="wb121017405" example="/rrys/review" path="/rrys/review" />
<Route author="wb121017405" example="/yyets/article" path="/yyets/article/:type?" paramsDesc="['分类,见下表,默认为全部']" radar="1" rssbud="1">
### 今日更新
| 全部 | 影视资讯 | 收视快报 | 人人影评 | 人人剧评 | 新剧评测 | 片单推荐 |
| -- | ---- | ------ | -------- | -------- | ---------- | ----- |
| | news | report | m_review | t_review | new_review | recom |
<Route author="alcarl" example="/yyets/todayfilelist" path="/yyets/todayfilelist" />
</Route>
### 今日播出
<Route author="bao1991213" example="/yyets/today" path="/yyets/today" radar="1" rssbud="1"/>
## 色花堂中文论坛

View File

@ -869,11 +869,10 @@ router.get('/dytt/index', lazyloadRouteHandler('./routes/dytt/index')); // 废
// 人生05电影网
router.get('/rs05/rs05', lazyloadRouteHandler('./routes/rs05/rs05'));
// 人人影视 (评测推荐)
router.get('/rrys/review', lazyloadRouteHandler('./routes/rrys/review'));
// 人人影视 (评测推荐) migrated to v2
// router.get('/rrys/review', lazyloadRouteHandler('./routes/rrys/review'));
// 人人影视(每日更新)
router.get('/yyets/todayfilelist', lazyloadRouteHandler('./routes/yyets/todayfilelist'));
// router.get('/yyets/todayfilelist', lazyloadRouteHandler('./routes/yyets/todayfilelist'));
// 趣头条
router.get('/qutoutiao/category/:cid', lazyloadRouteHandler('./routes/qutoutiao/category'));

View File

@ -1,30 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const baseURL = 'http://www.rrys2019.com';
module.exports = async (ctx) => {
const response = await got.get(baseURL + '/article');
const $ = cheerio.load(response.data);
const list = $('.article-list li');
ctx.state.data = {
title: '人人影视-评测推荐',
link: baseURL + '/article',
item:
list &&
list
.map((index, item) => {
item = $(item);
const itemPicUrl = item.find('.fl-img img').attr('src');
const itemDesc = item.find('.fl-info p').text().split('By')[0];
return {
title: item.find('.fl-info h3 a').text(),
author: item.find('.fl-info p a').text(),
description: `描述:${itemDesc}<br><img src="${itemPicUrl}">`,
link: baseURL + item.find('.fl-info h3 a').attr('href'),
};
})
.get(),
};
};

View File

@ -1,34 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
// 发起 HTTP GET 请求
const response = await got({
method: 'get',
url: `http://file.apicvn.com/file/list`,
});
const data = response.data; // response.data 为 HTTP GET 请求返回的数据对象
// 这个对象中包含了数组名为 data所以 response.data.data 则为需要的数据
ctx.state.data = {
// 源标题
title: `yyets 的今日更新`,
// 源链接
link: `http://file.apicvn.com/file/list`,
// 源说明
description: `yyets 的今日更新视频列表`,
// 遍历此前获取的数据
item: data.map((item) => ({
// 文章标题
title: item.file_name,
// 文章正文
description: ``,
// 文章发布时间
pubDate: item.create_time,
// 文章链接
link: `${item.magnet_url}&tr=http://tr.cili001.com:8070/announce&tr=udp://p4p.arenabg.com:1337&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://open.demonii.com:1337`,
enclosure_url: `${item.magnet_url}&tr=http://tr.cili001.com:8070/announce&tr=udp://p4p.arenabg.com:1337&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://open.demonii.com:1337`, // 磁力链接
enclosure_type: 'application/x-bittorrent', // 固定为 'application/x-bittorrent'
})),
};
};

45
lib/v2/yyets/article.js Normal file
View File

@ -0,0 +1,45 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const baseURL = 'https://yysub.net';
module.exports = async (ctx) => {
const type = ctx.params.type ?? '';
const url = `${baseURL}/article${type ? '?type=' + type : ''}`;
const response = await got(url);
const $ = cheerio.load(response.data);
let items = $('.article-list li .fl-info')
.toArray()
.map((e) => {
e = $(e);
return {
title: e.find('h3 a').text(),
link: `${baseURL}${e.find('h3 a').attr('href')}`,
author: e.find('p a').text(),
pubDate: timezone(parseDate(e.find('p').eq(2).text()), +8),
};
});
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got(item.link);
const content = cheerio.load(detailResponse.data);
item.description = content('.information-desc').html();
return item;
})
)
);
ctx.state.data = {
title: `${$('title').text()} - 人人影视`,
description: $('meta[name="description"]').attr('content'),
link: url,
item: items,
};
};

View File

@ -0,0 +1,4 @@
module.exports = {
'/article/:type?': ['wb121017405'],
'/today': ['bao1991213'],
};

19
lib/v2/yyets/radar.js Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
'yysub.net': {
_name: '人人影视',
'.': [
{
title: '影视资讯',
docs: 'https://docs.rsshub.app/multimedia#ren-ren-ying-shi',
source: '/article',
target: (_params, url) => `/yyets/article${new URL(url).searchParams.has('type') ? '/' + new URL(url).searchParams.get('type') : ''}`,
},
{
title: '今日播出',
docs: 'https://docs.rsshub.app/multimedia#ren-ren-ying-shi',
source: ['/tv/schedule', '/'],
target: '/yyets/today',
},
],
},
};

4
lib/v2/yyets/router.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = function (router) {
router.get('/article/:type?', require('./article'));
router.get('/today', require('./today'));
};

37
lib/v2/yyets/today.js Normal file
View File

@ -0,0 +1,37 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
// 发起 HTTP GET 请求
const response = await got({
method: 'get',
url: 'https://yysub.net',
});
const data = response.data; // response.data 为 HTTP GET 请求返回的 HTML也就是简书首页的所有 HTML
const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML
const list = $('.today-list-wrap').find('ul').find('li');
// 使用 cheerio 选择器,选择带有 data-item_id 属性的所有 div 元素,返回 cheerio node 对象数组
// 注:每一个 cheerio node 对应一个 HTML DOM
// 注cheerio 选择器与 jquery 选择器几乎相同
// 参考 cheerio 文档https://cheerio.js.org/
ctx.state.data = {
title: '人人影视-今日播出',
link: 'https://yysub.net',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('a').first().text(),
link: item.find('a').attr('href'),
guid: item.find('a').first().text(),
};
})
.get(),
};
};