feat: add route 排行榜 for 字幕组 (#5057)
This commit is contained in:
parent
0f45667a91
commit
8dae05a8f9
|
|
@ -541,12 +541,20 @@ pageClass: routes
|
|||
|
||||
## 字幕组(ZiMuZu.tv)
|
||||
|
||||
### 影视
|
||||
|
||||
::: tip 提示
|
||||
|
||||
跟官方提供的 RSS 相比:官方使用了不规范的 magnet 字段,无法被 BT 客户端识别并自动下载,其他数据相同
|
||||
|
||||
:::
|
||||
|
||||
### 影视
|
||||
|
||||
<Route author="DIYgod" example="/zimuzu/resource/37031" path="/zimuzu/resource/:id?" :paramsDesc="['影视 id,对应影视的 URL 中找到,为空时输出最近更新']" supportBT="1"/>
|
||||
|
||||
### 排行榜
|
||||
|
||||
<Route author="queensferryme" example="/zimuzu/top/week/movie" path="/zimuzu/top/:range/:type" :paramsDesc="['时间范围, 可以是 `week` `month` `year` `total`', '排行类型, 可以是 `fav` `tv` `movie`']">
|
||||
|
||||
例如,路由 `/zimuzu/top/week/movie` 应该输出 <http://www.rrys2019.com/html/top/week_movie_list.html> 的排行榜单
|
||||
|
||||
</Route>
|
||||
|
|
|
|||
|
|
@ -1108,6 +1108,7 @@ router.get('/cpu/yjsy', require('./routes/universities/cpu/yjsy'));
|
|||
|
||||
// 字幕组
|
||||
router.get('/zimuzu/resource/:id?', require('./routes/zimuzu/resource'));
|
||||
router.get('/zimuzu/top/:range/:type', require('./routes/zimuzu/top'));
|
||||
|
||||
// 虎嗅
|
||||
router.get('/huxiu/tag/:id', require('./routes/huxiu/tag'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { range, type } = ctx.params;
|
||||
|
||||
const url = `http://www.rrys2019.com/html/top/${range}_${type}_list.html`;
|
||||
const response = await got(url);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('li.clearfix');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '浏览数最多的电影',
|
||||
link: url,
|
||||
item: list
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.info a').first().text(),
|
||||
description: item.find('.info p').first().html() + `<img src='${item.find('.img img').first().attr('rel')}'>`,
|
||||
link: item.find('.info a').first().attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue