diff --git a/lib/v2/hebtv/maintainer.js b/lib/v2/hebtv/maintainer.js new file mode 100644 index 00000000000000..512d2c7404201d --- /dev/null +++ b/lib/v2/hebtv/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/nbszxd': ['iamqiz'], +}; diff --git a/lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js b/lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js new file mode 100644 index 00000000000000..5d35a1a78556eb --- /dev/null +++ b/lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js @@ -0,0 +1,39 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); + +const baseUrl = 'https://web.cmc.hebtv.com/cms/rmt0336/19/19js/st/ds/nmpd/nbszxd/index.shtml'; +const sizeTitle = '农博士在行动-河北广播电视台'; + +module.exports = async (ctx) => { + const response = await got(baseUrl); + const $ = cheerio.load(response.data); + + // 获取当前页面的 list + const list = $('.video_box .tv_items') + .first() + .children() + .toArray() + .map((item) => { + item = $(item); + const a = item.find('a').first(); + const timeMatch = a.text().match(/\d+/); + const timestr = timeMatch ? timeMatch[0] : ''; + + return { + title: a.text(), + // `link` 需要一个绝对 URL,但 `a.attr('href')` 返回一个相对 URL。 + link: `${baseUrl}/../${a.attr('href')}`, + pubDate: timestr ? timezone(parseDate(timestr, 'YYYYMMDD'), +8) : null, + author: '时间|' + timestr, + }; + }); + + ctx.state.data = { + title: sizeTitle, + link: baseUrl, + description: '农博士在行动-河北广播电视台', + item: list, + }; +}; diff --git a/lib/v2/hebtv/radar.js b/lib/v2/hebtv/radar.js new file mode 100644 index 00000000000000..cc328260adecb2 --- /dev/null +++ b/lib/v2/hebtv/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'hebtv.com': { + _name: '河北网络广播电视台', + 'web.cmc': [ + { + title: '农博士在行动', + docs: 'https://docs.rsshub.app/routes/traditional-media#he-bei-wang-luo-guang-bo-dian-shi-tai', + source: '/cms/rmt0336/19/19js/st/ds/nmpd/nbszxd/index.shtml', + target: '/hebtv/nbszxd', + }, + ], + }, +}; diff --git a/lib/v2/hebtv/router.js b/lib/v2/hebtv/router.js new file mode 100644 index 00000000000000..1e301d26a06b93 --- /dev/null +++ b/lib/v2/hebtv/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/nbszxd', require('./nong-bo-shi-zai-xing-dong.js')); +}; diff --git a/website/docs/routes/traditional-media.mdx b/website/docs/routes/traditional-media.mdx index e47d80e959e299..d32a0ee8b6f886 100644 --- a/website/docs/routes/traditional-media.mdx +++ b/website/docs/routes/traditional-media.mdx @@ -1538,6 +1538,12 @@ IT・科学 tech_science +## 河北网络广播电视台 {#he-bei-wang-luo-guang-bo-dian-shi-tai} + +### 农博士在行动 {#he-bei-wang-luo-guang-bo-dian-shi-tai-nong-bo-shi-zai-xing-dong} + + + ## 衡阳全搜索 {#heng-yang-quan-sou-suo} ### 衡阳日报 {#heng-yang-quan-sou-suo-heng-yang-ri-bao}