feat(route): 浙江新闻联播 (#12030)
* feat(route): 浙江新闻联播 * Update lib/v2/cztv/maintainer.js * feat: 浙江新闻联播排除标题 * feat: 浙江新闻联播单条展示 * feat: use art-template ---------
This commit is contained in:
@@ -2278,6 +2278,16 @@ category 对应的关键词有
|
||||
|
||||
<Route author="MisteryMonster" example="/bjnews/epaper/A" path="/bjnews/epaper/:cat" :paramsDesc="['新京报叠名:`A`,`B`,`C`,`D`, 特刊为`special`']"/>
|
||||
|
||||
## 新蓝网(浙江广播电视集团)
|
||||
|
||||
### 浙江新闻联播
|
||||
|
||||
<Route author="yhkang" example="/cztv/zjxwlb" path="/cztv/zjxwlb" />
|
||||
|
||||
### 浙江新闻联播 - 每日合集
|
||||
|
||||
<Route author="yhkang" example="/cztv/zjxwlb/daily" path="/cztv/zjxwlb/daily" />
|
||||
|
||||
## 新浪科技
|
||||
|
||||
### 科学探索
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
|
||||
const renderDesc = (item) => art(path.join(__dirname, 'templates/daily.art'), item);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://www.cztv.com/videos/zjxwlb';
|
||||
|
||||
const { data: res } = await got(url);
|
||||
const $ = cheerio.load(res);
|
||||
const list = $('#videolistss li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const title = item.find('span.t1').text();
|
||||
const link = item.find('input[name=data-url]').attr('value');
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
pubDate: timezone(parseDate(item.find('span.t2').text() + ' 16:30', 'YYYY-MM-DD hh:mm'), +8),
|
||||
};
|
||||
});
|
||||
|
||||
const out = {
|
||||
title: list[0].title,
|
||||
link: list[0].link,
|
||||
pubDate: list[0].pubDate,
|
||||
description: renderDesc({ list: list.slice(1) }),
|
||||
};
|
||||
|
||||
ctx.state.data = {
|
||||
title: '浙江新闻联播-每日合集',
|
||||
link: url,
|
||||
item: [out],
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/zjxwlb': ['yhkang'],
|
||||
'/zjxwlb/daily': ['yhkang'],
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
'cztv.com': {
|
||||
_name: '新蓝网',
|
||||
'.': [
|
||||
{
|
||||
title: '浙江新闻联播',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xin-lan-wang-zhe-jiang-guang-bo-dian-shi-ji-tuan',
|
||||
source: ['/videos/zjxwlb', '/'],
|
||||
target: '/cztv/zjxwlb',
|
||||
},
|
||||
{
|
||||
title: '浙江新闻联播-每日合集',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xin-lan-wang-zhe-jiang-guang-bo-dian-shi-ji-tuan',
|
||||
source: ['/videos/zjxwlb', '/'],
|
||||
target: '/cztv/zjxwlb/daily',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/zjxwlb', require('./zjxwlb'));
|
||||
router.get('/zjxwlb/daily', require('./daily'));
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
{{each list item}}
|
||||
<a href="{{item.link}}">{{item.title}}</a>
|
||||
<br>
|
||||
{{/each}}
|
||||
@@ -0,0 +1,3 @@
|
||||
<video src="{{videoUrl}}" poster="{{posterUrl}}" controls loop>
|
||||
{{title}}
|
||||
</video>
|
||||
@@ -0,0 +1,38 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
|
||||
const renderDesc = (item) => art(path.join(__dirname, 'templates/zjxwlb.art'), item);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://www.cztv.com/videos/zjxwlb';
|
||||
|
||||
const { data: res } = await got(url);
|
||||
const $ = cheerio.load(res);
|
||||
const list = $('#videolistss li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const title = item.find('span.t1').text();
|
||||
const link = item.find('input[name=data-url]').attr('value');
|
||||
const videoUrl = item.find('input[name=video]').attr('value');
|
||||
const posterUrl = item.find('input[name=videoimage]').attr('value');
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
pubDate: timezone(parseDate(item.find('span.t2').text() + ' 16:30', 'YYYY-MM-DD hh:mm'), +8),
|
||||
description: renderDesc({ title, videoUrl, posterUrl }),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: '浙江新闻联播',
|
||||
link: url,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user