feat(route): 综艺秀(www.zyshow.net) (#7703)

Co-authored-by: rm <rm@cqkcy.com>
Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
pharaoh2012
2021-07-17 02:32:36 -07:00
committed by GitHub
co-authored by rm NeverBehave
parent b10414518a
commit 71746492b9
4 changed files with 61 additions and 0 deletions
+10
View File
@@ -3041,4 +3041,14 @@
},
],
},
'zyshow.net': {
www: [
{
title: '',
docs: 'https://docs.rsshub.app/game.html#lv-fa-shi-ying-di',
source: '/:name/',
target: '/zyshow/:name',
},
],
},
});
+6
View File
@@ -1134,3 +1134,9 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
例如,路由 `/zimuzu/top/week/movie` 应该输出 <http://www.rrys2019.com/html/top/week_movie_list.html> 的排行榜单
</Route>
## 综艺秀(www.zyshow.net)
### 综艺
<Route author="pharaoh2012" example="/zyshow/chongchongchong" path="/zyshow/:name" :paramsDesc="['综艺 name,对应综艺的 URL 中找到']" radar="1" rssbud="1"/>
+3
View File
@@ -4127,6 +4127,9 @@ router.get('/bibgame/:category?/:type?', require('./routes/bibgame/category'));
// 澳門特別行政區政府各公共部門獎助貸學金服務平台
router.get('/macau-bolsas/:lang?', require('./routes/macau-bolsas/index'));
// 综艺秀
router.get('/zyshow/:name', require('./routes/zyshow'));
// 加美财经
router.get('/caus/:category?', require('./routes/caus'));
+42
View File
@@ -0,0 +1,42 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
ctx.params.name = ctx.params.name || 'chongchongchong';
const rootUrl = `http://www.zyshow.net`;
const currentUrl = `${rootUrl}/${ctx.params.name}/`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('#event_detail table tr')
.slice(1, 30)
.map((_, tr) => {
tr = $(tr);
const link = tr.find('td a');
const tds = tr.find('td');
const name = $(tds[0]).html();
const zt = $(tds[1]).text();
const lb = $(tds[2]).text();
const des = `<table><tr><td>播出日期:</td><td><b>${name}</b></td></tr>
<tr><td>综艺节目主题:</td><td><b>${zt}</b></td></tr>
<tr><td>综艺节目来宾:</td><td><b>${lb}</b></td></tr>
</table>`;
return {
title: link.text(),
link: `${rootUrl}/${link.attr('href')}`,
description: des,
author: link.text(),
};
})
.get();
ctx.state.data = {
title: `${$('title').text()}`,
link: currentUrl,
item: list,
};
};