diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 9fd8c7fb74..953dd38daa 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -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', + }, + ], + }, }); diff --git a/docs/traditional-media.md b/docs/traditional-media.md index 33075862c4..1b6f995d5c 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -359,6 +359,12 @@ category 对应的关键词有 +## 新闻联播文字版 + +### 新闻联播文字版 + + + ## 央视新闻 ### 新闻联播 diff --git a/lib/router.js b/lib/router.js index abe4862274..73008b6351 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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; diff --git a/lib/routes/xinwenlianbo/index.js b/lib/routes/xinwenlianbo/index.js new file mode 100644 index 0000000000..7bd4060b18 --- /dev/null +++ b/lib/routes/xinwenlianbo/index.js @@ -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, + }; +};