mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat: add route for 新闻联播文字版 (#3582)
This commit is contained in:
@@ -926,4 +926,16 @@
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'govopendata.com': {
|
||||
_name: '新闻联播文字版',
|
||||
cn: [
|
||||
{
|
||||
title: '新闻联播文字版',
|
||||
docs: 'https://docs.rsshub.app/traditional-media.html#xin-wen-lian-bo-wen-zi-ban',
|
||||
source: '/xinwenlianbo',
|
||||
target: '/xinwenlianbo/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -359,6 +359,12 @@ category 对应的关键词有
|
||||
|
||||
<Route author="xyqfer" example="/sina/rollnews" path="/sina/rollnews" />
|
||||
|
||||
## 新闻联播文字版
|
||||
|
||||
### 新闻联播文字版
|
||||
|
||||
<Route author="luyuhuang" example="/xinwenlianbo/index" path="/xinwenlianbo/index" radar="1"/>
|
||||
|
||||
## 央视新闻
|
||||
|
||||
### 新闻联播
|
||||
|
||||
@@ -2035,4 +2035,7 @@ router.get('/mastodon/timeline/:site/:only_media?', require('./routes/mastodon/t
|
||||
// Kernel Aliyun
|
||||
router.get('/aliyun-kernel/index', require('./routes/aliyun-kernel/index'));
|
||||
|
||||
// xinwenlianbo
|
||||
router.get('/xinwenlianbo/index', require('./routes/xinwenlianbo/index'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
33
lib/routes/xinwenlianbo/index.js
Normal file
33
lib/routes/xinwenlianbo/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const root_url = 'https://cn.govopendata.com/xinwenlianbo/';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: root_url,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('table.table.table-bordered > tbody > tr > td')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
const title = a.text();
|
||||
return {
|
||||
title: title,
|
||||
link: a.attr('href'),
|
||||
description: item.find('ul').html(),
|
||||
pubDate: new Date(/(\d{4}-\d+-\d+)/.exec(title)[1] + ' 19:00 GMT+8').toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '新闻联播 文字版',
|
||||
link: root_url,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user