From dab7da03a8762415f9fd272dd6f508b73f8ecb58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Thu, 10 Jan 2019 12:04:22 +0800 Subject: [PATCH] Enhancement: cctv video (#1378) Closes #1376 --- lib/routes/cctv/utils/news.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/routes/cctv/utils/news.js b/lib/routes/cctv/utils/news.js index ee15b0e31..ac6b9d90d 100644 --- a/lib/routes/cctv/utils/news.js +++ b/lib/routes/cctv/utils/news.js @@ -15,7 +15,7 @@ module.exports = async (category, ctx) => { const data = response.data; const list = data.rollData; const resultItem = await Promise.all( - list.map(async ({ title, url, dateTime }) => { + list.map(async ({ title, url, dateTime, image }) => { const item = { title, link: url, @@ -41,6 +41,11 @@ module.exports = async (category, ctx) => { // 图片 api = `http://api.cntv.cn/Article/contentinfo?id=${id}&serviceId=sjnews&t=json`; type = 'PHO'; + } else if (id.startsWith('VIDE')) { + // 视频 + const vid = path.parse(image).name.split('-')[0]; + api = `http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=${vid}`; + type = 'VIDE'; } else { // 未识别 description = unknownTip; @@ -71,6 +76,10 @@ module.exports = async (category, ctx) => { }, ''); break; + case 'VIDE': + description = ``; + break; + default: description = unknownTip; }