From 8dae05a8f9120022b5d06aa8e0b45daae85d1012 Mon Sep 17 00:00:00 2001 From: Queensferry Date: Sun, 28 Jun 2020 14:01:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20route=20=E6=8E=92=E8=A1=8C?= =?UTF-8?q?=E6=A6=9C=20for=20=E5=AD=97=E5=B9=95=E7=BB=84=20(#5057)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/multimedia.md | 12 ++++++++++-- lib/router.js | 1 + lib/routes/zimuzu/top.js | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 lib/routes/zimuzu/top.js diff --git a/docs/multimedia.md b/docs/multimedia.md index db244c03d..e489d07e0 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -541,12 +541,20 @@ pageClass: routes ## 字幕组(ZiMuZu.tv) +### 影视 + ::: tip 提示 跟官方提供的 RSS 相比:官方使用了不规范的 magnet 字段,无法被 BT 客户端识别并自动下载,其他数据相同 ::: -### 影视 - + +### 排行榜 + + + +例如,路由 `/zimuzu/top/week/movie` 应该输出 的排行榜单 + + diff --git a/lib/router.js b/lib/router.js index c8840bec3..c5e562fa1 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/zimuzu/top.js b/lib/routes/zimuzu/top.js new file mode 100644 index 000000000..8104c0ae3 --- /dev/null +++ b/lib/routes/zimuzu/top.js @@ -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() + ``, + link: item.find('.info a').first().attr('href'), + }; + }) + .get(), + }; +};