diff --git a/docs/multimedia.md b/docs/multimedia.md index 9719460d6..4510e86b4 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -63,6 +63,25 @@ pageClass: routes ::: +## CNTV 栏目 + +::: tip 提示 + +栏目 ID 查找示例: +打开栏目具体某一期页面,F12 控制台输入`column_id`得到栏目 ID。 + +::: + + + +栏目 + +| 新闻联播 | 新闻周刊 | 天下足球 | +| -------------------- | -------------------- | -------------------- | +| TOPC1451528971114112 | TOPC1451559180488841 | TOPC1451551777876756 | + + + ## EZTV ::: tip 提示 diff --git a/lib/router.js b/lib/router.js index 1cfdc3f6c..a13901e18 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3453,10 +3453,11 @@ router.get('/wsj/:lang/:category', require('./routes/wsj/index')); // China File router.get('/chinafile/:category?', require('./routes/chinafile/index')); -// Grand-Challenge-user -router.get('/grandchallenge/user/:id', require('./routes/grandchallenge/user')); +// CNTV +router.get('/cntv/:column', require('./routes/cntv/cntv')); -// Grand-Challenge-Challenges +// Grand-Challenge +router.get('/grandchallenge/user/:id', require('./routes/grandchallenge/user')); router.get('/grandchallenge/challenges', require('./routes/grandchallenge/challenges')); module.exports = router; diff --git a/lib/routes/cntv/cntv.js b/lib/routes/cntv/cntv.js new file mode 100644 index 000000000..41fdb1bd7 --- /dev/null +++ b/lib/routes/cntv/cntv.js @@ -0,0 +1,24 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const id = ctx.params.column; + + const response = await got({ + method: 'get', + url: `http://api.cntv.cn/lanmu/videolistByColumnId?id=${id}&n=20&of=fdate&p=1&type=0&serviceId=tvcctv`, + }); + const data = response.data.response.docs; + const name = data[0].videoTag.split(',')[0] || id; + + ctx.state.data = { + title: `CNTV 栏目 - ${name}`, + description: `${name} 栏目的视频更新`, + item: data.map((item) => ({ + title: item.videoTitle, + description: `

${item.videoBrief}



在线观看: M3U8在线播放

`, + pubDate: new Date(item.videoProductiontime * 1).toUTCString(), + link: item.videoUrl, + category: item.videoTag.split(','), + })), + }; +};