Enhancement: cctv video (#1378)

Closes #1376
This commit is contained in:
凉凉 2019-01-10 12:04:22 +08:00 committed by DIYgod
parent 0016a2e020
commit dab7da03a8
1 changed files with 10 additions and 1 deletions

View File

@ -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 = `<video src="${data.hls_url}" controls="controls" poster="${image}" style="width: 100%"></video>`;
break;
default:
description = unknownTip;
}