rsshub 1.0.0-master.d8b026f → 1.0.0-master.d8b7aae
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/errors/index.test.ts +1 -1
- package/lib/routes/apnews/api.ts +57 -0
- package/lib/routes/chikubi/index.ts +75 -0
- package/lib/routes/chikubi/namespace.ts +6 -0
- package/lib/routes/chikubi/utils.ts +82 -0
- package/lib/routes/easynomad/joblist.ts +56 -0
- package/lib/routes/easynomad/namespace.ts +6 -0
- package/lib/routes/follow/namespace.ts +6 -0
- package/lib/routes/follow/profile.ts +39 -0
- package/lib/routes/follow/types.ts +38 -0
- package/lib/routes/github/activity.ts +1 -1
- package/lib/routes/go/mhlw/pdf.ts +87 -0
- package/lib/routes/kakuyomu/namespace.ts +6 -0
- package/lib/routes/kakuyomu/types.ts +6 -0
- package/lib/routes/kakuyomu/works.ts +73 -0
- package/lib/routes/lofter/user.ts +1 -1
- package/lib/routes/rss3/index.ts +1 -1
- package/lib/routes/samd/news.ts +1 -1
- package/lib/routes/sspai/index.ts +2 -2
- package/lib/routes/weibo/utils.ts +0 -4
- package/lib/routes/xiaohongshu/user.ts +4 -3
- package/lib/routes/xiaohongshu/util.ts +3 -1
- package/lib/routes/zhihu/utils.ts +6 -2
- package/lib/views/json.ts +1 -1
- package/package.json +12 -12
package/lib/errors/index.test.ts
CHANGED
|
@@ -22,7 +22,7 @@ describe('httperror', () => {
|
|
|
22
22
|
it(`httperror`, async () => {
|
|
23
23
|
const response = await request.get('/test/httperror');
|
|
24
24
|
expect(response.status).toBe(503);
|
|
25
|
-
expect(response.text).
|
|
25
|
+
expect(response.text).toContain('FetchError: [GET] "https://httpbingo.org/status/404": 404 Not Found');
|
|
26
26
|
}, 20000);
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Route, ViewType } from '@/types';
|
|
2
|
+
import { fetchArticle } from './utils';
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
|
+
import timezone from '@/utils/timezone';
|
|
5
|
+
import { parseDate } from '@/utils/parse-date';
|
|
6
|
+
|
|
7
|
+
export const route: Route = {
|
|
8
|
+
path: '/api/:tags?',
|
|
9
|
+
categories: ['traditional-media'],
|
|
10
|
+
example: '/apnews/api/business',
|
|
11
|
+
view: ViewType.Articles,
|
|
12
|
+
parameters: {
|
|
13
|
+
tags: {
|
|
14
|
+
description: 'Getting a list of articles from a public API based on tags. See https://github.com/kovidgoyal/calibre/blob/81666219718b5f57d56b149a7ac017cc2a76b931/recipes/ap.recipe#L43-L46',
|
|
15
|
+
default: 'apf-topnews',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
features: {
|
|
19
|
+
requireConfig: false,
|
|
20
|
+
requirePuppeteer: false,
|
|
21
|
+
antiCrawler: false,
|
|
22
|
+
supportBT: false,
|
|
23
|
+
supportPodcast: false,
|
|
24
|
+
supportScihub: false,
|
|
25
|
+
},
|
|
26
|
+
radar: [
|
|
27
|
+
{
|
|
28
|
+
source: ['apnews.com/'],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
name: 'News',
|
|
32
|
+
maintainers: ['dzx-dzx'],
|
|
33
|
+
handler,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
async function handler(ctx) {
|
|
37
|
+
const { tags = 'apf-topnews' } = ctx.req.param();
|
|
38
|
+
const apiRootUrl = 'https://afs-prod.appspot.com/api/v2/feed/tag';
|
|
39
|
+
const url = `${apiRootUrl}?tags=${tags}`;
|
|
40
|
+
const res = await ofetch(url);
|
|
41
|
+
|
|
42
|
+
const list = res.cards
|
|
43
|
+
.map((e) => ({
|
|
44
|
+
title: e.contents[0]?.headline,
|
|
45
|
+
link: e.contents[0]?.localLinkUrl,
|
|
46
|
+
pubDate: timezone(parseDate(e.publishedDate), 0),
|
|
47
|
+
}))
|
|
48
|
+
.sort((a, b) => b.pubDate - a.pubDate)
|
|
49
|
+
.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 20);
|
|
50
|
+
|
|
51
|
+
const items = await Promise.all(list.map((item) => fetchArticle(item)));
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
title: `${res.tagObjs[0].name} - AP News`,
|
|
55
|
+
item: items,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Route, Data } from '@/types';
|
|
2
|
+
import got from '@/utils/got';
|
|
3
|
+
import { load } from 'cheerio';
|
|
4
|
+
import { processItems } from './utils';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
path: '/:category?',
|
|
8
|
+
categories: ['multimedia'],
|
|
9
|
+
example: '/chikubi',
|
|
10
|
+
parameters: { category: '分類,見下表,默認爲最新' },
|
|
11
|
+
features: {
|
|
12
|
+
requireConfig: false,
|
|
13
|
+
requirePuppeteer: false,
|
|
14
|
+
antiCrawler: false,
|
|
15
|
+
supportBT: false,
|
|
16
|
+
supportPodcast: false,
|
|
17
|
+
supportScihub: false,
|
|
18
|
+
},
|
|
19
|
+
name: 'Category',
|
|
20
|
+
maintainers: ['snowagar25'],
|
|
21
|
+
handler,
|
|
22
|
+
description: `| 最新 | 殿堂 | 動畫 | VR | 漫畫 | 音聲 | CG |
|
|
23
|
+
| ------ | ---- | ----- | -- | ----- | ----- | -- |
|
|
24
|
+
| (empty) | best | video | vr | comic | voice | cg |`,
|
|
25
|
+
radar: [
|
|
26
|
+
{
|
|
27
|
+
source: ['chikubi.jp/:category', 'chikubi.jp/'],
|
|
28
|
+
target: '/:category',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const categoryMap = {
|
|
34
|
+
'': { url: '/page/1', title: '最新', selector: '.article_list_area > article > a' },
|
|
35
|
+
best: { url: '/best-nipple-article', title: '殿堂', selector: '.article-list:first .title > a' },
|
|
36
|
+
video: { url: '/nipple-video', title: '動畫', selector: 'ul.video_list > li > a' },
|
|
37
|
+
vr: { url: '/nipple-video-category/cat-nipple-video-vr', title: 'VR', selector: 'ul.video_list > li > a' },
|
|
38
|
+
comic: { url: '/comic', title: '漫畫', selector: '.section:nth-of-type(2) .list-doujin .photo a' },
|
|
39
|
+
voice: { url: '/voice', title: '音聲', selector: 'ul.list-doujin > li > .photo > a' },
|
|
40
|
+
cg: { url: '/cg', title: 'CG', selector: 'ul.list-doujin > li > .photo > a' },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
async function handler(ctx): Promise<Data> {
|
|
44
|
+
const category = ctx.req.param('category') ?? '';
|
|
45
|
+
const baseUrl = 'https://chikubi.jp';
|
|
46
|
+
|
|
47
|
+
const { url, title, selector } = categoryMap[category];
|
|
48
|
+
|
|
49
|
+
const response = await got(`${baseUrl}${url}`);
|
|
50
|
+
const $ = load(response.data);
|
|
51
|
+
|
|
52
|
+
let list = $(selector)
|
|
53
|
+
.toArray()
|
|
54
|
+
.map((item) => {
|
|
55
|
+
const $item = $(item);
|
|
56
|
+
return {
|
|
57
|
+
title: $item.text().trim(),
|
|
58
|
+
link: new URL($item.attr('href') ?? '', baseUrl).href,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// 限制殿堂最多獲取30個
|
|
63
|
+
if (category === 'best') {
|
|
64
|
+
list = list.slice(0, 30);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 獲取內文
|
|
68
|
+
const items = await processItems(list);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
title: `${title} - chikubi.jp`,
|
|
72
|
+
link: `${baseUrl}${url}`,
|
|
73
|
+
item: items,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DataItem } from '@/types';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
3
|
+
import got from '@/utils/got';
|
|
4
|
+
import { load } from 'cheerio';
|
|
5
|
+
import { parseDate } from '@/utils/parse-date';
|
|
6
|
+
|
|
7
|
+
interface ListItem {
|
|
8
|
+
title: string;
|
|
9
|
+
link: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ContentSelectors {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const contentTypes: Record<string, ContentSelectors> = {
|
|
18
|
+
doujin: {
|
|
19
|
+
title: '.doujin-title',
|
|
20
|
+
description: ['.doujin-detail', '.section', '.area-buy > a.btn'],
|
|
21
|
+
},
|
|
22
|
+
video: {
|
|
23
|
+
title: '.video-title',
|
|
24
|
+
description: ['.video-data', '.section', '.lp-samplearea a.btn'],
|
|
25
|
+
},
|
|
26
|
+
article: {
|
|
27
|
+
title: '.article_title',
|
|
28
|
+
description: ['.article_icatch', '.article_contents'],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function getContentType(link: string): keyof typeof contentTypes {
|
|
33
|
+
const typePatterns = {
|
|
34
|
+
doujin: ['/cg/', '/comic/', '/voice/'],
|
|
35
|
+
video: ['/nipple-video/'],
|
|
36
|
+
article: ['/post-'],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
for (const [type, patterns] of Object.entries(typePatterns)) {
|
|
40
|
+
if (patterns.some((pattern) => link.includes(pattern))) {
|
|
41
|
+
return type as keyof typeof contentTypes;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw new Error(`Unknown content type for link: ${link}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function processItems(list: ListItem[]): Promise<DataItem[]> {
|
|
49
|
+
const items = await Promise.all(
|
|
50
|
+
list.map((item) =>
|
|
51
|
+
cache.tryGet(item.link, async () => {
|
|
52
|
+
const detailResponse = await got(item.link);
|
|
53
|
+
const $ = load(detailResponse.data);
|
|
54
|
+
|
|
55
|
+
const contentType = getContentType(item.link);
|
|
56
|
+
const selectors = contentTypes[contentType];
|
|
57
|
+
|
|
58
|
+
const title = $(selectors.title).text().trim() || item.title;
|
|
59
|
+
const description = selectors.description
|
|
60
|
+
.map((selector) =>
|
|
61
|
+
$(selector)
|
|
62
|
+
.map((_, el) => $(el).clone().wrap('<div>').parent().html())
|
|
63
|
+
.toArray()
|
|
64
|
+
.join('')
|
|
65
|
+
)
|
|
66
|
+
.join('');
|
|
67
|
+
|
|
68
|
+
const pubDateStr = $('meta[property="article:published_time"]').attr('content');
|
|
69
|
+
const pubDate = pubDateStr ? parseDate(pubDateStr) : undefined;
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
title,
|
|
73
|
+
description,
|
|
74
|
+
link: item.link,
|
|
75
|
+
pubDate,
|
|
76
|
+
} as DataItem;
|
|
77
|
+
})
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return items.filter((item): item is DataItem => item !== null);
|
|
82
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Route, ViewType } from '@/types';
|
|
2
|
+
import got from '@/utils/got';
|
|
3
|
+
import MarkdownIt from 'markdown-it';
|
|
4
|
+
const md = MarkdownIt({
|
|
5
|
+
html: true,
|
|
6
|
+
linkify: true,
|
|
7
|
+
});
|
|
8
|
+
import { parseDate } from '@/utils/parse-date';
|
|
9
|
+
|
|
10
|
+
export const route: Route = {
|
|
11
|
+
path: '/',
|
|
12
|
+
categories: ['other'],
|
|
13
|
+
view: ViewType.Notifications,
|
|
14
|
+
example: '/easynomad',
|
|
15
|
+
radar: [
|
|
16
|
+
{
|
|
17
|
+
source: ['easynomad.cn'],
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
name: '远程工作列表',
|
|
21
|
+
maintainers: ['jiangsong216'],
|
|
22
|
+
handler,
|
|
23
|
+
|
|
24
|
+
features: {
|
|
25
|
+
requireConfig: false,
|
|
26
|
+
requirePuppeteer: false,
|
|
27
|
+
antiCrawler: false,
|
|
28
|
+
supportBT: false,
|
|
29
|
+
supportPodcast: false,
|
|
30
|
+
supportScihub: false,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
async function handler() {
|
|
35
|
+
const host = 'https://easynomad.cn';
|
|
36
|
+
const url = 'https://easynomad.cn/api/posts/list?limit=15&page=1&jobCategory=&contractType=';
|
|
37
|
+
const response = await got({
|
|
38
|
+
method: 'get',
|
|
39
|
+
url,
|
|
40
|
+
});
|
|
41
|
+
const data = response.data.data;
|
|
42
|
+
|
|
43
|
+
const items = data.map((item) => ({
|
|
44
|
+
title: item.jobTitle,
|
|
45
|
+
description: item.descContent ? md.render(item.descContent) : 'No description',
|
|
46
|
+
pubDate: parseDate(item.jobPublishTime),
|
|
47
|
+
link: item.url,
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
title: '轻松游牧-远程工作聚合列表',
|
|
52
|
+
description: '支持国内远程的招聘列表,远程全职,远程兼职',
|
|
53
|
+
link: host,
|
|
54
|
+
item: items,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Data, Route } from '@/types';
|
|
2
|
+
import type { Context } from 'hono';
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
|
+
import type { FollowResponse, Profile, Subscription } from './types';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
name: 'User subscriptions',
|
|
8
|
+
path: '/profile/:uid',
|
|
9
|
+
example: '/profile/41279032429549568',
|
|
10
|
+
radar: [
|
|
11
|
+
{
|
|
12
|
+
source: ['app.follow.is/profile/:uid'],
|
|
13
|
+
target: '/profile/:uid',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
handler,
|
|
17
|
+
maintainers: ['KarasuShin'],
|
|
18
|
+
features: {
|
|
19
|
+
supportRadar: true,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
async function handler(ctx: Context): Promise<Data> {
|
|
24
|
+
const uid = ctx.req.param('uid');
|
|
25
|
+
const host = 'https://api.follow.is';
|
|
26
|
+
|
|
27
|
+
const [profile, subscriptions] = await Promise.all([ofetch<FollowResponse<Profile>>(`${host}/profiles?id=${uid}`), ofetch<FollowResponse<Subscription[]>>(`${host}/subscriptions?userId=${uid}`)]);
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
title: `${profile.data.name} - User subscriptions`,
|
|
31
|
+
item: subscriptions.data.map((subscription) => ({
|
|
32
|
+
title: subscription.feeds.title,
|
|
33
|
+
description: subscription.feeds.description,
|
|
34
|
+
link: `https://app.follow.is/feed/${subscription.feedId}`,
|
|
35
|
+
})),
|
|
36
|
+
link: `https://app.follow.is/profile/${uid}`,
|
|
37
|
+
image: profile.data.image,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface FollowResponse<T> {
|
|
2
|
+
code: number;
|
|
3
|
+
data: T;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface Subscription {
|
|
7
|
+
category: string;
|
|
8
|
+
feedId: string;
|
|
9
|
+
feeds: {
|
|
10
|
+
checkAt: string;
|
|
11
|
+
description: string;
|
|
12
|
+
errorAt: unknown;
|
|
13
|
+
errorMessage: unknown;
|
|
14
|
+
etagHeader: string;
|
|
15
|
+
id: string;
|
|
16
|
+
image: unknown;
|
|
17
|
+
lastModifiedHeader: string;
|
|
18
|
+
ownerUserId: string | null;
|
|
19
|
+
siteUrl: string;
|
|
20
|
+
title: string;
|
|
21
|
+
ttl: number;
|
|
22
|
+
url: string;
|
|
23
|
+
};
|
|
24
|
+
isPrivate: boolean;
|
|
25
|
+
title: string | null;
|
|
26
|
+
userId: string;
|
|
27
|
+
view: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Profile {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
email: string;
|
|
34
|
+
emailVerified: unknown;
|
|
35
|
+
image: string;
|
|
36
|
+
handle: unknown;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
}
|
|
@@ -45,7 +45,7 @@ export const route: Route = {
|
|
|
45
45
|
item: feed.items.map((item) => ({
|
|
46
46
|
title: item.title ?? '',
|
|
47
47
|
link: item.link,
|
|
48
|
-
description: sanitizeHtml(item.content?.replace(/href="(.+?)"/g, `href="https://github.com
|
|
48
|
+
description: sanitizeHtml(item.content?.replace(/href="\/(.+?)"/g, `href="https://github.com/$1"`) ?? '', { allowedTags: [...sanitizeHtml.defaults.allowedTags, 'img'] }),
|
|
49
49
|
pubDate: item.pubDate ? parseDate(item.pubDate) : undefined,
|
|
50
50
|
author: item.author,
|
|
51
51
|
guid: item.id,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
|
|
3
|
+
import got from '@/utils/got';
|
|
4
|
+
import { load } from 'cheerio';
|
|
5
|
+
|
|
6
|
+
export const handler = async (ctx) => {
|
|
7
|
+
const { category = 'stf/seisakunitsuite/bunya/houkokusuunosuii' } = ctx.req.param();
|
|
8
|
+
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
|
9
|
+
|
|
10
|
+
const rootUrl = 'https://www.mhlw.go.jp';
|
|
11
|
+
const currentUrl = new URL(category.endsWith('.html') ? category : `${category}.html`, rootUrl).href;
|
|
12
|
+
|
|
13
|
+
const { data: response } = await got(currentUrl);
|
|
14
|
+
|
|
15
|
+
const $ = load(response);
|
|
16
|
+
|
|
17
|
+
const language = $('html').prop('lang');
|
|
18
|
+
|
|
19
|
+
const items = $('a[data-icon="pdf"]')
|
|
20
|
+
.slice(0, limit)
|
|
21
|
+
.toArray()
|
|
22
|
+
.map((item) => {
|
|
23
|
+
item = $(item);
|
|
24
|
+
|
|
25
|
+
const title = item.find('font').text() || item.text();
|
|
26
|
+
const link = new URL(item.prop('href'), rootUrl).href;
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
title,
|
|
30
|
+
link,
|
|
31
|
+
language,
|
|
32
|
+
enclosure_url: link,
|
|
33
|
+
enclosure_type: link ? 'application/pdf' : undefined,
|
|
34
|
+
enclosure_title: title,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const image = new URL($('div.m-headerLogo img').first().prop('src'), rootUrl).href;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
title: $('title').text(),
|
|
42
|
+
description: $('meta[property="og:description"]').prop('content'),
|
|
43
|
+
link: currentUrl,
|
|
44
|
+
item: items,
|
|
45
|
+
allowEmpty: true,
|
|
46
|
+
image,
|
|
47
|
+
author: $('meta[property="og:site_name"]').prop('content'),
|
|
48
|
+
language,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const route: Route = {
|
|
53
|
+
path: '/mhlw/pdf/:category{.+}?',
|
|
54
|
+
name: 'PDF',
|
|
55
|
+
url: 'www.mhlw.go.jp',
|
|
56
|
+
maintainers: ['nczitzk'],
|
|
57
|
+
handler,
|
|
58
|
+
example: '/go/mhlw/pdf/stf/seisakunitsuite/bunya/houkokusuunosuii',
|
|
59
|
+
parameters: { category: 'Category, `stf/seisakunitsuite/bunya/houkokusuunosuii` as 新型コロナウイルス感染症の定点当たり報告数の推移 by default' },
|
|
60
|
+
description: `:::tip
|
|
61
|
+
Subscribing to this route will give you access to all PDF files on this page.
|
|
62
|
+
|
|
63
|
+
If you subscribe to [新型コロナウイルス感染症の定点当たり報告数の推移](https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/houkokusuunosuii.html),where the URL is \`https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/houkokusuunosuii.html\`, extract the part \`https://www.mhlw.go.jp/\` to the end, which is \`.html\`, and use it as the parameter to fill in. Therefore, the route will be [\`/go/mhlw/stf/seisakunitsuite/bunya/houkokusuunosuii\`](https://rsshub.app/go/mhlw/stf/seisakunitsuite/bunya/houkokusuunosuii).
|
|
64
|
+
:::
|
|
65
|
+
`,
|
|
66
|
+
categories: ['government'],
|
|
67
|
+
|
|
68
|
+
features: {
|
|
69
|
+
requireConfig: false,
|
|
70
|
+
requirePuppeteer: false,
|
|
71
|
+
antiCrawler: false,
|
|
72
|
+
supportRadar: true,
|
|
73
|
+
supportBT: false,
|
|
74
|
+
supportPodcast: false,
|
|
75
|
+
supportScihub: false,
|
|
76
|
+
},
|
|
77
|
+
radar: [
|
|
78
|
+
{
|
|
79
|
+
source: ['www.mhlw.go.jp'],
|
|
80
|
+
target: (_, url) => {
|
|
81
|
+
const category = new URL(url).href.match(/mhlw\.go\.jp\/(.*)$/)?.[1] ?? undefined;
|
|
82
|
+
|
|
83
|
+
return `/mhlw/pdf${category ? `/${category}` : ''}`;
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Data, DataItem, Route } from '@/types';
|
|
2
|
+
import { load } from 'cheerio';
|
|
3
|
+
import type { Context } from 'hono';
|
|
4
|
+
import ofetch from '@/utils/ofetch';
|
|
5
|
+
import cache from '@/utils/cache';
|
|
6
|
+
import type { NextDataEpisode } from './types';
|
|
7
|
+
import { parseDate } from '@/utils/parse-date';
|
|
8
|
+
|
|
9
|
+
export const route: Route = {
|
|
10
|
+
name: '投稿',
|
|
11
|
+
categories: ['reading'],
|
|
12
|
+
path: '/works/:id',
|
|
13
|
+
example: '/kakuyomu/works/1177354054894027232',
|
|
14
|
+
parameters: {
|
|
15
|
+
id: '投稿 ID',
|
|
16
|
+
},
|
|
17
|
+
maintainers: ['KarasuShin'],
|
|
18
|
+
handler,
|
|
19
|
+
features: {
|
|
20
|
+
supportRadar: true,
|
|
21
|
+
},
|
|
22
|
+
radar: [
|
|
23
|
+
{
|
|
24
|
+
source: ['kakuyomu.jp/works/:id'],
|
|
25
|
+
target: '/works/:id',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
async function handler(ctx: Context): Promise<Data> {
|
|
31
|
+
const id = ctx.req.param('id');
|
|
32
|
+
const url = `https://kakuyomu.jp/works/${id}`;
|
|
33
|
+
const limit = Number.parseInt(ctx.req.query('limit') || '10');
|
|
34
|
+
const $ = load(await ofetch(url));
|
|
35
|
+
|
|
36
|
+
const nextData = JSON.parse($('#__NEXT_DATA__').text());
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
props: {
|
|
40
|
+
pageProps: { __APOLLO_STATE__ },
|
|
41
|
+
},
|
|
42
|
+
} = nextData;
|
|
43
|
+
|
|
44
|
+
const {
|
|
45
|
+
[`Work:${id}`]: { title, catchphrase },
|
|
46
|
+
} = __APOLLO_STATE__;
|
|
47
|
+
|
|
48
|
+
const values = Object.values(__APOLLO_STATE__);
|
|
49
|
+
const episodes = values.filter((value) => value.__typename === 'Episode') as NextDataEpisode[];
|
|
50
|
+
const items = (await Promise.all(
|
|
51
|
+
episodes
|
|
52
|
+
.sort((a, b) => b.publishedAt.localeCompare(a.publishedAt))
|
|
53
|
+
.slice(0, limit)
|
|
54
|
+
.map((item) => {
|
|
55
|
+
const episodeUrl = `https://kakuyomu.jp/works/${id}/episodes/${item.id}`;
|
|
56
|
+
return cache.tryGet(episodeUrl, async () => {
|
|
57
|
+
const $ = load(await ofetch(episodeUrl));
|
|
58
|
+
const description = $('.widget-episodeBody').html();
|
|
59
|
+
return {
|
|
60
|
+
title: item.title,
|
|
61
|
+
description,
|
|
62
|
+
pubDate: parseDate(item.publishedAt),
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
})
|
|
66
|
+
)) as DataItem[];
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
title,
|
|
70
|
+
description: catchphrase,
|
|
71
|
+
item: items,
|
|
72
|
+
};
|
|
73
|
+
}
|
package/lib/routes/rss3/index.ts
CHANGED
|
@@ -140,7 +140,7 @@ async function handler(ctx) {
|
|
|
140
140
|
const description = `New ${item.tag} ${item.type} action on ${item.network}<br /><br />From: ${item.from}<br/>To: ${item.to}`;
|
|
141
141
|
return {
|
|
142
142
|
title: `New ${item.tag} ${item.type} action on ${item.network}`,
|
|
143
|
-
description: content
|
|
143
|
+
description: content ?? description,
|
|
144
144
|
link: item.actions?.[0]?.related_urls?.[0],
|
|
145
145
|
guid: item.id,
|
|
146
146
|
author: [
|
package/lib/routes/samd/news.ts
CHANGED
|
@@ -8,7 +8,7 @@ import ofetch from '@/utils/ofetch';
|
|
|
8
8
|
const dict = { '434': '行业资讯', '436': '协会动态', '438': '重要通知', '440': '政策法规' };
|
|
9
9
|
|
|
10
10
|
export const route: Route = {
|
|
11
|
-
path: 'news/:typeId',
|
|
11
|
+
path: '/news/:typeId',
|
|
12
12
|
categories: ['government'],
|
|
13
13
|
example: '/samd/news/440',
|
|
14
14
|
parameters: { type: '文章类型ID,见下表' },
|
|
@@ -42,15 +42,16 @@ async function handler(ctx) {
|
|
|
42
42
|
collect,
|
|
43
43
|
} = await getUser(url, cache);
|
|
44
44
|
|
|
45
|
-
const title = `${basicInfo.nickname} -
|
|
45
|
+
const title = `${basicInfo.nickname} - 小红书${category === 'notes' ? '笔记' : '收藏'}`;
|
|
46
46
|
const description = `${basicInfo.desc} ${tags.map((t) => t.name).join(' ')} ${interactions.map((i) => `${i.count} ${i.name}`).join(' ')}`;
|
|
47
47
|
const image = basicInfo.imageb || basicInfo.images;
|
|
48
48
|
|
|
49
49
|
const renderNote = (notes) =>
|
|
50
50
|
notes.flatMap((n) =>
|
|
51
|
-
n.map(({ noteCard }) => ({
|
|
51
|
+
n.map(({ id, noteCard }) => ({
|
|
52
52
|
title: noteCard.displayTitle,
|
|
53
|
-
link: `${url}/${noteCard.noteId}`,
|
|
53
|
+
link: `${url}/${noteCard.noteId || id}`,
|
|
54
|
+
guid: noteCard.noteId || id || noteCard.displayTitle,
|
|
54
55
|
description: `<img src ="${noteCard.cover.infoList.pop().url}"><br>${noteCard.displayTitle}`,
|
|
55
56
|
author: noteCard.user.nickname,
|
|
56
57
|
upvotes: noteCard.interactInfo.likedCount,
|
|
@@ -7,7 +7,9 @@ const getUser = (url, cache) =>
|
|
|
7
7
|
cache.tryGet(
|
|
8
8
|
url,
|
|
9
9
|
async () => {
|
|
10
|
-
const browser = await puppeteer(
|
|
10
|
+
const browser = await puppeteer({
|
|
11
|
+
stealth: true,
|
|
12
|
+
});
|
|
11
13
|
try {
|
|
12
14
|
const page = await browser.newPage();
|
|
13
15
|
await page.setRequestInterception(true);
|
|
@@ -70,8 +70,12 @@ export const getSignedHeader = async (url: string, apiPath: string) => {
|
|
|
70
70
|
|
|
71
71
|
// fisrt: get cookie(dc_0) from zhihu.com
|
|
72
72
|
const dc0 = await cache.tryGet('zhihu:cookies:d_c0', async () => {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
if (getCookieValueByKey('d_c0')) {
|
|
74
|
+
return getCookieValueByKey('d_c0');
|
|
75
|
+
}
|
|
76
|
+
const response1 = await ofetch.raw('https://static.zhihu.com/zse-ck/v3.js');
|
|
77
|
+
const script = await response1._data.text();
|
|
78
|
+
const zseCk = script.match(/__g\.ck\|\|"([\w+/=\\]*?)",_=630e8;/)?.[1];
|
|
75
79
|
|
|
76
80
|
const response2 = zseCk
|
|
77
81
|
? await ofetch.raw(url, {
|
package/lib/views/json.ts
CHANGED
|
@@ -21,7 +21,7 @@ const json = (data: Data) => {
|
|
|
21
21
|
title: item.title,
|
|
22
22
|
content_html: (item.content && item.content.html) || item.description || item.title,
|
|
23
23
|
content_text: item.content && item.content.text,
|
|
24
|
-
image: item.image,
|
|
24
|
+
image: item.image || item.itunes_item_image,
|
|
25
25
|
banner_image: item.banner,
|
|
26
26
|
date_published: item.pubDate,
|
|
27
27
|
date_modified: item.updated,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsshub",
|
|
3
|
-
"version": "1.0.0-master.
|
|
3
|
+
"version": "1.0.0-master.d8b7aae",
|
|
4
4
|
"description": "Make RSS Great Again!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"RSS"
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"@opentelemetry/sdk-trace-base": "1.26.0",
|
|
44
44
|
"@opentelemetry/semantic-conventions": "1.27.0",
|
|
45
45
|
"@postlight/parser": "2.2.3",
|
|
46
|
-
"@rss3/sdk": "0.0.
|
|
47
|
-
"@scalar/hono-api-reference": "0.5.
|
|
46
|
+
"@rss3/sdk": "0.0.17",
|
|
47
|
+
"@scalar/hono-api-reference": "0.5.145",
|
|
48
48
|
"@sentry/node": "7.116.0",
|
|
49
|
-
"@tonyrl/rand-user-agent": "2.0.
|
|
49
|
+
"@tonyrl/rand-user-agent": "2.0.77",
|
|
50
50
|
"aes-js": "3.1.2",
|
|
51
51
|
"art-template": "4.13.2",
|
|
52
52
|
"bbcodejs": "0.0.4",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"telegram": "2.24.11",
|
|
106
106
|
"tiny-async-pool": "2.1.0",
|
|
107
107
|
"title": "3.5.3",
|
|
108
|
-
"tldts": "6.1.
|
|
108
|
+
"tldts": "6.1.44",
|
|
109
109
|
"tosource": "2.0.0-alpha.3",
|
|
110
110
|
"tough-cookie": "4.1.4",
|
|
111
111
|
"tsx": "4.19.0",
|
|
@@ -120,9 +120,9 @@
|
|
|
120
120
|
"@babel/preset-env": "7.25.4",
|
|
121
121
|
"@babel/preset-typescript": "7.24.7",
|
|
122
122
|
"@eslint/eslintrc": "3.1.0",
|
|
123
|
-
"@eslint/js": "9.
|
|
123
|
+
"@eslint/js": "9.10.0",
|
|
124
124
|
"@microsoft/eslint-formatter-sarif": "3.1.0",
|
|
125
|
-
"@stylistic/eslint-plugin": "2.
|
|
125
|
+
"@stylistic/eslint-plugin": "2.8.0",
|
|
126
126
|
"@types/aes-js": "3.1.4",
|
|
127
127
|
"@types/babel__preset-env": "7.9.7",
|
|
128
128
|
"@types/crypto-js": "4.2.2",
|
|
@@ -146,12 +146,12 @@
|
|
|
146
146
|
"@types/title": "3.4.3",
|
|
147
147
|
"@types/tough-cookie": "4.0.5",
|
|
148
148
|
"@types/uuid": "10.0.0",
|
|
149
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
150
|
-
"@typescript-eslint/parser": "8.
|
|
149
|
+
"@typescript-eslint/eslint-plugin": "8.5.0",
|
|
150
|
+
"@typescript-eslint/parser": "8.5.0",
|
|
151
151
|
"@vercel/nft": "0.27.4",
|
|
152
152
|
"@vitest/coverage-v8": "2.0.5",
|
|
153
153
|
"discord-api-types": "0.37.100",
|
|
154
|
-
"eslint": "9.
|
|
154
|
+
"eslint": "9.10.0",
|
|
155
155
|
"eslint-config-prettier": "9.1.0",
|
|
156
156
|
"eslint-nibble": "8.1.0",
|
|
157
157
|
"eslint-plugin-n": "17.10.2",
|
|
@@ -165,11 +165,11 @@
|
|
|
165
165
|
"js-beautify": "1.15.1",
|
|
166
166
|
"lint-staged": "15.2.10",
|
|
167
167
|
"mockdate": "3.0.5",
|
|
168
|
-
"msw": "2.4.
|
|
168
|
+
"msw": "2.4.3",
|
|
169
169
|
"prettier": "3.3.3",
|
|
170
170
|
"remark-parse": "11.0.0",
|
|
171
171
|
"supertest": "7.0.0",
|
|
172
|
-
"typescript": "5.
|
|
172
|
+
"typescript": "5.6.2",
|
|
173
173
|
"unified": "11.0.5",
|
|
174
174
|
"vite-tsconfig-paths": "5.0.1",
|
|
175
175
|
"vitest": "2.0.5",
|