rsshub 1.0.0-master.e2d6718 → 1.0.0-master.e2f463a
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/config.ts +14 -0
- package/lib/errors/index.test.ts +2 -2
- package/lib/middleware/template.tsx +12 -3
- package/lib/router.js +0 -3
- package/lib/routes/0x80/index.ts +87 -0
- package/lib/routes/0x80/namespace.ts +7 -0
- package/lib/routes/accessbriefing/index.ts +217 -0
- package/lib/routes/accessbriefing/namespace.ts +8 -0
- package/lib/routes/accessbriefing/templates/description.art +27 -0
- package/lib/routes/aljazeera/index.ts +17 -14
- package/lib/routes/apple/podcast.ts +64 -0
- package/lib/routes/baai/events.ts +10 -21
- package/lib/routes/baai/hub.ts +59 -29
- package/lib/routes/baai/utils.ts +19 -4
- package/lib/routes/bbc/index.ts +4 -7
- package/lib/routes/bilibili/cache.ts +1 -1
- package/lib/routes/bing/daily-wallpaper.ts +9 -8
- package/lib/routes/bnu/mba.ts +202 -0
- package/lib/routes/byau/namespace.ts +6 -0
- package/lib/routes/byau/xinwen/index.ts +72 -0
- package/lib/routes/caixin/weekly.ts +5 -14
- package/lib/routes/chub/characters.ts +64 -0
- package/lib/routes/{thecatcity → chub}/namespace.ts +2 -2
- package/lib/routes/colamanga/manga.ts +88 -0
- package/lib/routes/colamanga/namespace.ts +9 -0
- package/lib/routes/copernicium/index.ts +67 -0
- package/lib/routes/copernicium/namespace.ts +6 -0
- package/lib/routes/cpcaauto/index.ts +255 -0
- package/lib/routes/cpcaauto/namespace.ts +8 -0
- package/lib/routes/crossbell/feeds/following.ts +20 -18
- package/lib/routes/crossbell/notes/utils.ts +15 -17
- package/lib/routes/daily/discussed.ts +0 -11
- package/lib/routes/daily/index.ts +2 -2
- package/lib/routes/daily/namespace.ts +1 -0
- package/lib/routes/daily/templates/posts.art +7 -0
- package/lib/routes/daily/upvoted.ts +5 -16
- package/lib/routes/daily/user.ts +227 -0
- package/lib/routes/daily/utils.ts +33 -16
- package/lib/routes/dehenglaw/index.ts +128 -0
- package/lib/routes/dehenglaw/namespace.ts +8 -0
- package/lib/routes/dehenglaw/templates/description.art +7 -0
- package/lib/routes/douyin/live.ts +1 -1
- package/lib/routes/douyu/room.ts +58 -18
- package/lib/routes/ecnu/jwc.ts +67 -0
- package/lib/routes/ecnu/namespace.ts +1 -1
- package/lib/routes/fanbox/index.ts +62 -0
- package/lib/routes/fanbox/namespace.ts +6 -0
- package/lib/routes/fanbox/templates/fanbox-post.art +7 -0
- package/lib/routes/fanbox/types.ts +239 -0
- package/lib/routes/fanbox/utils.ts +188 -0
- package/lib/routes/freexcomic/book.ts +84 -0
- package/lib/routes/freexcomic/namespace.ts +7 -0
- package/lib/routes/gov/ah/kjt.ts +229 -0
- package/lib/routes/gov/ah/namespace.ts +8 -0
- package/lib/routes/gov/jiangsu/wlt/index.ts +99 -0
- package/lib/routes/gov/jiangsu/wlt/templates/wlt.art +9 -0
- package/lib/routes/gov/{namespace.ts → pbc/namespace.ts} +1 -1
- package/lib/routes/gov/stats/index.ts +25 -22
- package/lib/routes/gov/zj/search.ts +80 -0
- package/lib/routes/gxmzu/ai.ts +1 -1
- package/lib/routes/gxmzu/lib.ts +9 -26
- package/lib/routes/gxmzu/utils/index.ts +31 -13
- package/lib/routes/gxmzu/yjs.ts +1 -1
- package/lib/routes/hackernews/index.ts +1 -1
- package/lib/routes/hellogithub/index.ts +2 -2
- package/lib/routes/hellogithub/report.ts +2 -1
- package/lib/routes/hellogithub/volume.ts +39 -24
- package/lib/routes/hoyolab/news.ts +5 -5
- package/lib/routes/ieee-security/sp.ts +6 -15
- package/lib/routes/iehou/index.ts +125 -0
- package/lib/routes/iehou/namespace.ts +8 -0
- package/lib/routes/jou/utils/index.ts +35 -25
- package/lib/routes/kpmg/insights.ts +143 -0
- package/lib/routes/kpmg/namespace.ts +10 -0
- package/lib/routes/kpmg/templates/description.art +11 -0
- package/lib/routes/lianxh/index.ts +116 -0
- package/lib/routes/lianxh/namespace.ts +7 -0
- package/lib/routes/lofter/tag.ts +3 -3
- package/lib/routes/lofter/user.ts +3 -3
- package/lib/routes/mckinsey/cn/index.ts +4 -7
- package/lib/routes/mihoyo/bbs/official.ts +86 -17
- package/lib/routes/mihoyo/templates/official.art +7 -0
- package/lib/routes/mixcloud/index.ts +26 -6
- package/lib/routes/mixcloud/queries.ts +934 -186
- package/lib/routes/ncu/jwc.ts +13 -2
- package/lib/routes/nju/jw.ts +4 -2
- package/lib/routes/njxzc/utils/index.ts +31 -13
- package/lib/routes/olevod/namespace.ts +6 -0
- package/lib/routes/olevod/vod.ts +49 -0
- package/lib/routes/olevod/vodlist.ts +48 -0
- package/lib/routes/ollama/models.ts +39 -0
- package/lib/routes/ollama/namespace.ts +6 -0
- package/lib/routes/papers/index.ts +100 -59
- package/lib/routes/papers/namespace.ts +2 -0
- package/lib/routes/qingting/podcast.ts +61 -39
- package/lib/routes/reuters/common.ts +2 -2
- package/lib/routes/sara/index.ts +66 -0
- package/lib/routes/sara/namespace.ts +6 -0
- package/lib/routes/sigsac/ccs.ts +16 -22
- package/lib/routes/sjtu/yzb/zkxx.ts +2 -2
- package/lib/routes/sohu/mp.ts +183 -63
- package/lib/routes/stbu/jsjxy.ts +3 -3
- package/lib/routes/stbu/xyxw.ts +14 -3
- package/lib/routes/steam/appcommunityfeed.ts +92 -0
- package/lib/routes/steam/templates/appcommunityfeed-description.art +4 -0
- package/lib/routes/telegram/channel.ts +12 -0
- package/lib/routes/tencent/news/author.ts +13 -11
- package/lib/routes/test/index.ts +11 -1
- package/lib/routes/{thecatcity → thepetcity}/index.ts +23 -32
- package/lib/routes/thepetcity/namespace.ts +6 -0
- package/lib/routes/thepetcity/terms-map.ts +28 -0
- package/lib/routes/threads/index.ts +36 -38
- package/lib/routes/threads/utils.ts +43 -12
- package/lib/routes/ttv/index.ts +78 -0
- package/lib/routes/ttv/namespace.ts +6 -0
- package/lib/routes/twitter/api/mobile-api/login.ts +36 -33
- package/lib/routes/twitter/api/web-api/constants.ts +30 -0
- package/lib/routes/twitter/api/web-api/utils.ts +1 -1
- package/lib/routes/twitter/namespace.ts +2 -2
- package/lib/routes/twitter/tweet.ts +10 -1
- package/lib/routes/twitter/user.ts +5 -0
- package/lib/routes/u3c3/index.ts +1 -1
- package/lib/routes/u3c3/namespace.ts +1 -1
- package/lib/routes/u9a9/index.ts +2 -2
- package/lib/routes/u9a9/namespace.ts +1 -1
- package/lib/routes/usenix/usenix.ts +24 -31
- package/lib/routes/wechat/tgchannel.ts +8 -1
- package/lib/routes/weibo/keyword.ts +12 -10
- package/lib/routes/yenpress/namespace.ts +7 -0
- package/lib/routes/yenpress/series.ts +115 -0
- package/lib/routes/yenpress/templates/series.art +25 -0
- package/lib/routes/zhihu/activities.ts +5 -4
- package/lib/routes/zsxq/group.ts +63 -0
- package/lib/routes/zsxq/namespace.ts +6 -0
- package/lib/routes/zsxq/types.ts +149 -0
- package/lib/routes/zsxq/user.ts +58 -0
- package/lib/routes/zsxq/utils.ts +70 -0
- package/lib/setup.test.ts +184 -12
- package/lib/utils/got.test.ts +2 -1
- package/lib/utils/got.ts +2 -5
- package/lib/utils/render.ts +1 -1
- package/lib/utils/request-rewriter/get.ts +8 -1
- package/lib/utils/wechat-mp.test.ts +411 -32
- package/lib/utils/wechat-mp.ts +447 -76
- package/lib/views/error.tsx +1 -23
- package/lib/views/index.tsx +4 -26
- package/lib/views/layout.tsx +50 -0
- package/lib/views/{rss3-ums.ts → rss3.ts} +2 -2
- package/package.json +49 -45
- package/lib/routes/baai/comments.ts +0 -59
- package/lib/routes/gov/anhui/kjt.ts +0 -65
- package/lib/routes/thecatcity/terms-map.ts +0 -28
- package/lib/routes-deprecated/fanbox/conv.js +0 -227
- package/lib/routes-deprecated/fanbox/header.js +0 -13
- package/lib/routes-deprecated/fanbox/main.js +0 -45
- package/lib/routes-deprecated/kpmg/insights.js +0 -79
- package/lib/routes-deprecated/manxiaosi/book.js +0 -49
package/lib/config.ts
CHANGED
|
@@ -230,6 +230,9 @@ export type Config = {
|
|
|
230
230
|
pkubbs: {
|
|
231
231
|
cookie?: string;
|
|
232
232
|
};
|
|
233
|
+
qingting: {
|
|
234
|
+
id?: string;
|
|
235
|
+
};
|
|
233
236
|
saraba1st: {
|
|
234
237
|
cookie?: string;
|
|
235
238
|
};
|
|
@@ -258,6 +261,7 @@ export type Config = {
|
|
|
258
261
|
oauthTokenSecrets?: string[];
|
|
259
262
|
username?: string;
|
|
260
263
|
password?: string;
|
|
264
|
+
authenticationSecret?: string;
|
|
261
265
|
cookie?: string;
|
|
262
266
|
};
|
|
263
267
|
weibo: {
|
|
@@ -294,6 +298,9 @@ export type Config = {
|
|
|
294
298
|
zodgame: {
|
|
295
299
|
cookie?: string;
|
|
296
300
|
};
|
|
301
|
+
zsxq: {
|
|
302
|
+
accessToken?: string;
|
|
303
|
+
};
|
|
297
304
|
};
|
|
298
305
|
|
|
299
306
|
const value: Config | Record<string, any> = {};
|
|
@@ -575,6 +582,9 @@ const calculateValue = () => {
|
|
|
575
582
|
pkubbs: {
|
|
576
583
|
cookie: envs.PKUBBS_COOKIE,
|
|
577
584
|
},
|
|
585
|
+
qingting: {
|
|
586
|
+
id: envs.QINGTING_ID,
|
|
587
|
+
},
|
|
578
588
|
saraba1st: {
|
|
579
589
|
cookie: envs.SARABA1ST_COOKIE,
|
|
580
590
|
},
|
|
@@ -607,6 +617,7 @@ const calculateValue = () => {
|
|
|
607
617
|
oauthTokenSecrets: envs.TWITTER_OAUTH_TOKEN_SECRET?.split(','),
|
|
608
618
|
username: envs.TWITTER_USERNAME,
|
|
609
619
|
password: envs.TWITTER_PASSWORD,
|
|
620
|
+
authenticationSecret: envs.TWITTER_AUTHENTICATION_SECRET,
|
|
610
621
|
cookie: envs.TWITTER_COOKIE,
|
|
611
622
|
},
|
|
612
623
|
weibo: {
|
|
@@ -643,6 +654,9 @@ const calculateValue = () => {
|
|
|
643
654
|
zodgame: {
|
|
644
655
|
cookie: envs.ZODGAME_COOKIE,
|
|
645
656
|
},
|
|
657
|
+
zsxq: {
|
|
658
|
+
accessToken: envs.ZSXQ_ACCESS_TOKEN,
|
|
659
|
+
},
|
|
646
660
|
};
|
|
647
661
|
|
|
648
662
|
for (const name in _value) {
|
package/lib/errors/index.test.ts
CHANGED
|
@@ -66,13 +66,13 @@ describe('route throws an error', () => {
|
|
|
66
66
|
expect(value).toBe('9');
|
|
67
67
|
break;
|
|
68
68
|
case 'Hot Routes:':
|
|
69
|
-
expect(value).toBe('6 /test/:id
|
|
69
|
+
expect(value).toBe('6 /test/:id/:params?<br>');
|
|
70
70
|
break;
|
|
71
71
|
case 'Hot Paths:':
|
|
72
72
|
expect(value).toBe('2 /test/error<br>2 /test/slow<br>1 /test/httperror<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /thisDoesNotExist<br>1 /<br>');
|
|
73
73
|
break;
|
|
74
74
|
case 'Hot Error Routes:':
|
|
75
|
-
expect(value).toBe('5 /test/:id
|
|
75
|
+
expect(value).toBe('5 /test/:id/:params?<br>');
|
|
76
76
|
break;
|
|
77
77
|
case 'Hot Error Paths:':
|
|
78
78
|
expect(value).toBe('2 /test/error<br>1 /test/httperror<br>1 /test/slow<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /thisDoesNotExist<br>');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rss3, json, RSS, Atom } from '@/utils/render';
|
|
2
2
|
import { config } from '@/config';
|
|
3
3
|
import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils';
|
|
4
4
|
import type { MiddlewareHandler } from 'hono';
|
|
@@ -48,6 +48,14 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
if (item.description) {
|
|
52
|
+
// https://stackoverflow.com/questions/2507608/error-input-is-not-proper-utf-8-indicate-encoding-using-phps-simplexml-lo/40552083#40552083
|
|
53
|
+
// https://stackoverflow.com/questions/1497885/remove-control-characters-from-php-string/1497928#1497928
|
|
54
|
+
// remove unicode control characters
|
|
55
|
+
// see #14940 #14943 #15262
|
|
56
|
+
item.description = item.description.replaceAll(/[\u0000-\u0009\u000B\u000C\u000E-\u001F\u007F]/g, '');
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
if (typeof item.author === 'string') {
|
|
52
60
|
item.author = collapseWhitespace(item.author) || '';
|
|
53
61
|
} else if (typeof item.author === 'object' && item.author !== null) {
|
|
@@ -86,8 +94,9 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
|
|
|
86
94
|
return ctx.json(result);
|
|
87
95
|
}
|
|
88
96
|
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
// retain .ums for backward compatibility
|
|
98
|
+
if (outputType === 'ums' || outputType === 'rss3') {
|
|
99
|
+
return ctx.json(rss3(result));
|
|
91
100
|
} else if (outputType === 'json') {
|
|
92
101
|
ctx.header('Content-Type', 'application/feed+json; charset=UTF-8');
|
|
93
102
|
return ctx.body(json(result));
|
package/lib/router.js
CHANGED
|
@@ -25,9 +25,6 @@ router.get('/benedictevans', lazyloadRouteHandler('./routes/benedictevans/recent
|
|
|
25
25
|
// router.get('/jianshu/collection/:id', lazyloadRouteHandler('./routes/jianshu/collection'));
|
|
26
26
|
// router.get('/jianshu/user/:id', lazyloadRouteHandler('./routes/jianshu/user'));
|
|
27
27
|
|
|
28
|
-
// pixiv-fanbox
|
|
29
|
-
router.get('/fanbox/:user?', lazyloadRouteHandler('./routes/fanbox/main'));
|
|
30
|
-
|
|
31
28
|
// Disqus
|
|
32
29
|
router.get('/disqus/posts/:forum', lazyloadRouteHandler('./routes/disqus/posts'));
|
|
33
30
|
|
|
@@ -0,0 +1,87 @@
|
|
|
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: '/0x80/blog',
|
|
12
|
+
url: '0x80.pl/notesen.html',
|
|
13
|
+
name: 'Articles',
|
|
14
|
+
maintainers: ['xnum'],
|
|
15
|
+
handler,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function extractDateFromURL(url: string) {
|
|
19
|
+
const regex = /\d{4}-\d{2}-\d{2}/;
|
|
20
|
+
const match = url.match(regex);
|
|
21
|
+
|
|
22
|
+
return match ? match[0] : null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function handler() {
|
|
26
|
+
// The TLS cert is invalid, we are limited to use HTTP unfortunately.
|
|
27
|
+
const baseUrl = 'http://0x80.pl/';
|
|
28
|
+
const targetUrl = `${baseUrl}notesen.html`;
|
|
29
|
+
|
|
30
|
+
const response = await got({
|
|
31
|
+
method: 'get',
|
|
32
|
+
url: targetUrl,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const $ = load(response.data);
|
|
36
|
+
|
|
37
|
+
const alist = $('a.reference.external');
|
|
38
|
+
|
|
39
|
+
const list = alist
|
|
40
|
+
.toArray()
|
|
41
|
+
.map((item) => {
|
|
42
|
+
item = $(item);
|
|
43
|
+
|
|
44
|
+
const link = item.attr('href') || '';
|
|
45
|
+
const title = item.text() || '';
|
|
46
|
+
const pubDate = extractDateFromURL(link);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
title,
|
|
50
|
+
link,
|
|
51
|
+
pubDate,
|
|
52
|
+
category: 'Uncategoried',
|
|
53
|
+
};
|
|
54
|
+
})
|
|
55
|
+
.filter((item) => item.link.startsWith('notesen'));
|
|
56
|
+
|
|
57
|
+
const items = await Promise.all(
|
|
58
|
+
list.map((item) =>
|
|
59
|
+
cache.tryGet(item.link, async () => {
|
|
60
|
+
const articleUrl = `${baseUrl}${item.link}`;
|
|
61
|
+
const response = await got({
|
|
62
|
+
method: 'get',
|
|
63
|
+
url: articleUrl,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const $ = load(response.data);
|
|
67
|
+
|
|
68
|
+
const author = $('tr.author.field td.field-body').text();
|
|
69
|
+
const articlePubDate = $('tr.added-on.field td.field-body').text();
|
|
70
|
+
|
|
71
|
+
item.author = author;
|
|
72
|
+
// Some articles might be missing the added-on field.
|
|
73
|
+
// As a safeguard, if the date from url is null, fallbacks to the article one.
|
|
74
|
+
item.pubDate = parseDate(item.pubDate || articlePubDate);
|
|
75
|
+
item.description = $('div.document').first().html();
|
|
76
|
+
|
|
77
|
+
return item;
|
|
78
|
+
})
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
title: '0x80.pl articles',
|
|
84
|
+
link: targetUrl,
|
|
85
|
+
item: items,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import { getCurrentPath } from '@/utils/helpers';
|
|
3
|
+
const __dirname = getCurrentPath(import.meta.url);
|
|
4
|
+
|
|
5
|
+
import cache from '@/utils/cache';
|
|
6
|
+
import got from '@/utils/got';
|
|
7
|
+
import { load } from 'cheerio';
|
|
8
|
+
import { parseDate } from '@/utils/parse-date';
|
|
9
|
+
import { art } from '@/utils/render';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
|
|
12
|
+
export const handler = async (ctx) => {
|
|
13
|
+
const { category = 'latest/news' } = ctx.req.param();
|
|
14
|
+
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
|
15
|
+
|
|
16
|
+
const rootUrl = 'https://www.accessbriefing.com';
|
|
17
|
+
const currentUrl = new URL(category, rootUrl).href;
|
|
18
|
+
const apiUrl = new URL('Ajax/GetPagedArticles', rootUrl).href;
|
|
19
|
+
|
|
20
|
+
const { data: currentResponse } = await got(currentUrl);
|
|
21
|
+
|
|
22
|
+
const brandId = currentResponse.match(/'BrandID':\s(\d+)/)?.[1] ?? '32';
|
|
23
|
+
const moreID = currentResponse.match(/'MoreID':\s(\d+)/)?.[1] ?? '9282';
|
|
24
|
+
|
|
25
|
+
const { data: response } = await got(apiUrl, {
|
|
26
|
+
searchParams: {
|
|
27
|
+
navcontentid: moreID,
|
|
28
|
+
brandid: brandId,
|
|
29
|
+
page: 0,
|
|
30
|
+
lastpage: 0,
|
|
31
|
+
pagesize: limit,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const $ = load(currentResponse);
|
|
36
|
+
|
|
37
|
+
const language = $('html').prop('lang');
|
|
38
|
+
|
|
39
|
+
let items = response.slice(0, limit).map((item) => {
|
|
40
|
+
const title = item.Article_Headline;
|
|
41
|
+
const image = new URL(item.Image, rootUrl).href;
|
|
42
|
+
const description = art(path.join(__dirname, 'templates/description.art'), {
|
|
43
|
+
images: image
|
|
44
|
+
? [
|
|
45
|
+
{
|
|
46
|
+
src: image,
|
|
47
|
+
alt: title,
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
: undefined,
|
|
51
|
+
intro: item.Article_Intro_Plaintext,
|
|
52
|
+
});
|
|
53
|
+
const guid = `accessbriefing-${item.Article_ID}`;
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
title,
|
|
57
|
+
description,
|
|
58
|
+
pubDate: parseDate(item.Article_PublishedDate),
|
|
59
|
+
link: new URL(item.URL, rootUrl).href,
|
|
60
|
+
author: item.Authors.join('/'),
|
|
61
|
+
guid,
|
|
62
|
+
id: guid,
|
|
63
|
+
content: {
|
|
64
|
+
html: description,
|
|
65
|
+
text: item.Article_Intro_Plaintext,
|
|
66
|
+
},
|
|
67
|
+
image,
|
|
68
|
+
banner: image,
|
|
69
|
+
language,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
items = await Promise.all(
|
|
74
|
+
items.map((item) =>
|
|
75
|
+
cache.tryGet(item.link, async () => {
|
|
76
|
+
const { data: detailResponse } = await got(item.link);
|
|
77
|
+
|
|
78
|
+
const $$ = load(detailResponse);
|
|
79
|
+
|
|
80
|
+
const title = $$('h1.khl-article-page-title').text();
|
|
81
|
+
const description =
|
|
82
|
+
item.description +
|
|
83
|
+
art(path.join(__dirname, 'templates/description.art'), {
|
|
84
|
+
description: $$('div.khl-article-page-storybody').html(),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
item.title = title;
|
|
88
|
+
item.description = description;
|
|
89
|
+
item.category = $$('a.badge[data-id]')
|
|
90
|
+
.toArray()
|
|
91
|
+
.map((c) => $$(c).text());
|
|
92
|
+
item.author = $$('div.authorDetails a span b').text();
|
|
93
|
+
item.content = {
|
|
94
|
+
html: description,
|
|
95
|
+
text: $$('div.khl-article-page-storybody').text(),
|
|
96
|
+
};
|
|
97
|
+
item.language = language;
|
|
98
|
+
|
|
99
|
+
return item;
|
|
100
|
+
})
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const image = new URL($('a.navbar-brand img').prop('src'), rootUrl).href;
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
title: $('title').text(),
|
|
108
|
+
description: $('meta[property="og:description"]').prop('content'),
|
|
109
|
+
link: currentUrl,
|
|
110
|
+
item: items,
|
|
111
|
+
allowEmpty: true,
|
|
112
|
+
image,
|
|
113
|
+
author: $('meta[property="og:site_name"]').prop('content'),
|
|
114
|
+
language,
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const route: Route = {
|
|
119
|
+
path: '/:category{.+}?',
|
|
120
|
+
name: 'Articles',
|
|
121
|
+
url: 'accessbriefing.com',
|
|
122
|
+
maintainers: ['nczitzk'],
|
|
123
|
+
handler,
|
|
124
|
+
example: '/accessbriefing/latest/news',
|
|
125
|
+
parameters: { category: 'Category, Latest News by default' },
|
|
126
|
+
description: `:::tip
|
|
127
|
+
If you subscribe to [Latest News](https://www.accessbriefing.com/latest/news),where the URL is \`https://www.accessbriefing.com/latest/news\`, extract the part \`https://www.accessbriefing.com/\` to the end, and use it as the parameter to fill in. Therefore, the route will be [\`/accessbriefing/latest/news\`](https://rsshub.app/accessbriefing/latest/news).
|
|
128
|
+
:::
|
|
129
|
+
|
|
130
|
+
#### Latest
|
|
131
|
+
|
|
132
|
+
| Category | ID |
|
|
133
|
+
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
134
|
+
| [News](https://www.accessbriefing.com/latest/news) | [latest/news](https://rsshub.app/target/site/latest/news) |
|
|
135
|
+
| [Products & Technology](https://www.accessbriefing.com/latest/products-and-technology) | [latest/products-and-technology](https://rsshub.app/target/site/latest/products-and-technology) |
|
|
136
|
+
| [Rental News](https://www.accessbriefing.com/latest/rental-news) | [latest/rental-news](https://rsshub.app/target/site/latest/rental-news) |
|
|
137
|
+
| [People](https://www.accessbriefing.com/latest/people) | [latest/people](https://rsshub.app/target/site/latest/people) |
|
|
138
|
+
| [Regualtions & Safety](https://www.accessbriefing.com/latest/regualtions-safety) | [latest/regualtions-safety](https://rsshub.app/target/site/latest/regualtions-safety) |
|
|
139
|
+
| [Finance](https://www.accessbriefing.com/latest/finance) | [latest/finance](https://rsshub.app/target/site/latest/finance) |
|
|
140
|
+
| [Sustainability](https://www.accessbriefing.com/latest/sustainability) | [latest/sustainability](https://rsshub.app/target/site/latest/sustainability) |
|
|
141
|
+
|
|
142
|
+
#### Insight
|
|
143
|
+
|
|
144
|
+
| Category | ID |
|
|
145
|
+
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
146
|
+
| [Interviews](https://www.accessbriefing.com/insight/interviews) | [insight/interviews](https://rsshub.app/target/site/insight/interviews) |
|
|
147
|
+
| [Longer reads](https://www.accessbriefing.com/insight/longer-reads) | [insight/longer-reads](https://rsshub.app/target/site/insight/longer-reads) |
|
|
148
|
+
| [Videos and podcasts](https://www.accessbriefing.com/insight/videos-and-podcasts) | [insight/videos-and-podcasts](https://rsshub.app/target/site/insight/videos-and-podcasts) |
|
|
149
|
+
`,
|
|
150
|
+
categories: ['new-media'],
|
|
151
|
+
|
|
152
|
+
features: {
|
|
153
|
+
requireConfig: false,
|
|
154
|
+
requirePuppeteer: false,
|
|
155
|
+
antiCrawler: false,
|
|
156
|
+
supportRadar: true,
|
|
157
|
+
supportBT: false,
|
|
158
|
+
supportPodcast: false,
|
|
159
|
+
supportScihub: false,
|
|
160
|
+
},
|
|
161
|
+
radar: [
|
|
162
|
+
{
|
|
163
|
+
source: ['accessbriefing.com/:category*'],
|
|
164
|
+
target: '/:category',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
title: 'Latest - News',
|
|
168
|
+
source: ['accessbriefing.com/latest/news'],
|
|
169
|
+
target: '/latest/news',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
title: 'Latest - Products & Technology',
|
|
173
|
+
source: ['accessbriefing.com/latest/products-and-technology'],
|
|
174
|
+
target: '/latest/products-and-technology',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
title: 'Latest - Rental News',
|
|
178
|
+
source: ['accessbriefing.com/latest/rental-news'],
|
|
179
|
+
target: '/latest/rental-news',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
title: 'Latest - People',
|
|
183
|
+
source: ['accessbriefing.com/latest/people'],
|
|
184
|
+
target: '/latest/people',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
title: 'Latest - Regualtions & Safety',
|
|
188
|
+
source: ['accessbriefing.com/latest/regualtions-safety'],
|
|
189
|
+
target: '/latest/regualtions-safety',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
title: 'Latest - Finance',
|
|
193
|
+
source: ['accessbriefing.com/latest/finance'],
|
|
194
|
+
target: '/latest/finance',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
title: 'Latest - Sustainability',
|
|
198
|
+
source: ['accessbriefing.com/latest/sustainability'],
|
|
199
|
+
target: '/latest/sustainability',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
title: 'Insight - Interviews',
|
|
203
|
+
source: ['accessbriefing.com/insight/interviews'],
|
|
204
|
+
target: '/insight/interviews',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
title: 'Insight - Longer reads',
|
|
208
|
+
source: ['accessbriefing.com/insight/longer-reads'],
|
|
209
|
+
target: '/insight/longer-reads',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
title: 'Insight - Videos and podcasts',
|
|
213
|
+
source: ['accessbriefing.com/insight/videos-and-podcasts'],
|
|
214
|
+
target: '/insight/videos-and-podcasts',
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{{ if images }}
|
|
2
|
+
{{ each images image }}
|
|
3
|
+
{{ if image?.src }}
|
|
4
|
+
<figure>
|
|
5
|
+
<img
|
|
6
|
+
{{ if image.alt }}
|
|
7
|
+
alt="{{ image.alt }}"
|
|
8
|
+
{{ /if }}
|
|
9
|
+
{{ if image.width }}
|
|
10
|
+
alt="{{ image.width }}"
|
|
11
|
+
{{ /if }}
|
|
12
|
+
{{ if image.height }}
|
|
13
|
+
alt="{{ image.height }}"
|
|
14
|
+
{{ /if }}
|
|
15
|
+
src="{{ image.src }}">
|
|
16
|
+
</figure>
|
|
17
|
+
{{ /if }}
|
|
18
|
+
{{ /each }}
|
|
19
|
+
{{ /if }}
|
|
20
|
+
|
|
21
|
+
{{ if intro }}
|
|
22
|
+
<blockquote>{{ intro }}</blockquote>
|
|
23
|
+
{{ /if }}
|
|
24
|
+
|
|
25
|
+
{{ if description }}
|
|
26
|
+
{{@ description }}
|
|
27
|
+
{{ /if }}
|
|
@@ -4,11 +4,10 @@ const __dirname = getCurrentPath(import.meta.url);
|
|
|
4
4
|
|
|
5
5
|
import { getSubPath } from '@/utils/common-utils';
|
|
6
6
|
import cache from '@/utils/cache';
|
|
7
|
-
import got from '@/utils/got';
|
|
8
7
|
import { load } from 'cheerio';
|
|
9
|
-
import { parseDate } from '@/utils/parse-date';
|
|
10
8
|
import { art } from '@/utils/render';
|
|
11
9
|
import path from 'node:path';
|
|
10
|
+
import { ofetch } from 'ofetch';
|
|
12
11
|
|
|
13
12
|
const languages = {
|
|
14
13
|
arabic: {
|
|
@@ -45,12 +44,8 @@ async function handler(ctx) {
|
|
|
45
44
|
const rootUrl = languages[language].rootUrl;
|
|
46
45
|
const currentUrl = `${rootUrl}/${isRSS ? languages[language].rssUrl : params.join('/')}`;
|
|
47
46
|
|
|
48
|
-
const response = await
|
|
49
|
-
|
|
50
|
-
url: currentUrl,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const $ = load(response.data);
|
|
47
|
+
const response = await ofetch(currentUrl);
|
|
48
|
+
const $ = load(response);
|
|
54
49
|
|
|
55
50
|
let items = isRSS
|
|
56
51
|
? response.data.match(new RegExp('<link>' + rootUrl + '/(.*?)</link>', 'g')).map((item) => ({
|
|
@@ -69,19 +64,27 @@ async function handler(ctx) {
|
|
|
69
64
|
items = await Promise.all(
|
|
70
65
|
items.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50).map((item) =>
|
|
71
66
|
cache.tryGet(item.link, async () => {
|
|
72
|
-
const detailResponse = await
|
|
73
|
-
method: 'get',
|
|
74
|
-
url: item.link,
|
|
75
|
-
});
|
|
67
|
+
const detailResponse = await ofetch(item.link);
|
|
76
68
|
|
|
77
|
-
const content = load(detailResponse
|
|
69
|
+
const content = load(detailResponse);
|
|
78
70
|
|
|
79
71
|
content('.more-on').parent().remove();
|
|
80
72
|
content('.responsive-image img').removeAttr('srcset');
|
|
73
|
+
let pubDate;
|
|
74
|
+
|
|
75
|
+
const datePublished = detailResponse.match(/"datePublished": ?"(.*?)",/);
|
|
76
|
+
if (datePublished && datePublished.length > 1) {
|
|
77
|
+
pubDate = detailResponse.match(/"datePublished": ?"(.*?)",/)[1];
|
|
78
|
+
} else {
|
|
79
|
+
// uploadDate replaces datePublished for video articles
|
|
80
|
+
const uploadDate = detailResponse.match(/"uploadDate": ?"(.*?)",/)[1];
|
|
81
|
+
|
|
82
|
+
pubDate = uploadDate && uploadDate.length > 1 ? uploadDate : content('div.date-simple > span:nth-child(2)').text();
|
|
83
|
+
}
|
|
81
84
|
|
|
82
85
|
item.title = content('h1').first().text();
|
|
83
86
|
item.author = content('.author').text();
|
|
84
|
-
item.pubDate =
|
|
87
|
+
item.pubDate = pubDate;
|
|
85
88
|
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
86
89
|
image: content('.article-featured-image').html(),
|
|
87
90
|
description: content('.wysiwyg').html(),
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import got from '@/utils/got';
|
|
3
|
+
import { load } from 'cheerio';
|
|
4
|
+
import { parseDate } from '@/utils/parse-date';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
path: '/podcast/:id',
|
|
8
|
+
categories: ['multimedia'],
|
|
9
|
+
example: '/apple/podcast/id1559695855',
|
|
10
|
+
parameters: { id: '播客id,可以在 Apple 播客app 内分享的播客的 URL 中找到' },
|
|
11
|
+
features: {
|
|
12
|
+
requireConfig: false,
|
|
13
|
+
requirePuppeteer: false,
|
|
14
|
+
antiCrawler: false,
|
|
15
|
+
supportBT: false,
|
|
16
|
+
supportPodcast: false,
|
|
17
|
+
supportScihub: false,
|
|
18
|
+
},
|
|
19
|
+
radar: [
|
|
20
|
+
{
|
|
21
|
+
source: ['podcasts.apple.com/cn/podcast/:id'],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
name: '播客',
|
|
25
|
+
maintainers: ['Acring'],
|
|
26
|
+
handler,
|
|
27
|
+
url: 'https://www.apple.com.cn/apple-podcasts/',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
async function handler(ctx) {
|
|
31
|
+
const link = `https://podcasts.apple.com/cn/podcast/${ctx.req.param('id')}`;
|
|
32
|
+
const response = await got({
|
|
33
|
+
method: 'get',
|
|
34
|
+
url: link,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const $ = load(response.data);
|
|
38
|
+
|
|
39
|
+
const page_data = JSON.parse($('#shoebox-media-api-cache-amp-podcasts').text());
|
|
40
|
+
|
|
41
|
+
const data = JSON.parse(page_data[Object.keys(page_data)[0]]).d[0];
|
|
42
|
+
const attributes = data.attributes;
|
|
43
|
+
|
|
44
|
+
const episodes = data.relationships.episodes.data.map((item) => {
|
|
45
|
+
const attr = item.attributes;
|
|
46
|
+
return {
|
|
47
|
+
title: attr.name,
|
|
48
|
+
enclosure_url: attr.assetUrl,
|
|
49
|
+
itunes_duration: attr.durationInMilliseconds / 1000,
|
|
50
|
+
enclosure_type: 'audio/mp4',
|
|
51
|
+
link: attr.url,
|
|
52
|
+
pubDate: parseDate(attr.releaseDateTime),
|
|
53
|
+
description: attr.description.standard.replaceAll('\n', '<br>'),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
title: attributes.name,
|
|
59
|
+
link: attributes.url,
|
|
60
|
+
itunes_author: attributes.artistName,
|
|
61
|
+
item: episodes,
|
|
62
|
+
description: attributes.description.standard,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
|
-
import
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
4
|
|
|
5
5
|
import { baseUrl, apiHost, parseEventDetail, parseItem } from './utils';
|
|
6
6
|
|
|
@@ -8,15 +8,6 @@ export const route: Route = {
|
|
|
8
8
|
path: '/hub/events',
|
|
9
9
|
categories: ['programming'],
|
|
10
10
|
example: '/baai/hub/events',
|
|
11
|
-
parameters: {},
|
|
12
|
-
features: {
|
|
13
|
-
requireConfig: false,
|
|
14
|
-
requirePuppeteer: false,
|
|
15
|
-
antiCrawler: false,
|
|
16
|
-
supportBT: false,
|
|
17
|
-
supportPodcast: false,
|
|
18
|
-
supportScihub: false,
|
|
19
|
-
},
|
|
20
11
|
radar: [
|
|
21
12
|
{
|
|
22
13
|
source: ['hub.baai.ac.cn/events', 'hub.baai.ac.cn/'],
|
|
@@ -28,18 +19,16 @@ export const route: Route = {
|
|
|
28
19
|
url: 'hub.baai.ac.cn/events',
|
|
29
20
|
};
|
|
30
21
|
|
|
31
|
-
async function handler(
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
).map((url) => got.post(url))
|
|
40
|
-
);
|
|
22
|
+
async function handler() {
|
|
23
|
+
const response = await ofetch(`${apiHost}/api/v1/events`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
body: {
|
|
26
|
+
page: 1,
|
|
27
|
+
tag_id: '',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
41
30
|
|
|
42
|
-
const list =
|
|
31
|
+
const list = response.data.map((item) => parseItem(item));
|
|
43
32
|
|
|
44
33
|
const items = await Promise.all(
|
|
45
34
|
list.map((item) =>
|