diff --git a/docs/README.md b/docs/README.md index 671597d68..d8cad0902 100644 --- a/docs/README.md +++ b/docs/README.md @@ -802,6 +802,10 @@ GitHub 官方也提供了一些 RSS: +### 腾讯视频 + + + ### 喜马拉雅 diff --git a/router.js b/router.js index 9c45cdd46..ceb671b00 100644 --- a/router.js +++ b/router.js @@ -784,4 +784,7 @@ router.get('/xiachufang/popular/:timeframe?', require('./routes/xiachufang/popul // 经济观察报 router.get('/eeo/:category?', require('./routes/eeo/index')); +// 腾讯视频 +router.get('/tencentvideo/playlist/:id', require('./routes/tencent/video/playlist')); + module.exports = router; diff --git a/routes/tencent/video/playlist.js b/routes/tencent/video/playlist.js new file mode 100644 index 000000000..982a1efd0 --- /dev/null +++ b/routes/tencent/video/playlist.js @@ -0,0 +1,26 @@ +const axios = require('../../../utils/axios'); +const cheerio = require('cheerio'); +module.exports = async (ctx) => { + const id = ctx.params.id; + const link = `https://v.qq.com/detail/${id[0]}/${id}.html`; + const { data } = await axios.get(link); + const $ = cheerio.load(data); + const episodeName = $('[itemprop=episodeNumber]') + .toArray() + .reverse() + .slice(0, 20); + const items = []; + for (const one of episodeName) { + const ele = $(one); + items.push({ + title: ele.text(), + link: ele.parent().attr('href'), + }); + } + ctx.state.data = { + title: $('title').text(), + link, + description: $('meta[name=description]').attr('content'), + item: items, + }; +};