feat(route): add 齐鲁网电视节目 (#13676)

* chore(deps-dev): bump @tsconfig/docusaurus in /website (#686)

Bumps [@tsconfig/docusaurus](https://github.com/tsconfig/bases/tree/HEAD/bases) from 2.0.1 to 2.0.2.
- [Commits](https://github.com/tsconfig/bases/commits/HEAD/bases)

---
updated-dependencies:
- dependency-name: "@tsconfig/docusaurus"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(route): add 齐鲁网电视节目

* fix template

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Ethan Shen
2023-11-02 21:23:18 +08:00
committed by GitHub
co-authored by dependabot[bot]
parent 72f9a1f214
commit 0acae72394
6 changed files with 261 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/v/category?': ['nczitzk'],
};
+98
View File
@@ -0,0 +1,98 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const { category = 'sdws/sdxwlb' } = ctx.params;
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30;
const rootUrl = 'http://v.iqilu.com';
const currentUrl = new URL(category, rootUrl).href;
const { data: response } = await got(currentUrl);
const $ = cheerio.load(response);
let items = $('#jmzhanshi1 dl')
.slice(0, limit)
.toArray()
.map((item) => {
item = $(item);
const a = item.find('a').first();
const image = item.find('img').first();
item.find('dd').last().remove();
return {
title: a.prop('title'),
link: a.prop('href'),
description: art(path.join(__dirname, 'templates/description.art'), {
image: {
src: image.prop('src'),
alt: image.prop('alt'),
},
}),
pubDate: parseDate(
item
.find('dd')
.last()
.text()
.match(/(\d{4}-\d{2}-\d{2})/)[1]
),
itunes_item_image: image.prop('src'),
};
});
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: detailResponse } = await got(item.link);
const content = cheerio.load(detailResponse);
item.title = content('div.vtitle').text();
item.enclosure_url = content('#copy_mp4text').prop('value');
item.enclosure_type = item.enclosure_url ? `video/${item.enclosure_url.split(/\./).pop()}` : undefined;
item.description = art(path.join(__dirname, 'templates/description.art'), {
image: {
src: item.itunes_item_image,
alt: item.title,
},
video: {
src: item.enclosure_url,
type: item.enclosure_type,
},
description: content('div.vinfo').text().trim(),
});
return item;
})
)
);
const icon = new URL($('link[rel="icon"]').prop('href'), rootUrl).href;
const author = $('div.host_pic dl dd a')
.toArray()
.map((a) => $(a).text())
.join('/');
ctx.state.data = {
item: items,
title: $('title').text(),
link: currentUrl,
description: $('meta[name="description"]').prop('content'),
language: $('html').prop('lang'),
image: $('div.s_logo img').prop('src'),
icon,
logo: icon,
subtitle: $('meta[name="keywords"]').prop('content'),
author,
itunes_author: author,
itunes_category: 'News',
allowEmpty: true,
};
};
+107
View File
@@ -0,0 +1,107 @@
module.exports = {
'iqilu.com': {
_name: '齐鲁网',
v: [
{
title: '电视节目',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/:category*'],
target: (params) => {
const category = params.category;
return `/iqilu/v${category ? `/${category}` : ''}`;
},
},
{
title: '山东新闻联播',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/sdws/sdxwlb'],
target: '/iqilu/v/sdws/sdxwlb',
},
{
title: '闪电大视野',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/ggpd/sddsy'],
target: '/iqilu/v/ggpd/sddsy',
},
{
title: '山东三农新闻联播',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/nkpd/snxw'],
target: '/iqilu/v/nkpd/snxw',
},
{
title: '每日新闻',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/qlpd/mrxw'],
target: '/iqilu/v/qlpd/mrxw',
},
{
title: '新闻午班车',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/ggpd/xwwbc'],
target: '/iqilu/v/ggpd/xwwbc',
},
{
title: '戏宇宙',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/sdws/xyz/'],
target: '/iqilu/v/sdws/xyz/',
},
{
title: '中国礼 中国乐',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/qlpd/zglzgy'],
target: '/iqilu/v/qlpd/zglzgy',
},
{
title: '超级语文课',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/sdws/cjywk'],
target: '/iqilu/v/sdws/cjywk',
},
{
title: '文物里的山东',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/yspd/wwldsd'],
target: '/iqilu/v/yspd/wwldsd',
},
{
title: '拉呱',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/qlpd/l0'],
target: '/iqilu/v/qlpd/l0',
},
{
title: '生活帮',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/shpd/shb'],
target: '/iqilu/v/shpd/shb',
},
{
title: '快乐大赢家',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/zypd/kldyj'],
target: '/iqilu/v/zypd/kldyj',
},
{
title: '乡村季风',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/nkpd/xcjf'],
target: '/iqilu/v/nkpd/xcjf',
},
{
title: '健康是1',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/ggpd/jks1'],
target: '/iqilu/v/ggpd/jks1',
},
{
title: '此时此刻',
docs: 'https://docs.rsshub.app/routes/traditional-media#qi-lu-wang-dian-shi-jie-mu',
source: ['/sdws/cishicike'],
target: '/iqilu/v/sdws/cishicike',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/v/:category*', require('./program'));
};
+24
View File
@@ -0,0 +1,24 @@
{{ if image && !video }}
<figure>
<img src="{{ image.src }}" alt="{{ image.alt }}">
</figure>
{{ /if }}
{{ if video }}
<video
{{ if image }}
poster="{{ image.src }}"
{{ /if }}
controls>
<source
src="{{ video.src }}"
type="{{ video.type }}">
<object data="{{ video.src }}">
<embed src="{{ video.src }}">
</object>
</video>
{{ /if }}
{{ if description }}
<p>{{ description }}</p>
{{ /if }}
+26
View File
@@ -2205,6 +2205,32 @@ category 对应的关键词有
</Route>
## 齐鲁网 {#qi-lu-wang}
### 电视节目 {#qi-lu-wang-dian-shi-jie-mu}
<Route author="nczitzk" example="/iqilu/v/sdws/sdxwlb" path="/iqilu/v/:category?" paramsDesc={['节目 id,可在对应节目页 URL 中找到,见下表,默认为 `sdws/sdxwlb`,即山东新闻联播']} radar="1" rssbud="1" supportPodcast="1">
| 节目名称 | 节目 id |
| ---------------- | -------------- |
| 山东新闻联播 | sdws/sdxwlb |
| 闪电大视野 | ggpd/sddsy |
| 山东三农新闻联播 | nkpd/snxw |
| 每日新闻 | qlpd/mrxw |
| 新闻午班车 | ggpd/xwwbc |
| 戏宇宙 | sdws/xyz/ |
| 中国礼 中国乐 | qlpd/zglzgy |
| 超级语文课 | sdws/cjywk |
| 文物里的山东 | yspd/wwldsd |
| 拉呱 | qlpd/l0 |
| 生活帮 | shpd/shb |
| 快乐大赢家 | zypd/kldyj |
| 乡村季风 | nkpd/xcjf |
| 健康是1 | ggpd/jks1 |
| 此时此刻 | sdws/cishicike |
</Route>
## 人民网 {#ren-min-wang}
### 通用 {#ren-min-wang-tong-yong}