rsshub 1.0.0-master.c183692 → 1.0.0-master.c1913c8
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/README.md +6 -9
- package/lib/config.ts +18 -0
- package/lib/errors/index.tsx +1 -1
- package/lib/middleware/logger.ts +2 -2
- package/lib/routes/abc/index.ts +2 -2
- package/lib/routes/apnews/api.ts +6 -1
- package/lib/routes/apnews/rss.ts +1 -1
- package/lib/routes/apnews/sitemap.ts +2 -1
- package/lib/routes/apnews/topics.ts +2 -2
- package/lib/routes/asus/bios.ts +39 -6
- package/lib/routes/bilibili/bilibili-recommend.ts +42 -0
- package/lib/routes/bilibili/cache.ts +22 -0
- package/lib/routes/bilibili/dynamic.ts +101 -97
- package/lib/routes/bilibili/followings-video.ts +9 -3
- package/lib/routes/bilibili/utils.ts +5 -0
- package/lib/routes/bilibili/video.ts +2 -1
- package/lib/routes/bitget/announcement.ts +200 -0
- package/lib/routes/bitget/namespace.ts +6 -0
- package/lib/routes/bitget/type.ts +26 -0
- package/lib/routes/bjp/apod.ts +4 -2
- package/lib/routes/bupt/jwc.ts +130 -0
- package/lib/routes/ccfa/index.ts +216 -0
- package/lib/routes/ccfa/namespace.ts +8 -0
- package/lib/routes/ccfa/templates/description.art +7 -0
- package/lib/routes/devtrium/namespace.ts +6 -0
- package/lib/routes/devtrium/posts.ts +55 -0
- package/lib/routes/discourse/official.ts +55 -0
- package/lib/routes/dockerhub/utils.ts +4 -3
- package/lib/routes/douban/movie/coming.ts +68 -0
- package/lib/routes/douban/templates/movie_coming.art +27 -0
- package/lib/routes/follow/profile.ts +35 -5
- package/lib/routes/github/comments.ts +32 -30
- package/lib/routes/gov/cn/namespace.ts +8 -0
- package/lib/routes/gov/{news → cn/news}/index.ts +11 -7
- package/lib/routes/gov/ndrc/fggz.ts +637 -2
- package/lib/routes/gov/ndrc/namespace.ts +8 -0
- package/lib/routes/gov/ndrc/xwdt.ts +28 -8
- package/lib/routes/gov/ndrc/zfxxgk/articles.ts +73 -0
- package/lib/routes/hpoi/all.ts +3 -2
- package/lib/routes/hpoi/character.ts +3 -2
- package/lib/routes/hpoi/work.ts +3 -2
- package/lib/routes/jjwxc/book.ts +18 -14
- package/lib/routes/lofter/collection.ts +87 -0
- package/lib/routes/malaysiakini/index.ts +179 -0
- package/lib/routes/malaysiakini/namespace.ts +11 -0
- package/lib/routes/mastodon/acct.ts +4 -3
- package/lib/routes/mastodon/timeline-local.ts +3 -2
- package/lib/routes/mastodon/timeline-remote.ts +3 -2
- package/lib/routes/meishichina/index.ts +1997 -0
- package/lib/routes/meishichina/namespace.ts +8 -0
- package/lib/routes/oct0pu5/namespace.ts +10 -0
- package/lib/routes/oct0pu5/rss.ts +48 -0
- package/lib/routes/pconline/focus.ts +143 -0
- package/lib/routes/pconline/namespace.ts +10 -0
- package/lib/routes/people/index.ts +6 -2
- package/lib/routes/pixivision/index.ts +84 -0
- package/lib/routes/pixivision/namespace.ts +6 -0
- package/lib/routes/pixivision/utils.ts +86 -0
- package/lib/routes/pku/bbs/hot.ts +1 -1
- package/lib/routes/pornhub/category.ts +3 -2
- package/lib/routes/pornhub/model.ts +4 -3
- package/lib/routes/pornhub/pornstar.ts +4 -3
- package/lib/routes/pornhub/search.ts +3 -2
- package/lib/routes/qiche365/namespace.ts +5 -0
- package/lib/routes/qiche365/recall.ts +53 -0
- package/lib/routes/sdu/{cs.ts → cs/index.ts} +46 -12
- package/lib/routes/sdu/namespace.ts +2 -2
- package/lib/routes/soundon/namespace.ts +6 -0
- package/lib/routes/soundon/podcast.ts +80 -0
- package/lib/routes/soundon/types.ts +67 -0
- package/lib/routes/swjtu/scai/bks.ts +80 -0
- package/lib/routes/telegram/blog.ts +3 -2
- package/lib/routes/telegram/stickerpack.ts +3 -2
- package/lib/routes/tencent/news/author.ts +2 -1
- package/lib/routes/the/index.ts +3 -2
- package/lib/routes/theinitium/app.ts +137 -0
- package/lib/routes/theinitium/templates/description.art +17 -0
- package/lib/routes/threads/index.ts +26 -20
- package/lib/routes/tju/cic/index.ts +2 -2
- package/lib/routes/tju/news/index.ts +2 -2
- package/lib/routes/tju/oaa/index.ts +2 -2
- package/lib/routes/twitch/live.ts +3 -2
- package/lib/routes/twitch/video.ts +3 -2
- package/lib/routes/twitter/api/mobile-api/login.ts +1 -1
- package/lib/routes/twitter/api/web-api/constants.ts +15 -14
- package/lib/routes/twitter/api/web-api/login.ts +7 -5
- package/lib/routes/twitter/api/web-api/utils.ts +1 -2
- package/lib/routes/twitter/list.ts +5 -2
- package/lib/routes/twitter/tweet.ts +1 -0
- package/lib/routes/weibo/namespace.ts +1 -0
- package/lib/routes/weibo/oasis/user.ts +1 -1
- package/lib/routes/weibo/super-index.ts +23 -11
- package/lib/routes/weibo/user.ts +12 -1
- package/lib/routes/whu/cs.ts +11 -3
- package/lib/routes/whu/gs/index.ts +2 -1
- package/lib/routes/whu/news.ts +27 -2
- package/lib/routes/withgoogle/explorables.ts +54 -0
- package/lib/routes/withgoogle/namespace.ts +6 -0
- package/lib/routes/zaobao/util.ts +1 -1
- package/lib/routes/zhihu/zhuanlan.ts +8 -7
- package/lib/utils/otel/metric.ts +3 -2
- package/lib/views/rss.tsx +7 -0
- package/package.json +14 -14
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DataItem, Route } from '@/types';
|
|
2
|
+
import { load } from 'cheerio';
|
|
3
|
+
import { ofetch } from 'ofetch';
|
|
4
|
+
import { parseDate } from '@/utils/parse-date';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
path: '/',
|
|
8
|
+
categories: ['programming'],
|
|
9
|
+
example: '/devtrium',
|
|
10
|
+
parameters: {},
|
|
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: ['devtrium.com'],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
name: 'Official Blogs',
|
|
25
|
+
maintainers: ['Xy2002'],
|
|
26
|
+
handler,
|
|
27
|
+
url: 'devtrium.com',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
async function handler() {
|
|
31
|
+
const items = await fetchPage();
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
title: 'Devtrium',
|
|
35
|
+
language: 'en-us',
|
|
36
|
+
item: items,
|
|
37
|
+
link: 'https://devtrium.com',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function fetchPage() {
|
|
42
|
+
const baseUrl = 'https://devtrium.com';
|
|
43
|
+
const response = await ofetch(baseUrl);
|
|
44
|
+
const $ = load(response, { scriptingEnabled: false });
|
|
45
|
+
|
|
46
|
+
// Extract all posts of this page
|
|
47
|
+
const data = JSON.parse($('script#__NEXT_DATA__').text());
|
|
48
|
+
const items: DataItem[] = data.props.pageProps.posts.map((post) => ({
|
|
49
|
+
title: post.title,
|
|
50
|
+
link: `${baseUrl}/posts/${post.slug}`,
|
|
51
|
+
description: post.description,
|
|
52
|
+
pubDate: parseDate(post.date),
|
|
53
|
+
}));
|
|
54
|
+
return items;
|
|
55
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import { getConfig } from './utils';
|
|
3
|
+
import got from '@/utils/got';
|
|
4
|
+
import RSSParser from '@/utils/rss-parser';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
path: '/:configId/official/:path{.+}',
|
|
8
|
+
categories: ['bbs'],
|
|
9
|
+
example: '/discourse/0/official/latest',
|
|
10
|
+
parameters: {
|
|
11
|
+
configId: 'Environment variable configuration id, see above',
|
|
12
|
+
path: 'Discourse RSS path between `domain` and `.rss`. All supported Rss path can be found in [https://meta.discourse.org/t/finding-discourse-rss-feeds/264134](https://meta.discourse.org/t/finding-discourse-rss-feeds/264134). For example: the path of [https://meta.discourse.org/top/all.rss](https://meta.discourse.org/top/all.rss) is `top/all`.',
|
|
13
|
+
},
|
|
14
|
+
features: {
|
|
15
|
+
requireConfig: [
|
|
16
|
+
{
|
|
17
|
+
name: 'DISCOURSE_CONFIG_*',
|
|
18
|
+
description: `Configure the Discourse environment variables referring to [https://docs.rsshub.app/deploy/config#discourse](https://docs.rsshub.app/deploy/config#discourse).`,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
requirePuppeteer: false,
|
|
22
|
+
antiCrawler: false,
|
|
23
|
+
supportBT: false,
|
|
24
|
+
supportPodcast: false,
|
|
25
|
+
supportScihub: false,
|
|
26
|
+
},
|
|
27
|
+
name: 'Official RSS',
|
|
28
|
+
maintainers: ['Raikyou', 'dzx-dzx'],
|
|
29
|
+
handler,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
async function handler(ctx) {
|
|
33
|
+
const { link, key } = getConfig(ctx);
|
|
34
|
+
const path = ctx.req.param('path');
|
|
35
|
+
|
|
36
|
+
const url = `${link}/${path}.rss`;
|
|
37
|
+
|
|
38
|
+
const feed = await RSSParser.parseString(
|
|
39
|
+
(
|
|
40
|
+
await got(url, {
|
|
41
|
+
headers: {
|
|
42
|
+
'User-Api-Key': key,
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
).data
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
feed.items = feed.items.map((e) => ({
|
|
49
|
+
description: e.content,
|
|
50
|
+
author: e.creator,
|
|
51
|
+
...e,
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
return { item: feed.items, ...feed };
|
|
55
|
+
}
|
|
@@ -2,9 +2,10 @@ import md5 from '@/utils/md5';
|
|
|
2
2
|
|
|
3
3
|
function hash(images) {
|
|
4
4
|
const entries = Object.entries(images)
|
|
5
|
-
.map((x) =>
|
|
6
|
-
.sort((a, b) => a
|
|
7
|
-
|
|
5
|
+
.map((x) => `${x[1].os}/${x[1].architecture},${x[1].digest}`)
|
|
6
|
+
.sort((a, b) => a.localeCompare(b));
|
|
7
|
+
const text = entries.join('|');
|
|
8
|
+
return md5(text);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export { hash };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import got from '@/utils/got';
|
|
3
|
+
import { getCurrentPath } from '@/utils/helpers';
|
|
4
|
+
import { art } from '@/utils/render';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
|
|
7
|
+
const __dirname = getCurrentPath(import.meta.url);
|
|
8
|
+
|
|
9
|
+
export const route: Route = {
|
|
10
|
+
path: '/movie/coming',
|
|
11
|
+
categories: ['social-media'],
|
|
12
|
+
example: '/douban/movie/coming',
|
|
13
|
+
features: {
|
|
14
|
+
requireConfig: false,
|
|
15
|
+
requirePuppeteer: false,
|
|
16
|
+
antiCrawler: false,
|
|
17
|
+
supportBT: false,
|
|
18
|
+
supportPodcast: false,
|
|
19
|
+
supportScihub: false,
|
|
20
|
+
},
|
|
21
|
+
name: '电影即将上映',
|
|
22
|
+
maintainers: ['reonokiy'],
|
|
23
|
+
radar: [
|
|
24
|
+
{
|
|
25
|
+
title: '豆瓣电影-即将上映',
|
|
26
|
+
source: ['movie.douban.com/coming'],
|
|
27
|
+
target: '/movie/coming',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
handler,
|
|
31
|
+
};
|
|
32
|
+
const renderDescription = (info: { title?: string; cover_url?: string; pubdate?: string[]; intro?: string; directors?: string[]; actors?: string[]; genres: string[]; wish_count?: number | string }) =>
|
|
33
|
+
art(path.join(__dirname, '../templates/movie_coming.art'), info);
|
|
34
|
+
|
|
35
|
+
async function handler(ctx) {
|
|
36
|
+
const response = await got({
|
|
37
|
+
method: 'get',
|
|
38
|
+
url: 'https://m.douban.com/rexxar/api/v2/movie/coming_soon',
|
|
39
|
+
headers: {
|
|
40
|
+
Referer: 'https://m.douban.com/movie/',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
ctx.set('json', { response });
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
title: '豆瓣电影-即将上映',
|
|
48
|
+
link: 'https://movie.douban.com/coming',
|
|
49
|
+
item: response.data?.subjects?.map((item) => ({
|
|
50
|
+
title: item?.title,
|
|
51
|
+
link: item?.url,
|
|
52
|
+
guid: item?.url,
|
|
53
|
+
description: renderDescription({
|
|
54
|
+
title: item?.title,
|
|
55
|
+
intro: item?.intro,
|
|
56
|
+
pubdate: item?.pubdate,
|
|
57
|
+
cover_url: item?.cover_url,
|
|
58
|
+
directors: item?.directors?.map((d) => d?.name),
|
|
59
|
+
actors: item?.actors?.map((a) => a?.name),
|
|
60
|
+
genres: item?.genres,
|
|
61
|
+
wish_count: item?.wish_count,
|
|
62
|
+
}),
|
|
63
|
+
category: item?.genres,
|
|
64
|
+
itunes_item_image: item?.cover_url,
|
|
65
|
+
upvotes: item?.wish_count,
|
|
66
|
+
})),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{{if cover_url && title}}
|
|
2
|
+
<img src="{{cover_url}}" alt="{{title}}" referrerpolicy="no-referrer">
|
|
3
|
+
{{/if}}
|
|
4
|
+
|
|
5
|
+
<h2>电影信息</h2>
|
|
6
|
+
<ul>
|
|
7
|
+
{{if directors}}
|
|
8
|
+
<li>导演:{{directors.join(', ')}}</li>
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{if actors}}
|
|
11
|
+
<li>演员:{{actors.join(', ')}}</li>
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{if genres}}
|
|
14
|
+
<li>类型:{{genres.join(' / ')}}</li>
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{if pubdate}}
|
|
17
|
+
<li>上映日期:{{pubdate.join(' / ')}}</li>
|
|
18
|
+
{{/if}}
|
|
19
|
+
{{if wish_count}}
|
|
20
|
+
<li>想看:{{wish_count}}</li>
|
|
21
|
+
{{/if}}
|
|
22
|
+
</ul>
|
|
23
|
+
|
|
24
|
+
{{ if intro }}
|
|
25
|
+
<h2>剧情简介</h2>
|
|
26
|
+
<p>{{ intro }}</p>
|
|
27
|
+
{{/if}}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { ViewType, type Data, type Route } from '@/types';
|
|
2
2
|
import type { Context } from 'hono';
|
|
3
3
|
import ofetch from '@/utils/ofetch';
|
|
4
4
|
import type { FollowResponse, Profile, Subscription } from './types';
|
|
5
|
+
import { parse } from 'tldts';
|
|
5
6
|
|
|
6
7
|
export const route: Route = {
|
|
7
8
|
name: 'User subscriptions',
|
|
9
|
+
categories: ['social-media'],
|
|
8
10
|
path: '/profile/:uid',
|
|
9
|
-
example: '/profile/41279032429549568',
|
|
11
|
+
example: '/follow/profile/41279032429549568',
|
|
12
|
+
parameters: {
|
|
13
|
+
uid: 'User ID or user handle',
|
|
14
|
+
},
|
|
10
15
|
radar: [
|
|
11
16
|
{
|
|
12
17
|
source: ['app.follow.is/profile/:uid'],
|
|
@@ -14,26 +19,51 @@ export const route: Route = {
|
|
|
14
19
|
},
|
|
15
20
|
],
|
|
16
21
|
handler,
|
|
17
|
-
maintainers: ['KarasuShin'],
|
|
22
|
+
maintainers: ['KarasuShin', 'DIYgod'],
|
|
18
23
|
features: {
|
|
19
24
|
supportRadar: true,
|
|
20
25
|
},
|
|
26
|
+
view: ViewType.Notifications,
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
async function handler(ctx: Context): Promise<Data> {
|
|
24
30
|
const uid = ctx.req.param('uid');
|
|
25
31
|
const host = 'https://api.follow.is';
|
|
26
32
|
|
|
27
|
-
const
|
|
33
|
+
const profile = await ofetch<FollowResponse<Profile>>(`${host}/profiles?id=${uid}`);
|
|
34
|
+
const subscriptions = await ofetch<FollowResponse<Subscription[]>>(`${host}/subscriptions?userId=${profile.data.id}`);
|
|
28
35
|
|
|
29
36
|
return {
|
|
30
|
-
title: `${profile.data.name}
|
|
37
|
+
title: `${profile.data.name}'s subscriptions`,
|
|
31
38
|
item: subscriptions.data.map((subscription) => ({
|
|
32
39
|
title: subscription.feeds.title,
|
|
33
40
|
description: subscription.feeds.description,
|
|
34
41
|
link: `https://app.follow.is/feed/${subscription.feedId}`,
|
|
42
|
+
image: getUrlIcon(subscription.feeds.siteUrl).src,
|
|
43
|
+
category: [subscription.category],
|
|
35
44
|
})),
|
|
36
45
|
link: `https://app.follow.is/profile/${uid}`,
|
|
37
46
|
image: profile.data.image,
|
|
38
47
|
};
|
|
39
48
|
}
|
|
49
|
+
|
|
50
|
+
const getUrlIcon = (url: string, fallback?: boolean | undefined) => {
|
|
51
|
+
let src: string;
|
|
52
|
+
let fallbackUrl = '';
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const { host } = new URL(url);
|
|
56
|
+
const pureDomain = parse(host).domainWithoutSuffix;
|
|
57
|
+
fallbackUrl = `https://avatar.vercel.sh/${pureDomain}.svg?text=${pureDomain?.slice(0, 2).toUpperCase()}`;
|
|
58
|
+
src = `https://unavatar.follow.is/${host}?fallback=${fallback || false}`;
|
|
59
|
+
} catch {
|
|
60
|
+
const pureDomain = parse(url).domainWithoutSuffix;
|
|
61
|
+
src = `https://avatar.vercel.sh/${pureDomain}.svg?text=${pureDomain?.slice(0, 2).toUpperCase()}`;
|
|
62
|
+
}
|
|
63
|
+
const ret = {
|
|
64
|
+
src,
|
|
65
|
+
fallbackUrl,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return ret;
|
|
69
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
|
-
import
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
3
|
import { parseDate } from '@/utils/parse-date';
|
|
4
4
|
import MarkdownIt from 'markdown-it';
|
|
5
5
|
const md = MarkdownIt({
|
|
@@ -59,16 +59,16 @@ async function handler(ctx) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
async function allIssues(ctx, user, repo, limit, headers) {
|
|
62
|
-
const response = await
|
|
62
|
+
const response = await ofetch.raw(`${apiUrl}/repos/${user}/${repo}/issues/comments`, {
|
|
63
63
|
headers,
|
|
64
|
-
|
|
64
|
+
query: {
|
|
65
65
|
sort: 'updated',
|
|
66
66
|
direction: 'desc',
|
|
67
67
|
per_page: limit,
|
|
68
68
|
},
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
const timeline = response.
|
|
71
|
+
const timeline = response._data;
|
|
72
72
|
|
|
73
73
|
const items = timeline.map((item) => {
|
|
74
74
|
const actor = item.actor?.login ?? item.user?.login ?? 'ghost';
|
|
@@ -86,14 +86,13 @@ async function allIssues(ctx, user, repo, limit, headers) {
|
|
|
86
86
|
};
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// };
|
|
89
|
+
const rateLimit = {
|
|
90
|
+
limit: Number.parseInt(response.headers.get('x-ratelimit-limit')),
|
|
91
|
+
remaining: Number.parseInt(response.headers.get('x-ratelimit-remaining')),
|
|
92
|
+
reset: parseDate(Number.parseInt(response.headers.get('x-ratelimit-reset')) * 1000),
|
|
93
|
+
resoure: response.headers.get('x-ratelimit-resource'),
|
|
94
|
+
used: Number.parseInt(response.headers.get('x-ratelimit-used')),
|
|
95
|
+
};
|
|
97
96
|
|
|
98
97
|
const ret = {
|
|
99
98
|
title: `${user}/${repo}: Issue & Pull request comments`,
|
|
@@ -103,35 +102,38 @@ async function allIssues(ctx, user, repo, limit, headers) {
|
|
|
103
102
|
|
|
104
103
|
ctx.set('json', {
|
|
105
104
|
...ret,
|
|
106
|
-
|
|
105
|
+
rateLimit,
|
|
107
106
|
});
|
|
108
107
|
return ret;
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
async function singleIssue(ctx, user, repo, number, limit, headers) {
|
|
112
|
-
const response = await
|
|
111
|
+
const response = await ofetch.raw(`${apiUrl}/repos/${user}/${repo}/issues/${number}`, {
|
|
113
112
|
headers,
|
|
114
113
|
});
|
|
115
|
-
const issue = response.
|
|
114
|
+
const issue = response._data;
|
|
116
115
|
const type = issue.pull_request ? 'pull' : 'issue';
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
let timelineResponse = await ofetch.raw(issue.timeline_url, {
|
|
119
118
|
headers,
|
|
120
|
-
|
|
119
|
+
query: {
|
|
121
120
|
per_page: limit,
|
|
122
121
|
},
|
|
123
122
|
});
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
123
|
+
const items = [];
|
|
124
|
+
const lastUrl = timelineResponse.headers.get('link')?.match(/<(\S+?)>; rel="last"/)?.[1];
|
|
125
|
+
if (lastUrl) {
|
|
126
|
+
timelineResponse = await ofetch.raw(lastUrl, { headers });
|
|
127
|
+
} else {
|
|
128
|
+
items.push({
|
|
128
129
|
title: `${issue.user.login} created ${user}/${repo}: ${typeDict[type].title} #${issue.number}`,
|
|
129
130
|
description: issue.body ? md.render(issue.body) : null,
|
|
130
131
|
author: issue.user.login,
|
|
131
132
|
pubDate: parseDate(issue.created_at),
|
|
132
133
|
link: `${issue.html_url}#issue-${issue.id}`,
|
|
133
|
-
}
|
|
134
|
-
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const timeline = timelineResponse._data;
|
|
135
137
|
|
|
136
138
|
for (const item of timeline) {
|
|
137
139
|
const actor = item.actor?.login ?? item.user?.login ?? 'ghost';
|
|
@@ -194,13 +196,13 @@ async function singleIssue(ctx, user, repo, number, limit, headers) {
|
|
|
194
196
|
|
|
195
197
|
ctx.set('json', {
|
|
196
198
|
...ret,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
rateLimit: {
|
|
200
|
+
limit: Number.parseInt(response.headers.get('x-ratelimit-limit')),
|
|
201
|
+
remaining: Number.parseInt(response.headers.get('x-ratelimit-remaining')),
|
|
202
|
+
reset: parseDate(Number.parseInt(response.headers.get('x-ratelimit-reset')) * 1000),
|
|
203
|
+
resoure: response.headers.get('x-ratelimit-resource'),
|
|
204
|
+
used: Number.parseInt(response.headers.get('x-ratelimit-used')),
|
|
205
|
+
},
|
|
204
206
|
});
|
|
205
207
|
return ret;
|
|
206
208
|
}
|
|
@@ -7,9 +7,9 @@ import { parseDate } from '@/utils/parse-date';
|
|
|
7
7
|
import timezone from '@/utils/timezone';
|
|
8
8
|
|
|
9
9
|
export const route: Route = {
|
|
10
|
-
path: '/news/:uid',
|
|
10
|
+
path: '/cn/news/:uid',
|
|
11
11
|
categories: ['government'],
|
|
12
|
-
example: '/gov/news/bm',
|
|
12
|
+
example: '/gov/cn/news/bm',
|
|
13
13
|
parameters: { uid: '分类名' },
|
|
14
14
|
features: {
|
|
15
15
|
requireConfig: false,
|
|
@@ -20,11 +20,11 @@ export const route: Route = {
|
|
|
20
20
|
supportScihub: false,
|
|
21
21
|
},
|
|
22
22
|
name: '政府新闻',
|
|
23
|
-
maintainers: ['EsuRt'],
|
|
23
|
+
maintainers: ['EsuRt', 'howfool'],
|
|
24
24
|
handler,
|
|
25
|
-
description: `| 政务部门 | 滚动新闻 | 新闻要闻 | 国务院新闻 | 政策文件 |
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
description: `| 政务部门 | 滚动新闻 | 新闻要闻 | 国务院新闻 | 国务院工作会议 | 政策文件 |
|
|
26
|
+
| :------: | :------: | :------: | :--------: | :------------: | :------: |
|
|
27
|
+
| bm | gd | yw | gwy | gwyzzjg | zhengce |`,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
async function handler(ctx) {
|
|
@@ -55,6 +55,10 @@ async function handler(ctx) {
|
|
|
55
55
|
url = 'http://sousuo.gov.cn/s.htm?t=zhengcelibrary';
|
|
56
56
|
title = '中国政府网 - 政策文件';
|
|
57
57
|
break;
|
|
58
|
+
case 'gwyzzjg':
|
|
59
|
+
url = `${originDomain}/gwyzzjg/huiyi/`;
|
|
60
|
+
title = '中国政府网 - 国务院工作会议';
|
|
61
|
+
break;
|
|
58
62
|
default:
|
|
59
63
|
logger.error('pattern not matched');
|
|
60
64
|
}
|
|
@@ -119,7 +123,7 @@ async function handler(ctx) {
|
|
|
119
123
|
link: contentUrl,
|
|
120
124
|
pubDate,
|
|
121
125
|
author,
|
|
122
|
-
category,
|
|
126
|
+
category: category.filter(Boolean),
|
|
123
127
|
};
|
|
124
128
|
});
|
|
125
129
|
})
|