rsshub 1.0.0-master.bc89b3d → 1.0.0-master.bca47a1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/follow/config.ts +23 -0
- package/lib/api/index.ts +2 -0
- package/lib/config.ts +13 -1
- package/lib/index.ts +3 -0
- package/lib/routes/163/music/djradio.ts +27 -20
- package/lib/routes/163/templates/music/djradio-content.art +2 -0
- package/lib/routes/36kr/hot-list.ts +5 -0
- package/lib/routes/ali213/namespace.ts +9 -0
- package/lib/routes/ali213/news.ts +269 -0
- package/lib/routes/ali213/templates/description.art +21 -0
- package/lib/routes/ali213/zl.ts +226 -0
- package/lib/routes/amz123/kx.ts +65 -0
- package/lib/routes/amz123/namespace.ts +9 -0
- package/lib/routes/anthropic/namespace.ts +7 -0
- package/lib/routes/anthropic/news.ts +60 -0
- package/lib/routes/apnic/index.ts +61 -0
- package/lib/routes/apnic/namespace.ts +8 -0
- package/lib/routes/baijing/index.ts +48 -0
- package/lib/routes/baijing/namespace.ts +8 -0
- package/lib/routes/bbc/index.ts +47 -42
- package/lib/routes/behance/queries.ts +1015 -0
- package/lib/routes/behance/templates/description.art +23 -0
- package/lib/routes/behance/user.ts +78 -55
- package/lib/routes/bilibili/hot-search.ts +1 -1
- package/lib/routes/bilibili/user-channel.ts +1 -0
- package/lib/routes/bilibili/user-collection.ts +1 -0
- package/lib/routes/blizzard/news.ts +120 -31
- package/lib/routes/bloomberg/authors.ts +6 -6
- package/lib/routes/chinacdc/index.ts +490 -0
- package/lib/routes/chinacdc/namespace.ts +9 -0
- package/lib/routes/chinacdc/templates/description.art +7 -0
- package/lib/routes/chongdiantou/index.ts +54 -0
- package/lib/routes/chongdiantou/namespace.ts +9 -0
- package/lib/routes/copernicium/index.ts +29 -21
- package/lib/routes/daoxuan/namespace.ts +7 -0
- package/lib/routes/daoxuan/rss.ts +43 -0
- package/lib/routes/deepseek/namespace.ts +8 -0
- package/lib/routes/deepseek/news.ts +88 -0
- package/lib/routes/dingshao/namespace.ts +7 -0
- package/lib/routes/dingshao/share.ts +53 -0
- package/lib/routes/dingshao/types.ts +64 -0
- package/lib/routes/duckdb/news.ts +3 -4
- package/lib/routes/dytt/index.ts +75 -0
- package/lib/routes/dytt/namespace.ts +7 -0
- package/lib/routes/egsea/flash.ts +1 -1
- package/lib/routes/fastbull/express-news.ts +4 -4
- package/lib/routes/fastbull/namespace.ts +3 -3
- package/lib/routes/fastbull/news.ts +6 -6
- package/lib/routes/follow/profile.ts +4 -2
- package/lib/routes/foodtalks/index.ts +5 -8
- package/lib/routes/gdufs/namespace.ts +7 -0
- package/lib/routes/gdufs/news.ts +94 -0
- package/lib/routes/gdufs/xwxy/xwxy-news.ts +90 -0
- package/lib/routes/github/repos.ts +55 -18
- package/lib/routes/gov/hainan/iitb/tzgg.ts +77 -0
- package/lib/routes/gov/hainan/namespace.ts +8 -0
- package/lib/routes/hbr/topic.ts +25 -20
- package/lib/routes/hellogithub/article.ts +62 -0
- package/lib/routes/hellogithub/index.ts +2 -2
- package/lib/routes/hellogithub/report.ts +1 -1
- package/lib/routes/hellogithub/volume.ts +1 -1
- package/lib/routes/hexun/index.ts +74 -0
- package/lib/routes/hexun/namespace.ts +8 -0
- package/lib/routes/hiring.cafe/jobs.ts +150 -0
- package/lib/routes/hiring.cafe/namespace.ts +10 -0
- package/lib/routes/hiring.cafe/templates/jobs.art +18 -0
- package/lib/routes/hket/index.ts +1 -1
- package/lib/routes/home-assistant/hacs.ts +50 -0
- package/lib/routes/home-assistant/namespace.ts +7 -0
- package/lib/routes/hrbust/namespace.ts +2 -1
- package/lib/routes/hrbust/news.ts +81 -0
- package/lib/routes/huggingface/blog.ts +87 -0
- package/lib/routes/ifun/n/category.ts +102 -0
- package/lib/routes/ifun/n/search.ts +73 -0
- package/lib/routes/ifun/n/tag.ts +76 -0
- package/lib/routes/ifun/n/util.ts +34 -0
- package/lib/routes/ifun/namespace.ts +9 -0
- package/lib/routes/iheima/index.ts +44 -0
- package/lib/routes/iheima/namespace.ts +8 -0
- package/lib/routes/iresearch/chart.ts +375 -0
- package/lib/routes/iresearch/templates/chart.art +13 -0
- package/lib/routes/isct/namespace.ts +4 -4
- package/lib/routes/jimmyspa/books.ts +112 -0
- package/lib/routes/jimmyspa/namespace.ts +7 -0
- package/lib/routes/jimmyspa/news.ts +124 -0
- package/lib/routes/jimmyspa/templates/description.art +17 -0
- package/lib/routes/jisilu/category.ts +115 -0
- package/lib/routes/jisilu/explore.ts +79 -0
- package/lib/routes/jisilu/namespace.ts +1 -0
- package/lib/routes/jisilu/people.ts +95 -0
- package/lib/routes/jisilu/topic.ts +76 -0
- package/lib/routes/jisilu/util.ts +111 -0
- package/lib/routes/joneslanglasalle/index.ts +311 -0
- package/lib/routes/joneslanglasalle/namespace.ts +13 -0
- package/lib/routes/joneslanglasalle/templates/description.art +21 -0
- package/lib/routes/jrj/index.ts +127 -0
- package/lib/routes/jrj/namespace.ts +8 -0
- package/lib/routes/kuaishou/namespace.ts +8 -0
- package/lib/routes/kuaishou/profile.ts +92 -0
- package/lib/routes/latepost/index.ts +1 -1
- package/lib/routes/luogu/daily.ts +1 -1
- package/lib/routes/luogu/user-article.ts +75 -0
- package/lib/routes/luogu/user-blog.ts +4 -1
- package/lib/routes/luogu/user-feed.ts +9 -10
- package/lib/routes/luogu/utils.ts +17 -0
- package/lib/routes/mihoyo/bbs/timeline.ts +1 -1
- package/lib/routes/mittrchina/index.ts +5 -3
- package/lib/routes/moodysmismicrosite/namespace.ts +7 -0
- package/lib/routes/moodysmismicrosite/report.ts +90 -0
- package/lib/routes/newseed/index.ts +73 -0
- package/lib/routes/newseed/namespace.ts +8 -0
- package/lib/routes/obsidian/plugins.ts +41 -0
- package/lib/routes/papers/index.ts +8 -6
- package/lib/routes/papers/query.ts +112 -0
- package/lib/routes/papers/templates/description.art +4 -0
- package/lib/routes/picnob/templates/desc.art +1 -1
- package/lib/routes/qbitai/category.ts +25 -11
- package/lib/routes/qingting/channel.ts +9 -9
- package/lib/routes/qingting/podcast.ts +13 -23
- package/lib/routes/qweather/3days.ts +4 -3
- package/lib/routes/qweather/now.ts +12 -9
- package/lib/routes/shu/global.ts +1 -0
- package/lib/routes/shu/gs.ts +1 -0
- package/lib/routes/shu/index.ts +1 -0
- package/lib/routes/shu/jwb.ts +1 -0
- package/lib/routes/shu/society.ts +62 -0
- package/lib/routes/shu/xykd.ts +1 -0
- package/lib/routes/sjtu/jwc.ts +18 -14
- package/lib/routes/smzdm/haowen.ts +35 -19
- package/lib/routes/sohu/mp.ts +17 -0
- package/lib/routes/spglobal/namespace.ts +7 -0
- package/lib/routes/spglobal/ratings.ts +64 -0
- package/lib/routes/spotify/show.ts +5 -4
- package/lib/routes/taiwanmobile/namespace.ts +7 -0
- package/lib/routes/taiwanmobile/rate-plans.ts +64 -0
- package/lib/routes/techsir/index.ts +67 -0
- package/lib/routes/techsir/namespace.ts +8 -0
- package/lib/routes/theatlantic/news.ts +4 -7
- package/lib/routes/theatlantic/utils.ts +10 -8
- package/lib/routes/twitter/api/web-api/constants.ts +3 -1
- package/lib/routes/twitter/api/web-api/utils.ts +38 -21
- package/lib/routes/twitter/keyword.ts +5 -1
- package/lib/routes/twitter/list.ts +4 -0
- package/lib/routes/twitter/user.ts +1 -1
- package/lib/routes/wabei/index.ts +75 -0
- package/lib/routes/wabei/namespace.ts +8 -0
- package/lib/routes/whu/swrh.ts +115 -0
- package/lib/routes/xiaohongshu/user.ts +11 -4
- package/lib/routes/xiaohongshu/util.ts +65 -5
- package/lib/routes/xueqiu/column.ts +11 -2
- package/lib/routes/yna/index.ts +92 -0
- package/lib/routes/yna/namespace.ts +10 -0
- package/lib/routes/zaker/channel.ts +44 -0
- package/lib/routes/zaker/focus.ts +39 -0
- package/lib/routes/zaker/utils.ts +186 -0
- package/lib/routes/zaobao/util.ts +13 -7
- package/lib/types.ts +3 -3
- package/lib/views/index.tsx +1 -1
- package/package.json +38 -38
- package/lib/routes/jisilu/index.ts +0 -133
- package/lib/routes/zaker/index.ts +0 -80
- package/lib/routes-deprecated/dytt/index.js +0 -60
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { type CheerioAPI, type Cheerio, type Element, load } from 'cheerio';
|
|
4
|
+
import { type Context } from 'hono';
|
|
5
|
+
|
|
6
|
+
import { type DataItem, type Route, type Data, ViewType } from '@/types';
|
|
7
|
+
|
|
8
|
+
import { art } from '@/utils/render';
|
|
9
|
+
import cache from '@/utils/cache';
|
|
10
|
+
import { getCurrentPath } from '@/utils/helpers';
|
|
11
|
+
import ofetch from '@/utils/ofetch';
|
|
12
|
+
import { parseDate } from '@/utils/parse-date';
|
|
13
|
+
|
|
14
|
+
const __dirname = getCurrentPath(import.meta.url);
|
|
15
|
+
|
|
16
|
+
export const handler = async (ctx: Context): Promise<Data> => {
|
|
17
|
+
const { category } = ctx.req.param();
|
|
18
|
+
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '1', 10);
|
|
19
|
+
|
|
20
|
+
const rootUrl: string = 'https://www.ali213.net';
|
|
21
|
+
const apiRootUrl: string = 'https://mp.ali213.net';
|
|
22
|
+
const targetUrl: string = new URL(`/news/zl/${category ? (category.endsWith('/') ? category : `${category}/`) : ''}`, rootUrl).href;
|
|
23
|
+
const apiUrl: string = new URL('ajax/newslist', apiRootUrl).href;
|
|
24
|
+
|
|
25
|
+
const response = await ofetch(apiUrl, {
|
|
26
|
+
query: {
|
|
27
|
+
type: 'new',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const targetResponse = await ofetch(targetUrl);
|
|
32
|
+
const $: CheerioAPI = load(targetResponse);
|
|
33
|
+
const language: string = $('html').prop('lang') ?? 'zh';
|
|
34
|
+
|
|
35
|
+
let items: DataItem[] = JSON.parse(response.replace(/^\((.*)\)$/, '$1'))
|
|
36
|
+
.data.slice(0, limit)
|
|
37
|
+
.map((item): DataItem => {
|
|
38
|
+
const title: string = item.Title;
|
|
39
|
+
const description: string = art(path.join(__dirname, 'templates/description.art'), {
|
|
40
|
+
intro: item.GuideRead ?? '',
|
|
41
|
+
});
|
|
42
|
+
const guid: string = `ali213-zl-${item.ID}`;
|
|
43
|
+
const image: string | undefined = item.PicPath ? `https:${item.PicPath}` : undefined;
|
|
44
|
+
|
|
45
|
+
const author: DataItem['author'] = item.xiaobian;
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
title,
|
|
49
|
+
description,
|
|
50
|
+
pubDate: parseDate(item.addtime * 1000),
|
|
51
|
+
link: item.url ? `https:${item.url}` : undefined,
|
|
52
|
+
author,
|
|
53
|
+
guid,
|
|
54
|
+
id: guid,
|
|
55
|
+
content: {
|
|
56
|
+
html: description,
|
|
57
|
+
text: item.GuideRead ?? '',
|
|
58
|
+
},
|
|
59
|
+
image,
|
|
60
|
+
banner: image,
|
|
61
|
+
language,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
items = (
|
|
66
|
+
await Promise.all(
|
|
67
|
+
items.map((item) => {
|
|
68
|
+
if (!item.link && typeof item.link !== 'string') {
|
|
69
|
+
return item;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return cache.tryGet(item.link, async (): Promise<DataItem> => {
|
|
73
|
+
const detailResponse = await ofetch(item.link);
|
|
74
|
+
const $$: CheerioAPI = load(detailResponse);
|
|
75
|
+
|
|
76
|
+
const title: string = $$('h1.newstit').text();
|
|
77
|
+
|
|
78
|
+
let description: string = $$('div#Content').html() ?? '';
|
|
79
|
+
|
|
80
|
+
const pageLinks: string[] = [];
|
|
81
|
+
$$('a.currpage')
|
|
82
|
+
.parent()
|
|
83
|
+
.find('a:not(.currpage)')
|
|
84
|
+
.each((_, el) => {
|
|
85
|
+
const href = $$(el).attr('href');
|
|
86
|
+
if (href) {
|
|
87
|
+
pageLinks.push(href);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const pageContents = await Promise.all(
|
|
92
|
+
pageLinks.map(async (link) => {
|
|
93
|
+
const response = await ofetch(new URL(link, item.link).href);
|
|
94
|
+
const $$$: CheerioAPI = load(response);
|
|
95
|
+
|
|
96
|
+
return $$$('div#Content').html() ?? '';
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
description += pageContents.join('');
|
|
101
|
+
|
|
102
|
+
description = art(path.join(__dirname, 'templates/description.art'), {
|
|
103
|
+
description,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const extraLinks = $$('div.extend_read a')
|
|
107
|
+
.toArray()
|
|
108
|
+
.map((el) => {
|
|
109
|
+
const $$el: Cheerio<Element> = $$(el);
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
url: $$el.prop('href'),
|
|
113
|
+
type: 'related',
|
|
114
|
+
content_html: $$el.text(),
|
|
115
|
+
};
|
|
116
|
+
})
|
|
117
|
+
.filter((_): _ is { url: string; type: string; content_html: string } => true);
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
title,
|
|
121
|
+
description,
|
|
122
|
+
pubDate: item.pubDate,
|
|
123
|
+
category: $$('.category')
|
|
124
|
+
.toArray()
|
|
125
|
+
.map((c) => $$(c).text()),
|
|
126
|
+
author: item.author,
|
|
127
|
+
doi: $$('meta[name="citation_doi"]').prop('content') || undefined,
|
|
128
|
+
guid: item.guid,
|
|
129
|
+
id: item.guid,
|
|
130
|
+
content: {
|
|
131
|
+
html: description,
|
|
132
|
+
text: description,
|
|
133
|
+
},
|
|
134
|
+
image: item.image,
|
|
135
|
+
banner: item.image,
|
|
136
|
+
language,
|
|
137
|
+
_extra: {
|
|
138
|
+
links: extraLinks.length > 0 ? extraLinks : undefined,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
).filter((_): _ is DataItem => true);
|
|
145
|
+
|
|
146
|
+
const title: string = $('title').text();
|
|
147
|
+
const feedImage: string = new URL('news/images/dxhlogo.png', rootUrl).href;
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
title,
|
|
151
|
+
description: $('meta[name="description"]').prop('content'),
|
|
152
|
+
link: targetUrl,
|
|
153
|
+
item: items,
|
|
154
|
+
allowEmpty: true,
|
|
155
|
+
image: feedImage,
|
|
156
|
+
author: title.split(/_/).pop(),
|
|
157
|
+
language,
|
|
158
|
+
id: targetUrl,
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const route: Route = {
|
|
163
|
+
path: '/zl/:category?',
|
|
164
|
+
name: '大侠号',
|
|
165
|
+
url: 'www.ali213.net',
|
|
166
|
+
maintainers: ['nczitzk'],
|
|
167
|
+
handler,
|
|
168
|
+
example: '/ali213/zl',
|
|
169
|
+
parameters: {
|
|
170
|
+
category: '分类,默认为首页,可在对应分类页 URL 中找到',
|
|
171
|
+
},
|
|
172
|
+
description: `:::tip
|
|
173
|
+
若订阅 [游戏](https://www.ali213.net/news/zl/game/),网址为 \`https://www.ali213.net/news/zl/game/\`,请截取 \`https://www.ali213.net/news/zl/\` 到末尾 \`/\` 的部分 \`game\` 作为 \`category\` 参数填入,此时目标路由为 [\`/ali213/zl/game\`](https://rsshub.app/ali213/zl/game)。
|
|
174
|
+
:::
|
|
175
|
+
|
|
176
|
+
| 首页 | 游戏 | 动漫 | 影视 | 娱乐 |
|
|
177
|
+
| ---------------------------------------- | -------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
|
|
178
|
+
| [index](https://www.ali213.net/news/zl/) | [game](https://www.ali213.net/news/zl/game/) | [comic](https://www.ali213.net/news/zl/comic/) | [movie](https://www.ali213.net/news/zl/movie/) | [amuse](https://www.ali213.net/news/zl/amuse/) |
|
|
179
|
+
`,
|
|
180
|
+
categories: ['game'],
|
|
181
|
+
features: {
|
|
182
|
+
requireConfig: false,
|
|
183
|
+
requirePuppeteer: false,
|
|
184
|
+
antiCrawler: false,
|
|
185
|
+
supportRadar: true,
|
|
186
|
+
supportBT: false,
|
|
187
|
+
supportPodcast: false,
|
|
188
|
+
supportScihub: false,
|
|
189
|
+
},
|
|
190
|
+
radar: [
|
|
191
|
+
{
|
|
192
|
+
source: ['www.ali213.net/news/zl/:category'],
|
|
193
|
+
target: (params) => {
|
|
194
|
+
const category = params.category;
|
|
195
|
+
|
|
196
|
+
return `/ali213/zl${category ? `/${category}` : ''}`;
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
title: '首页',
|
|
201
|
+
source: ['www.ali213.net/news/zl/'],
|
|
202
|
+
target: '/zl',
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
title: '游戏',
|
|
206
|
+
source: ['www.ali213.net/news/zl/game/'],
|
|
207
|
+
target: '/zl/game',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
title: '动漫',
|
|
211
|
+
source: ['www.ali213.net/news/zl/comic/'],
|
|
212
|
+
target: '/zl/comic',
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: '影视',
|
|
216
|
+
source: ['www.ali213.net/news/zl/movie/'],
|
|
217
|
+
target: '/zl/movie',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
title: '娱乐',
|
|
221
|
+
source: ['www.ali213.net/news/zl/amuse/'],
|
|
222
|
+
target: '/zl/amuse',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
view: ViewType.Articles,
|
|
226
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Route, ViewType } from '@/types';
|
|
2
|
+
import got from '@/utils/got';
|
|
3
|
+
import { parseDate } from '@/utils/parse-date';
|
|
4
|
+
|
|
5
|
+
export const route: Route = {
|
|
6
|
+
path: '/kx',
|
|
7
|
+
categories: ['new-media'],
|
|
8
|
+
example: '/amz123/kx',
|
|
9
|
+
parameters: {},
|
|
10
|
+
features: {
|
|
11
|
+
requireConfig: false,
|
|
12
|
+
requirePuppeteer: false,
|
|
13
|
+
antiCrawler: false,
|
|
14
|
+
supportBT: false,
|
|
15
|
+
supportPodcast: false,
|
|
16
|
+
supportScihub: false,
|
|
17
|
+
},
|
|
18
|
+
radar: [
|
|
19
|
+
{
|
|
20
|
+
source: ['amz123.com/kx'],
|
|
21
|
+
target: '/kx',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
name: 'AMZ123 快讯',
|
|
25
|
+
maintainers: ['defp'],
|
|
26
|
+
handler,
|
|
27
|
+
url: 'amz123.com/kx',
|
|
28
|
+
view: ViewType.Articles,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
async function handler() {
|
|
32
|
+
const limit = 12;
|
|
33
|
+
const apiRootUrl = 'https://api.amz123.com';
|
|
34
|
+
const rootUrl = 'https://www.amz123.com';
|
|
35
|
+
|
|
36
|
+
const { data: response } = await got.post(`${apiRootUrl}/ugc/v1/user_content/forum_list`, {
|
|
37
|
+
json: {
|
|
38
|
+
page: 1,
|
|
39
|
+
page_size: limit,
|
|
40
|
+
tag_id: 0,
|
|
41
|
+
fid: 4,
|
|
42
|
+
ban: 0,
|
|
43
|
+
is_new: 1,
|
|
44
|
+
},
|
|
45
|
+
headers: {
|
|
46
|
+
'content-type': 'application/json',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const items = response.data.rows.map((item) => ({
|
|
51
|
+
title: item.title,
|
|
52
|
+
description: item.description,
|
|
53
|
+
pubDate: parseDate(item.published_at * 1000),
|
|
54
|
+
link: `${rootUrl}/kx/${item.id}`,
|
|
55
|
+
author: item.author?.username,
|
|
56
|
+
category: item.tags.map((tag) => tag.name),
|
|
57
|
+
guid: item.resource_id,
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
title: 'AMZ123 快讯',
|
|
62
|
+
link: `${rootUrl}/kx`,
|
|
63
|
+
item: items,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import got from '@/utils/got';
|
|
2
|
+
import { load } from 'cheerio';
|
|
3
|
+
import cache from '@/utils/cache';
|
|
4
|
+
|
|
5
|
+
export const route: Route = {
|
|
6
|
+
path: '/news',
|
|
7
|
+
categories: ['programming'],
|
|
8
|
+
example: '/anthropic/news',
|
|
9
|
+
parameters: {},
|
|
10
|
+
radar: [
|
|
11
|
+
{
|
|
12
|
+
source: ['anthropic.com'],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
name: 'News',
|
|
16
|
+
maintainers: ['etShaw-zh'],
|
|
17
|
+
handler,
|
|
18
|
+
url: 'anthropic.com/news',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
async function handler() {
|
|
22
|
+
const link = 'https://anthropic.com/news';
|
|
23
|
+
const response = await got(link);
|
|
24
|
+
const $ = load(response.body);
|
|
25
|
+
|
|
26
|
+
const list = $('.contentFadeUp a')
|
|
27
|
+
.toArray()
|
|
28
|
+
.map((e) => {
|
|
29
|
+
e = $(e);
|
|
30
|
+
const title = e.find('h3.PostCard_post-heading__KPsva').text().trim(); // Extract title
|
|
31
|
+
const href = e.attr('href'); // Extract link
|
|
32
|
+
const pubDate = e.find('.PostList_post-date__giqsu').text().trim(); // Extract publication date
|
|
33
|
+
const fullLink = href.startsWith('http') ? href : `https://anthropic.com${href}`; // Complete relative links
|
|
34
|
+
return {
|
|
35
|
+
title,
|
|
36
|
+
link: fullLink,
|
|
37
|
+
pubDate,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const out = await Promise.all(
|
|
42
|
+
list.map((item) =>
|
|
43
|
+
cache.tryGet(item.link, async () => {
|
|
44
|
+
const response = await got(item.link);
|
|
45
|
+
const $ = load(response.body);
|
|
46
|
+
|
|
47
|
+
item.description = $('.text-b2.PostDetail_post-detail__uTcjp').html() || ''; // Full article content
|
|
48
|
+
|
|
49
|
+
return item;
|
|
50
|
+
})
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
title: 'Anthropic News',
|
|
56
|
+
link,
|
|
57
|
+
description: 'Latest news from Anthropic',
|
|
58
|
+
item: out,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
|
|
3
|
+
import cache from '@/utils/cache';
|
|
4
|
+
import got from '@/utils/got';
|
|
5
|
+
import { load } from 'cheerio';
|
|
6
|
+
import { parseDate } from '@/utils/parse-date';
|
|
7
|
+
|
|
8
|
+
export const route: Route = {
|
|
9
|
+
path: '/blog',
|
|
10
|
+
categories: ['blog'],
|
|
11
|
+
example: '/apnic/blog',
|
|
12
|
+
url: 'blog.apnic.net',
|
|
13
|
+
name: 'Blog',
|
|
14
|
+
maintainers: ['p3psi-boo'],
|
|
15
|
+
handler,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
async function handler() {
|
|
19
|
+
const baseUrl = 'https://blog.apnic.net';
|
|
20
|
+
const feedUrl = `${baseUrl}/feed/`;
|
|
21
|
+
|
|
22
|
+
const response = await got(feedUrl);
|
|
23
|
+
const $ = load(response.data, { xmlMode: true });
|
|
24
|
+
|
|
25
|
+
// 从 RSS XML 中直接提取文章信息
|
|
26
|
+
const list = $('item')
|
|
27
|
+
.toArray()
|
|
28
|
+
.map((item) => {
|
|
29
|
+
const $item = $(item);
|
|
30
|
+
return {
|
|
31
|
+
title: $item.find('title').text(),
|
|
32
|
+
link: $item.find('link').text(),
|
|
33
|
+
author: $item.find(String.raw`dc\:creator`).text(),
|
|
34
|
+
category:
|
|
35
|
+
$item
|
|
36
|
+
.find('category')
|
|
37
|
+
.text()
|
|
38
|
+
.match(/>([^<]+)</)?.[1] || '',
|
|
39
|
+
pubDate: parseDate($item.find('pubDate').text()),
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const items = await Promise.all(
|
|
44
|
+
list.map((item) =>
|
|
45
|
+
cache.tryGet(item.link, async () => {
|
|
46
|
+
const { data: articleData } = await got(item.link);
|
|
47
|
+
const $article = load(articleData);
|
|
48
|
+
|
|
49
|
+
// 获取文章正文内容
|
|
50
|
+
item.description = $article('.entry-content').html();
|
|
51
|
+
return item;
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
title: 'APNIC Blog',
|
|
58
|
+
link: baseUrl,
|
|
59
|
+
item: items,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
3
|
+
import { load } from 'cheerio';
|
|
4
|
+
import { parseDate } from '@/utils/parse-date';
|
|
5
|
+
import ofetch from '@/utils/ofetch';
|
|
6
|
+
|
|
7
|
+
export const route: Route = {
|
|
8
|
+
path: '/article',
|
|
9
|
+
categories: ['new-media'],
|
|
10
|
+
example: '/baijing/article',
|
|
11
|
+
url: 'www.baijing.cn/article/',
|
|
12
|
+
name: '资讯',
|
|
13
|
+
maintainers: ['p3psi-boo'],
|
|
14
|
+
handler,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
async function handler() {
|
|
18
|
+
const apiUrl = 'https://www.baijing.cn/index/ajax/get_article/';
|
|
19
|
+
const response = await ofetch(apiUrl);
|
|
20
|
+
const data = response.data.article_list;
|
|
21
|
+
|
|
22
|
+
const list = data.map((item) => ({
|
|
23
|
+
title: item.title,
|
|
24
|
+
link: `https://www.baijing.cn/article/${item.id}`,
|
|
25
|
+
author: item.user_info.user_name,
|
|
26
|
+
category: item.topic?.map((t) => t.title),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
const items = await Promise.all(
|
|
30
|
+
list.map((item) =>
|
|
31
|
+
cache.tryGet(item.link, async () => {
|
|
32
|
+
const response = await ofetch(item.link);
|
|
33
|
+
|
|
34
|
+
const $ = load(response);
|
|
35
|
+
item.description = $('.content').html();
|
|
36
|
+
item.pubDate = parseDate($('.timeago').text());
|
|
37
|
+
|
|
38
|
+
return item;
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
title: '白鲸出海 - 资讯',
|
|
45
|
+
link: 'https://www.baijing.cn/article/',
|
|
46
|
+
item: items,
|
|
47
|
+
};
|
|
48
|
+
}
|
package/lib/routes/bbc/index.ts
CHANGED
|
@@ -4,11 +4,10 @@ import parser from '@/utils/rss-parser';
|
|
|
4
4
|
import { load } from 'cheerio';
|
|
5
5
|
import utils from './utils';
|
|
6
6
|
import ofetch from '@/utils/ofetch';
|
|
7
|
-
|
|
8
7
|
export const route: Route = {
|
|
9
8
|
path: '/:site?/:channel?',
|
|
10
9
|
name: 'News',
|
|
11
|
-
maintainers: ['HenryQW', 'DIYgod'],
|
|
10
|
+
maintainers: ['HenryQW', 'DIYgod', 'pseudoyu'],
|
|
12
11
|
handler,
|
|
13
12
|
example: '/bbc/world-asia',
|
|
14
13
|
parameters: {
|
|
@@ -59,45 +58,51 @@ async function handler(ctx) {
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
const items = await Promise.all(
|
|
62
|
-
feed.items
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
61
|
+
feed.items
|
|
62
|
+
.filter((item) => item && item.link)
|
|
63
|
+
.map((item) =>
|
|
64
|
+
cache.tryGet(item.link, async () => {
|
|
65
|
+
try {
|
|
66
|
+
const linkURL = new URL(item.link);
|
|
67
|
+
if (linkURL.hostname === 'www.bbc.com') {
|
|
68
|
+
linkURL.hostname = 'www.bbc.co.uk';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const response = await ofetch(linkURL.href, {
|
|
72
|
+
retryStatusCodes: [403],
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const $ = load(response);
|
|
76
|
+
|
|
77
|
+
const path = linkURL.pathname;
|
|
78
|
+
|
|
79
|
+
let description;
|
|
80
|
+
|
|
81
|
+
switch (true) {
|
|
82
|
+
case path.startsWith('/sport'):
|
|
83
|
+
description = item.content;
|
|
84
|
+
break;
|
|
85
|
+
case path.startsWith('/sounds/play'):
|
|
86
|
+
description = item.content;
|
|
87
|
+
break;
|
|
88
|
+
case path.startsWith('/news/live'):
|
|
89
|
+
description = item.content;
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
description = utils.ProcessFeed($);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
title: item.title || '',
|
|
97
|
+
description: description || '',
|
|
98
|
+
pubDate: item.pubDate || new Date().toUTCString(),
|
|
99
|
+
link: item.link,
|
|
100
|
+
};
|
|
101
|
+
} catch {
|
|
102
|
+
return {} as Record<string, any>;
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
)
|
|
101
106
|
);
|
|
102
107
|
|
|
103
108
|
return {
|
|
@@ -105,6 +110,6 @@ async function handler(ctx) {
|
|
|
105
110
|
link,
|
|
106
111
|
image: 'https://www.bbc.com/favicon.ico',
|
|
107
112
|
description: title,
|
|
108
|
-
item: items,
|
|
113
|
+
item: items.filter((item) => Object.keys(item).length > 0),
|
|
109
114
|
};
|
|
110
115
|
}
|