diff --git a/docs/anime.md b/docs/anime.md index addf38fed..0767aba9d 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -4,6 +4,11 @@ pageClass: routes # 二次元 +## 005.tv + +### 二次元资讯 + + ## Anime1 ### 動畫 diff --git a/lib/router.js b/lib/router.js index 69d49ba66..fcbd1b813 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1386,4 +1386,7 @@ router.get('/yxdzqb/:type', require('./routes/yxdzqb')); // 怪物猎人 router.get('/monsterhunter/update', require('./routes/monsterhunter/update')); +// 005.tv +router.get('/005tv/zx/latest', require('./routes/005tv/zx')); + module.exports = router; diff --git a/lib/routes/005tv/zx.js b/lib/routes/005tv/zx.js new file mode 100644 index 000000000..eb77800de --- /dev/null +++ b/lib/routes/005tv/zx.js @@ -0,0 +1,49 @@ +const got = require('@/utils/got'); +const host = 'http://www.005.tv/zx'; +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const response = await got(host); + const data = response.body; + const $ = cheerio.load(data); + const list = $('div.article-list li'); + ctx.state.data = { + title: $('head > title').text(), + link: host, + description: '二次元资讯', + item: list + .map((index, item) => ({ + title: $(item) + .find('h3 > a') + .text() + .trim(), + description: `
+ ${$(item) + .find('div.p-row') + .text()}`, + link: $(item) + .find('h3 > a') + .attr('href'), + pubDate: new Date( + $(item) + .find('span.fr.time') + .text() + .trim() + .substr(0, 4), + $(item) + .find('span.fr.time') + .text() + .trim() + .substr(5, 2), + $(item) + .find('span.fr.time') + .text() + .trim() + .substr(8, 4) + ).toUTCString(), + })) + .get(), + }; +};