Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): add 河北/山东电视台的两个节目 #13666

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/v2/hebtv/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/nbszxd': ['iamqiz'],
};
39 changes: 39 additions & 0 deletions lib/v2/hebtv/nong-bo-shi-zai-xing-dong.js
Original file line number Diff line number Diff line change
@@ -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,
};
};
13 changes: 13 additions & 0 deletions lib/v2/hebtv/radar.js
Original file line number Diff line number Diff line change
@@ -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',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/hebtv/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/nbszxd', require('./nong-bo-shi-zai-xing-dong.js'));
};
3 changes: 3 additions & 0 deletions lib/v2/iqilu/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/xcjf': ['iamqiz'],
};
13 changes: 13 additions & 0 deletions lib/v2/iqilu/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'iqilu.com': {
_name: '山东广播电视台',
v: [
{
title: '乡村季风',
docs: 'https://docs.rsshub.app/routes/traditional-media#shan-dong-guang-bo-dian-shi-tai',
source: '/nkpd/xcjf/index_1.html',
target: '/iqilu/xcjf',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/iqilu/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/xcjf', require('./xiang-cun-ji-feng.js'));
};
39 changes: 39 additions & 0 deletions lib/v2/iqilu/xiang-cun-ji-feng.js
Original file line number Diff line number Diff line change
@@ -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://v.iqilu.com/nkpd/xcjf/index.html';
const sizeTitle = '乡村季风-山东广播电视台';

module.exports = async (ctx) => {
const response = await got(baseUrl);
const $ = cheerio.load(response.data);

// 获取当前页面的 list
const list = $('div#jmzhanshi1')
.first()
.children()
.toArray()
.map((item) => {
item = $(item);
const a = item.find('a').first();
const t = item.find(":contains('时间')").first().text();
const timeMatch = t.match(/\d+-\d+-\d+/);
const timestr = timeMatch ? timeMatch[0] : '';
return {
title: a.attr('title'),
// `link` 需要一个绝对 URL,但 `a.attr('href')` 返回一个相对 URL。
link: String(a.attr('href')),
pubDate: timestr ? timezone(parseDate(timestr, 'YYYY-MM-DD'), +8) : null,
author: '时间|' + timestr,
};
});

ctx.state.data = {
title: sizeTitle,
link: baseUrl,
description: '乡村季风-山东广播电视台',
item: list,
};
};
12 changes: 12 additions & 0 deletions website/docs/routes/traditional-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,12 @@ IT・科学 tech_science

</Route>

## 河北网络广播电视台 {#he-bei-wang-luo-guang-bo-dian-shi-tai}

### 农博士在行动 {#he-bei-wang-luo-guang-bo-dian-shi-tai-nong-bo-shi-zai-xing-dong}

<Route author="iamqiz" example="/hebtv/nbszxd" path="/hebtv/nbszxd"/>

## 衡阳全搜索 {#heng-yang-quan-sou-suo}

### 衡阳日报 {#heng-yang-quan-sou-suo-heng-yang-ri-bao}
Expand Down Expand Up @@ -2249,6 +2255,12 @@ category 对应的关键词有

</Route>

## 山东广播电视台 {#shan-dong-guang-bo-dian-shi-tai}

### 乡村季风 {#shan-dong-guang-bo-dian-shi-tai-xiang-cun-ji-feng}

<Route author="iamqiz" example="/iqilu/xcjf" path="/iqilu/xcjf"/>

## 三立新聞網 {#san-li-xin-wen-wang}

### 新聞 {#san-li-xin-wen-wang-xin-wen}
Expand Down
Loading