feat(route): add National Museum of China (#19084)

* 添加源"中国国家博物馆"

* 添加源"中国国家博物馆"

* 添加源"中国国家博物馆"

* Update lib/routes/chnmuseum/xingnew.ts

Only use template literals when necessary.

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/chnmuseum/xingnew.ts

Only use template literals when necessary.

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/chnmuseum/xwzt.ts

Only use template literals when necessary.

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/chnmuseum/xwzt.ts

Only use template literals when necessary.

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/chnmuseum/xingnew.ts

change categories to 'travel'

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/routes/chnmuseum/xwzt.ts

change categories to 'travel'

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

---------

Co-authored-by: liji <test1@123.com>
This commit is contained in:
ShabbyWhineYear
2025-05-14 09:33:00 +08:00
committed by GitHub
co-authored by Tony liji
parent 31f67a2c39
commit 03ebfff566
3 changed files with 152 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'National Museum Of China',
url: 'www.chnmuseum.cn',
description: '中国国家博物馆(National Museum of China)位于北京市中心天安门广场东侧,东长安街南侧,与人民大会堂东西相对称,是一座系统展示中华民族文化历史的综合性博物馆,也是世界上最大的博物馆之一。',
zh: {
name: '中国国家博物馆',
},
};
+74
View File
@@ -0,0 +1,74 @@
import { Route } from '@/types';
import ofetch from '@/utils/ofetch';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
import cache from '@/utils/cache';
import timezone from '@/utils/timezone';
export const route: Route = {
path: '/zx/xingnew',
categories: ['travel'],
example: '/zx/xingnew',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['chnmuseum.cn/zx/xingnew'],
target: '/zx/xingnew',
},
],
name: '资讯要闻',
maintainers: ['ShabbyWhineYear'],
handler: async () => {
const response = await ofetch('https://www.chnmuseum.cn/zx/xingnew/');
const $ = load(response);
const list = $('ul.cj_xushuliebao_list li')
.toArray()
.map((item) => {
item = $(item);
const a = item.find('a');
const dateText = item.find('span.date').text();
return {
title: a.attr('title') || a.text(),
link: new URL(a.attr('href'), 'https://www.chnmuseum.cn/zx/xingnew/').href,
pubDate: timezone(parseDate(dateText, 'YYYY/MM/DD'), +8),
// description: a.attr('title') || a.text(),
};
});
const items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link, async () => {
const response = await ofetch(item.link);
const $ = load(response);
// 选择类名为“comment-body”的第一个元素
item.description = $('.cj_xw_cong').first().html();
// 上面每个列表项的每个属性都在此重用,
// 并增加了一个新属性“description”
return item;
})
)
);
return {
// 源标题
title: '中国国家博物馆资讯要闻',
// 源链接
link: 'https://www.chnmuseum.cn/zx/xingnew/',
// 源文章
item: items,
};
},
};
+68
View File
@@ -0,0 +1,68 @@
import { Route } from '@/types';
import ofetch from '@/utils/ofetch';
import { load } from 'cheerio';
export const route: Route = {
path: '/zx/xwzt',
categories: ['travel'],
example: '/zx/xwzt',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['chnmuseum.cn/zx/xwzt'],
target: '/zx/xwzt',
},
],
name: '资讯专题',
maintainers: ['ShabbyWhineYear'],
handler: async () => {
const response = await ofetch('https://www.chnmuseum.cn/zx/xwzt/');
const $ = load(response);
const items = $('ul.cj_hd_zhanh li')
.toArray()
.map((item) => {
item = $(item);
const a = item.find('div.cj_hd_biaoti a').first();
return {
title: a.attr('title') || a.text(),
link: new URL(a.attr('href'), 'https://www.chnmuseum.cn').href,
};
});
// const items = await Promise.all(
// list.map((item) =>
// cache.tryGet(item.link, async () => {
// const response = await ofetch(item.link);
// const $ = load(response);
//
// // 选择类名为“comment-body”的第一个元素
// item.description = $('.cj_xw_cong').first().html();
//
// // 上面每个列表项的每个属性都在此重用,
// // 并增加了一个新属性“description”
// return item;
// })
// )
// );
return {
// 源标题
title: '中国国家博物馆资讯专题',
// 源链接
link: 'https://www.chnmuseum.cn/zx/xwzt/',
// 源文章
item: items,
};
},
};