rsshub 1.0.0-master.f72af1b → 1.0.0-master.f7347d9
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 +18 -0
- package/lib/middleware/template.tsx +10 -2
- package/lib/routes/163/music/playlist.ts +2 -1
- package/lib/routes/5eplay/index.ts +1 -51
- package/lib/routes/a9vg/index.ts +214 -0
- package/lib/routes/a9vg/namespace.ts +1 -0
- package/lib/routes/a9vg/templates/description.art +17 -0
- package/lib/routes/aibase/discover.ts +388 -0
- package/lib/routes/aibase/namespace.ts +8 -0
- package/lib/routes/aibase/news.ts +118 -0
- package/lib/routes/aibase/templates/description.art +100 -0
- package/lib/routes/aibase/topic.ts +614 -0
- package/lib/routes/aibase/util.ts +114 -0
- package/lib/routes/apnews/api.ts +18 -3
- package/lib/routes/apnews/rss.ts +1 -1
- package/lib/routes/apnews/topics.ts +4 -3
- package/lib/routes/apple/podcast.ts +19 -15
- package/lib/routes/bangumi/templates/tv/subject.art +6 -0
- package/lib/routes/bangumi/tv/other/followrank.ts +19 -22
- package/lib/routes/bangumi/tv/user/collections.ts +172 -0
- package/lib/routes/bilibili/cache.ts +16 -8
- package/lib/routes/bilibili/utils.ts +85 -3
- package/lib/routes/bilibili/video.ts +7 -9
- package/lib/routes/bilibili/vsearch.ts +1 -1
- package/lib/routes/bjnews/cat.ts +9 -1
- package/lib/routes/cbpanet/index.ts +380 -0
- package/lib/routes/cbpanet/namespace.ts +8 -0
- package/lib/routes/ceph/blog.ts +72 -0
- package/lib/routes/ceph/namespace.ts +7 -0
- package/lib/routes/chinanews/index.ts +1 -1
- package/lib/routes/chinaventure/index.ts +1 -1
- package/lib/routes/cisia/index.ts +264 -0
- package/lib/routes/cisia/namespace.ts +8 -0
- package/lib/routes/cjlu/namespace.ts +10 -0
- package/lib/routes/cjlu/yjsy/index.ts +107 -0
- package/lib/routes/cnki/journals.ts +31 -2
- package/lib/routes/cohere/index.ts +54 -0
- package/lib/routes/cohere/namespace.ts +6 -0
- package/lib/routes/coolapk/dyh.ts +7 -1
- package/lib/routes/coolapk/hot.ts +7 -1
- package/lib/routes/coolapk/huati.ts +7 -1
- package/lib/routes/coolapk/namespace.ts +6 -0
- package/lib/routes/coolapk/toutiao.ts +7 -1
- package/lib/routes/coolapk/tuwen.ts +10 -5
- package/lib/routes/coolapk/user-dynamic.ts +7 -1
- package/lib/routes/damai/activity.ts +3 -2
- package/lib/routes/dcfever/trading.ts +3 -5
- package/lib/routes/dcfever/utils.ts +13 -4
- package/lib/routes/dealstreetasia/home.ts +72 -0
- package/lib/routes/dealstreetasia/namespace.ts +6 -0
- package/lib/routes/dealstreetasia/section.ts +57 -0
- package/lib/routes/dlsite/campaign.ts +1 -2
- package/lib/routes/dlsite/new.ts +1 -2
- package/lib/routes/dlsite/{index.ts → z-index/index.ts} +1 -1
- package/lib/routes/douban/other/topic.ts +10 -4
- package/lib/routes/douyin/types.ts +795 -0
- package/lib/routes/douyin/user.ts +51 -23
- package/lib/routes/douyin/utils.ts +1 -87
- package/lib/routes/dribbble/keyword.ts +1 -1
- package/lib/routes/dribbble/popular.ts +1 -1
- package/lib/routes/dribbble/user.ts +1 -1
- package/lib/routes/dribbble/utils.ts +16 -18
- package/lib/routes/famitsu/category.ts +1 -1
- package/lib/routes/fanbox/index.ts +1 -1
- package/lib/routes/fanbox/types.ts +1 -5
- package/lib/routes/fediverse/timeline.ts +21 -3
- package/lib/routes/follow/profile.ts +4 -2
- package/lib/routes/follow/types.ts +11 -1
- package/lib/routes/github/advisor.ts +97 -0
- package/lib/routes/github/discussions.ts +194 -0
- package/lib/routes/github/issue.ts +1 -1
- package/lib/routes/github/pulls.ts +1 -1
- package/lib/routes/gmcmonline/chinacustoms.ts +130 -0
- package/lib/routes/gmcmonline/namespace.ts +8 -0
- package/lib/routes/gov/csrc/csrc.ts +541 -0
- package/lib/routes/gov/customs/list.ts +5 -2
- package/lib/routes/gov/customs/namespace.ts +7 -0
- package/lib/routes/gov/jgjcndrc/index.ts +95 -66
- package/lib/routes/gov/moa/moa.ts +3 -3
- package/lib/routes/gov/moa/szcpxx.ts +115 -0
- package/lib/routes/gov/moa/zdscxx.ts +71 -21
- package/lib/routes/gov/ndrc/zfxxgk.ts +106 -0
- package/lib/routes/gov/pudong/zwgk.ts +65 -0
- package/lib/routes/gov/zj/search.ts +17 -12
- package/lib/routes/guancha/member.ts +1 -1
- package/lib/routes/hellogithub/index.ts +17 -67
- package/lib/routes/hellogithub/report.ts +1 -1
- package/lib/routes/hex-rays/index.ts +23 -29
- package/lib/routes/hfut/hf/notice.ts +43 -0
- package/lib/routes/hfut/hf/utils.ts +80 -0
- package/lib/routes/hfut/namespace.ts +6 -0
- package/lib/routes/hfut/xc/notice.ts +43 -0
- package/lib/routes/hfut/xc/utils.ts +73 -0
- package/lib/routes/hko/earthquake.ts +56 -0
- package/lib/routes/hko/namespace.ts +8 -0
- package/lib/routes/hko/weather.ts +56 -0
- package/lib/routes/huggingface/blog-zh.ts +1 -1
- package/lib/routes/hust/mse.ts +575 -0
- package/lib/routes/i-cable/namespace.ts +6 -0
- package/lib/routes/i-cable/news.ts +77 -0
- package/lib/routes/i-cable/templates/description.art +8 -0
- package/lib/routes/infoq/presentations.ts +203 -0
- package/lib/routes/infoq/templates/description.art +41 -0
- package/lib/routes/ipsw.dev/index.ts +64 -0
- package/lib/routes/ipsw.dev/namespace.ts +7 -0
- package/lib/routes/ipsw.dev/templates/description.art +20 -0
- package/lib/routes/ixigua/user-video.ts +18 -7
- package/lib/routes/javtiful/actress.ts +37 -0
- package/lib/routes/javtiful/channel.ts +37 -0
- package/lib/routes/javtiful/namespace.ts +6 -0
- package/lib/routes/javtiful/templates/description.art +7 -0
- package/lib/routes/javtiful/utils.ts +18 -0
- package/lib/routes/kisskiss/blog.ts +74 -0
- package/lib/routes/kisskiss/namespace.ts +6 -0
- package/lib/routes/ktown4u/artist-brandlist.ts +61 -0
- package/lib/routes/ktown4u/namespace.ts +6 -0
- package/lib/routes/lorientlejour/index.ts +186 -0
- package/lib/routes/lorientlejour/namespace.ts +7 -0
- package/lib/routes/lorientlejour/templates/description.art +18 -0
- package/lib/routes/lovelive-anime/namespace.ts +1 -1
- package/lib/routes/lovelive-anime/news.ts +56 -26
- package/lib/routes/lovelive-anime/schedules.ts +18 -6
- package/lib/routes/lovelive-anime/templates/description.art +1 -1
- package/lib/routes/lovelive-anime/templates/scheduleDesc.art +0 -1
- package/lib/routes/lovelive-anime/topics.ts +1 -1
- package/lib/routes/manhuagui/comic.ts +1 -1
- package/lib/routes/mi/crowdfunding.ts +43 -22
- package/lib/routes/mi/templates/crowdfunding.art +28 -0
- package/lib/routes/mi/types.ts +40 -0
- package/lib/routes/mi/utils.ts +80 -0
- package/lib/routes/misskey/utils.ts +1 -0
- package/lib/routes/misskon/namespace.ts +6 -0
- package/lib/routes/misskon/posts.ts +33 -0
- package/lib/routes/misskon/tag.ts +38 -0
- package/lib/routes/misskon/top.ts +67 -0
- package/lib/routes/misskon/utils.ts +41 -0
- package/lib/routes/natgeo/dailyphoto.ts +1 -1
- package/lib/routes/natgeo/dailyselection.ts +1 -1
- package/lib/routes/ncku/namespace.ts +1 -1
- package/lib/routes/ncku/phys.ts +95 -0
- package/lib/routes/news/namespace.ts +1 -1
- package/lib/routes/nikkei/cn/index.ts +12 -1
- package/lib/routes/nudt/yjszs.ts +33 -13
- package/lib/routes/nytimes/book.ts +11 -11
- package/lib/routes/nytimes/daily-briefing-chinese.ts +4 -4
- package/lib/routes/nytimes/namespace.ts +1 -1
- package/lib/routes/oncc/templates/article.art +1 -1
- package/lib/routes/papers/index.ts +7 -1
- package/lib/routes/parliament.uk/commonslibrary.ts +55 -0
- package/lib/routes/parliament.uk/lordslibrary.ts +55 -0
- package/lib/routes/parliament.uk/namespace.ts +6 -0
- package/lib/routes/picuki/profile.ts +50 -39
- package/lib/routes/pornhub/model.ts +3 -5
- package/lib/routes/pornhub/pornstar.ts +3 -5
- package/lib/routes/pornhub/users.ts +3 -5
- package/lib/routes/resonac/namespace.ts +6 -0
- package/lib/routes/resonac/products.ts +85 -0
- package/lib/routes/rsshub/transform/html.ts +114 -75
- package/lib/routes/rsshub/transform/json.ts +14 -8
- package/lib/routes/sciencenet/user.ts +3 -1
- package/lib/routes/scmp/utils.ts +2 -2
- package/lib/routes/skeb/following-creators.ts +52 -0
- package/lib/routes/skeb/following-works.ts +52 -0
- package/lib/routes/skeb/friend-works.ts +52 -0
- package/lib/routes/skeb/index.ts +131 -0
- package/lib/routes/skeb/namespace.ts +6 -0
- package/lib/routes/skeb/search.ts +77 -0
- package/lib/routes/skeb/templates/creator.art +8 -0
- package/lib/routes/skeb/templates/work.art +10 -0
- package/lib/routes/skeb/utils.ts +155 -0
- package/lib/routes/skeb/works.ts +88 -0
- package/lib/routes/skebetter/illust.ts +83 -0
- package/lib/routes/skebetter/index.ts +83 -0
- package/lib/routes/skebetter/manga.ts +65 -0
- package/lib/routes/skebetter/namespace.ts +6 -0
- package/lib/routes/skebetter/utils.ts +72 -0
- package/lib/routes/spankbang/namespace.ts +6 -0
- package/lib/routes/spankbang/new-videos.ts +90 -0
- package/lib/routes/spankbang/templates/video.art +7 -0
- package/lib/routes/straitstimes/index.ts +135 -0
- package/lib/routes/straitstimes/namespace.ts +7 -0
- package/lib/routes/straitstimes/templates/description.art +27 -0
- package/lib/routes/szftedu/dongtai.ts +62 -0
- package/lib/routes/szftedu/gonggao.ts +62 -0
- package/lib/routes/szftedu/namespace.ts +6 -0
- package/lib/routes/the/index.ts +1 -1
- package/lib/routes/tkww/index.ts +83 -0
- package/lib/routes/tkww/namespace.ts +6 -0
- package/lib/routes/ttv/index.ts +1 -1
- package/lib/routes/tvb/news.ts +2 -1
- package/lib/routes/twitter/api/mobile-api/login.ts +5 -0
- package/lib/routes/twitter/api/web-api/api.ts +16 -10
- package/lib/routes/twitter/api/web-api/constants.ts +1 -1
- package/lib/routes/twitter/api/web-api/utils.ts +94 -56
- package/lib/routes/twitter/list.ts +4 -12
- package/lib/routes/twitter/media.ts +13 -4
- package/lib/routes/twitter/user.ts +15 -6
- package/lib/routes/udn/breaking-news.ts +2 -2
- package/lib/routes/uestc/gr.ts +65 -37
- package/lib/routes/uestc/jwc.ts +49 -28
- package/lib/routes/wechat/ershcimi.ts +4 -2
- package/lib/routes/weibo/user.ts +10 -2
- package/lib/routes/xaut/index.ts +13 -20
- package/lib/routes/xaut/namespace.ts +1 -1
- package/lib/routes/xbookcn/blog.ts +66 -0
- package/lib/routes/xbookcn/namespace.ts +6 -0
- package/lib/routes/xiaoyuzhou/podcast.ts +35 -7
- package/lib/routes/xueqiu/cookies.ts +5 -3
- package/lib/routes/xueqiu/stock-info.ts +6 -12
- package/lib/routes/yande/namespace.ts +1 -1
- package/lib/routes/yande/post.ts +6 -6
- package/lib/routes/zaobao/util.ts +41 -43
- package/lib/routes/zhihu/activities.ts +2 -1
- package/lib/routes/zhihu/timeline.ts +6 -1
- package/lib/routes/zhihu/utils.ts +1 -1
- package/lib/routes/zjut/cs/index.ts +105 -0
- package/lib/routes/zjut/jwc/index.ts +117 -0
- package/lib/utils/cache/redis.ts +1 -1
- package/package.json +35 -36
- package/lib/routes/a9vg/a9vg.ts +0 -45
- package/lib/routes/gov/ndrc/zfxxgk/articles.ts +0 -73
- package/lib/routes-deprecated/hko/weather.js +0 -44
package/lib/routes/uestc/gr.ts
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
|
-
import { Route } from '@/types';
|
|
1
|
+
import { Data, DataItem, Route } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
|
-
import
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
4
|
import { load } from 'cheerio';
|
|
5
5
|
import { parseDate } from '@/utils/parse-date';
|
|
6
|
+
import timezone from '@/utils/timezone';
|
|
7
|
+
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
|
8
|
+
import type { Context } from 'hono';
|
|
6
9
|
|
|
7
|
-
const baseUrl = 'https://gr.uestc.edu.cn/
|
|
8
|
-
const
|
|
10
|
+
const baseUrl = 'https://gr.uestc.edu.cn/';
|
|
11
|
+
const detailUrl = 'https://gr.uestc.edu.cn/';
|
|
12
|
+
|
|
13
|
+
const dateTimeRegex = /(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/;
|
|
14
|
+
|
|
15
|
+
const typeUrlMap = {
|
|
16
|
+
important: 'tongzhi/',
|
|
17
|
+
teaching: 'tongzhi/119',
|
|
18
|
+
degree: 'tongzhi/129',
|
|
19
|
+
student: 'tongzhi/122',
|
|
20
|
+
practice: 'tongzhi/123',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const typeNameMap = {
|
|
24
|
+
important: '重要公告',
|
|
25
|
+
teaching: '教学管理',
|
|
26
|
+
degree: '学位管理',
|
|
27
|
+
student: '学生管理',
|
|
28
|
+
practice: '就业实践',
|
|
29
|
+
};
|
|
9
30
|
|
|
10
31
|
export const route: Route = {
|
|
11
|
-
path: '/gr',
|
|
32
|
+
path: '/gr/:type?',
|
|
12
33
|
categories: ['university'],
|
|
13
|
-
example: '/uestc/gr',
|
|
14
|
-
parameters: {},
|
|
34
|
+
example: '/uestc/gr/student',
|
|
35
|
+
parameters: { type: '默认为 `important`' },
|
|
15
36
|
features: {
|
|
16
37
|
requireConfig: false,
|
|
17
38
|
requirePuppeteer: false,
|
|
@@ -29,46 +50,53 @@ export const route: Route = {
|
|
|
29
50
|
maintainers: ['huyyi', 'mobyw'],
|
|
30
51
|
handler,
|
|
31
52
|
url: 'gr.uestc.edu.cn/',
|
|
53
|
+
description: `\
|
|
54
|
+
| 重要公告 | 教学管理 | 学位管理 | 学生管理 | 就业实践 |
|
|
55
|
+
| --------- | -------- | -------- | -------- | -------- |
|
|
56
|
+
| important | teaching | degree | student | practice |`,
|
|
32
57
|
};
|
|
33
58
|
|
|
34
|
-
async function handler() {
|
|
35
|
-
const
|
|
59
|
+
async function handler(ctx: Context): Promise<Data> {
|
|
60
|
+
const type = ctx.req.param('type') || 'important';
|
|
61
|
+
if (type in typeUrlMap === false) {
|
|
62
|
+
throw new InvalidParameterError('type not supported');
|
|
63
|
+
}
|
|
64
|
+
const typeName = typeNameMap[type];
|
|
36
65
|
|
|
37
|
-
const
|
|
66
|
+
const indexContent = await ofetch(baseUrl + typeUrlMap[type]);
|
|
38
67
|
|
|
39
|
-
const
|
|
40
|
-
$('
|
|
41
|
-
|
|
42
|
-
|
|
68
|
+
const $ = load(indexContent);
|
|
69
|
+
const entries = $('div.title').toArray();
|
|
70
|
+
|
|
71
|
+
const items = entries.map(async (entry) => {
|
|
72
|
+
const element = $(entry);
|
|
73
|
+
const newsTitle = element.find('a').text() ?? '';
|
|
74
|
+
const newsLink = detailUrl + element.find('a').attr('href');
|
|
43
75
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
const result = await got.get(newsUrl);
|
|
76
|
+
const newsDetail = await cache.tryGet(newsLink, async () => {
|
|
77
|
+
const newsContent = await ofetch(newsLink);
|
|
78
|
+
const content = load(newsContent);
|
|
48
79
|
|
|
49
|
-
|
|
80
|
+
const basicInfo = content('div.topic_detail_header').find('div.info').text();
|
|
81
|
+
const match = dateTimeRegex.exec(basicInfo);
|
|
50
82
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
83
|
+
return {
|
|
84
|
+
title: newsTitle,
|
|
85
|
+
link: newsLink,
|
|
86
|
+
pubDate: match ? timezone(parseDate(match[1]), +8) : null,
|
|
87
|
+
description: content('div.content').html(),
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return newsDetail;
|
|
92
|
+
});
|
|
55
93
|
|
|
56
|
-
|
|
57
|
-
title,
|
|
58
|
-
link: newsUrl,
|
|
59
|
-
author,
|
|
60
|
-
pubDate: date,
|
|
61
|
-
description,
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
return newsDetail;
|
|
65
|
-
})
|
|
66
|
-
);
|
|
94
|
+
const out = await Promise.all(items);
|
|
67
95
|
|
|
68
96
|
return {
|
|
69
|
-
title:
|
|
97
|
+
title: `研究生院通知(${typeName})`,
|
|
70
98
|
link: baseUrl,
|
|
71
|
-
description:
|
|
72
|
-
item: out,
|
|
99
|
+
description: `电子科技大学研究生院通知(${typeName})`,
|
|
100
|
+
item: out as DataItem[],
|
|
73
101
|
};
|
|
74
102
|
}
|
package/lib/routes/uestc/jwc.ts
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
import { Route } from '@/types';
|
|
2
|
-
import
|
|
1
|
+
import { Data, DataItem, Route } from '@/types';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
3
4
|
import { load } from 'cheerio';
|
|
4
5
|
import { parseDate } from '@/utils/parse-date';
|
|
6
|
+
import timezone from '@/utils/timezone';
|
|
5
7
|
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
|
6
|
-
|
|
7
|
-
const dateRegex = /(20\d{2})\/(\d{2})\/(\d{2})/;
|
|
8
|
+
import type { Context } from 'hono';
|
|
8
9
|
|
|
9
10
|
const baseUrl = 'https://www.jwc.uestc.edu.cn/';
|
|
10
11
|
const detailUrl = 'https://www.jwc.uestc.edu.cn/info/';
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const dateTimeRegex = /(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/;
|
|
14
|
+
|
|
15
|
+
const typeUrlMap = {
|
|
13
16
|
important: 'hard/?page=1',
|
|
14
17
|
student: 'list/256/?page=1',
|
|
15
18
|
teacher: 'list/255/?page=1',
|
|
16
|
-
|
|
19
|
+
teaching: 'list/40/?page=1',
|
|
17
20
|
office: 'list/ff80808160bcf79c0160c010a8d20020/?page=1',
|
|
18
21
|
};
|
|
19
22
|
|
|
23
|
+
const typeNameMap = {
|
|
24
|
+
important: '重要公告',
|
|
25
|
+
student: '学生事务公告',
|
|
26
|
+
teacher: '教师事务公告',
|
|
27
|
+
teaching: '教学新闻',
|
|
28
|
+
office: '办公室',
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
export const route: Route = {
|
|
21
32
|
path: '/jwc/:type?',
|
|
22
33
|
categories: ['university'],
|
|
@@ -32,51 +43,61 @@ export const route: Route = {
|
|
|
32
43
|
},
|
|
33
44
|
radar: [
|
|
34
45
|
{
|
|
35
|
-
source: ['jwc.uestc.edu.cn/'],
|
|
46
|
+
source: ['www.jwc.uestc.edu.cn/'],
|
|
36
47
|
target: '/jwc',
|
|
37
48
|
},
|
|
38
49
|
],
|
|
39
50
|
name: '教务处',
|
|
40
51
|
maintainers: ['achjqz', 'mobyw'],
|
|
41
52
|
handler,
|
|
42
|
-
url: 'jwc.uestc.edu.cn/',
|
|
43
|
-
description:
|
|
53
|
+
url: 'www.jwc.uestc.edu.cn/',
|
|
54
|
+
description: `\
|
|
55
|
+
| 重要公告 | 学生事务公告 | 教师事务公告 | 教学新闻 | 办公室 |
|
|
44
56
|
| --------- | ------------ | ------------ | -------- | ------ |
|
|
45
|
-
| important | student | teacher |
|
|
57
|
+
| important | student | teacher | teaching | office |`,
|
|
46
58
|
};
|
|
47
59
|
|
|
48
|
-
async function handler(ctx) {
|
|
60
|
+
async function handler(ctx: Context): Promise<Data> {
|
|
49
61
|
const type = ctx.req.param('type') || 'important';
|
|
50
|
-
|
|
51
|
-
if (!pageUrl) {
|
|
62
|
+
if (type in typeUrlMap === false) {
|
|
52
63
|
throw new InvalidParameterError('type not supported');
|
|
53
64
|
}
|
|
65
|
+
const typeName = typeNameMap[type];
|
|
54
66
|
|
|
55
|
-
const
|
|
67
|
+
const indexContent = await ofetch(baseUrl + typeUrlMap[type]);
|
|
56
68
|
|
|
57
|
-
const $ = load(
|
|
69
|
+
const $ = load(indexContent);
|
|
70
|
+
const entries = $('div.textAreo.clearfix').toArray();
|
|
58
71
|
|
|
59
|
-
const items =
|
|
72
|
+
const items = entries.map(async (entry) => {
|
|
73
|
+
const element = $(entry);
|
|
74
|
+
const newsTitle = element.find('a').attr('title') ?? '';
|
|
75
|
+
const newsLink = detailUrl + element.find('a').attr('newsid');
|
|
60
76
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
const
|
|
77
|
+
const newsDetail = await cache.tryGet(newsLink, async () => {
|
|
78
|
+
const newsContent = await ofetch(newsLink);
|
|
79
|
+
const content = load(newsContent);
|
|
80
|
+
|
|
81
|
+
const basicInfo = content('div.detail_header').find('div.item').text();
|
|
82
|
+
const match = dateTimeRegex.exec(basicInfo);
|
|
67
83
|
|
|
68
84
|
return {
|
|
69
85
|
title: newsTitle,
|
|
70
86
|
link: newsLink,
|
|
71
|
-
pubDate:
|
|
87
|
+
pubDate: match ? timezone(parseDate(match[1]), +8) : null,
|
|
88
|
+
description: content('div.NewText').html(),
|
|
72
89
|
};
|
|
73
|
-
})
|
|
74
|
-
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return newsDetail;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const out = await Promise.all(items);
|
|
75
96
|
|
|
76
97
|
return {
|
|
77
|
-
title:
|
|
98
|
+
title: `教务处通知(${typeName})`,
|
|
78
99
|
link: baseUrl,
|
|
79
|
-
description:
|
|
80
|
-
item: out,
|
|
100
|
+
description: `电子科技大学教务处通知(${typeName})`,
|
|
101
|
+
item: out as DataItem[],
|
|
81
102
|
};
|
|
82
103
|
}
|
|
@@ -41,12 +41,14 @@ async function handler(ctx) {
|
|
|
41
41
|
pubDate: timezone(parseDate($item('.weui_media_extra_info').attr('title')), +8),
|
|
42
42
|
};
|
|
43
43
|
})
|
|
44
|
-
.
|
|
44
|
+
.toArray();
|
|
45
45
|
|
|
46
46
|
return {
|
|
47
47
|
title: `微信公众号 - ${$('span.name').text()}`,
|
|
48
48
|
link: url,
|
|
49
49
|
description: $('div.Profile-sideColumnItemValue').text(),
|
|
50
|
-
item: await Promise.all(items.map((item) => finishArticleItem(item).catch(() =>
|
|
50
|
+
item: await Promise.all(items.map((item) => finishArticleItem(item))).catch((error) => {
|
|
51
|
+
throw error;
|
|
52
|
+
}),
|
|
51
53
|
};
|
|
52
54
|
}
|
package/lib/routes/weibo/user.ts
CHANGED
|
@@ -30,12 +30,20 @@ export const route: Route = {
|
|
|
30
30
|
},
|
|
31
31
|
radar: [
|
|
32
32
|
{
|
|
33
|
-
source: ['m.weibo.cn/u/:uid', 'm.weibo.cn/profile/:uid'
|
|
33
|
+
source: ['m.weibo.cn/u/:uid', 'm.weibo.cn/profile/:uid'],
|
|
34
|
+
target: '/user/:uid',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
source: ['weibo.com/u/:uid'],
|
|
38
|
+
target: '/user/:uid',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
source: ['www.weibo.com/u/:uid'],
|
|
34
42
|
target: '/user/:uid',
|
|
35
43
|
},
|
|
36
44
|
],
|
|
37
45
|
name: '博主',
|
|
38
|
-
maintainers: ['DIYgod', 'iplusx', 'Rongronggg9'],
|
|
46
|
+
maintainers: ['DIYgod', 'iplusx', 'Rongronggg9', 'Konano'],
|
|
39
47
|
handler,
|
|
40
48
|
description: `:::warning
|
|
41
49
|
部分博主仅登录可见,未提供 Cookie 的情况下不支持订阅,可以通过打开 \`https://m.weibo.cn/u/:uid\` 验证
|
package/lib/routes/xaut/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
3
|
import got from '@/utils/got';
|
|
4
|
+
import timezone from '@/utils/timezone';
|
|
4
5
|
import { parseDate } from '@/utils/parse-date';
|
|
5
6
|
import { load } from 'cheerio';
|
|
6
7
|
|
|
@@ -8,7 +9,7 @@ export const route: Route = {
|
|
|
8
9
|
path: '/index/:category?',
|
|
9
10
|
categories: ['university'],
|
|
10
11
|
example: '/xaut/index/tzgg',
|
|
11
|
-
parameters: { category: '
|
|
12
|
+
parameters: { category: '通知类别,默认为学校新闻' },
|
|
12
13
|
features: {
|
|
13
14
|
requireConfig: false,
|
|
14
15
|
requirePuppeteer: false,
|
|
@@ -20,19 +21,19 @@ export const route: Route = {
|
|
|
20
21
|
name: '学校主页',
|
|
21
22
|
maintainers: ['mocusez'],
|
|
22
23
|
handler,
|
|
23
|
-
description: `|
|
|
24
|
-
| :------: | :------: | :------: | :------: |
|
|
25
|
-
|
|
|
24
|
+
description: `| 学校新闻 | 砥志研思 | 立德树人 | 传道授业 | 校闻周知 |
|
|
25
|
+
| :------: | :------: | :------: | :------: | :------: |
|
|
26
|
+
| xxxw | dzys | ldsr | cdsy | xwzz |`,
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
async function handler(ctx) {
|
|
29
30
|
let category = ctx.req.param('category');
|
|
30
|
-
const dic_html = {
|
|
31
|
-
const dic_title = {
|
|
31
|
+
const dic_html = { xxxw: 'xxxw.htm', dzys: 'dzys.htm', ldsr: 'ldsr.htm', cdsy: 'cdsy.htm', xwzz: 'xwzz.htm' };
|
|
32
|
+
const dic_title = { xxxw: '学校新闻', dzys: '砥志研思', ldsr: '立德树人', cdsy: '传道授业', xwzz: '校闻周知' };
|
|
32
33
|
|
|
33
34
|
// 设置默认值
|
|
34
35
|
if (dic_title[category] === undefined) {
|
|
35
|
-
category = '
|
|
36
|
+
category = 'xxxw';
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
const response = await got({
|
|
@@ -42,26 +43,18 @@ async function handler(ctx) {
|
|
|
42
43
|
const data = response.body;
|
|
43
44
|
const $ = load(data);
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
const list = $('.newslist_block ul a')
|
|
46
|
+
const list = $('div.nlist ul li')
|
|
47
47
|
.map((_, item) => {
|
|
48
48
|
item = $(item);
|
|
49
|
-
const temp = item.find('span').text();
|
|
50
|
-
|
|
51
49
|
// link原来长这样:'../info/1196/13990.htm'
|
|
52
|
-
const link = item.attr('href').replace(/^\.\./, 'http://www.xaut.edu.cn');
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (category === 'xshd') {
|
|
57
|
-
date = parseDate(temp.slice(-11, -1).replace('年', '-').replace('月', '-').replace('日', ''), 'YYYY-MM-DD');
|
|
58
|
-
title = temp.slice(0, -11);
|
|
59
|
-
}
|
|
50
|
+
const link = item.find('a').attr('href').replace(/^\.\./, 'http://www.xaut.edu.cn');
|
|
51
|
+
const pubDate = timezone(parseDate(item.find('div.time').text().trim()), +8);
|
|
52
|
+
const title = item.find('h5').text();
|
|
60
53
|
|
|
61
54
|
return {
|
|
62
55
|
title,
|
|
63
56
|
link,
|
|
64
|
-
pubDate
|
|
57
|
+
pubDate,
|
|
65
58
|
};
|
|
66
59
|
})
|
|
67
60
|
.get();
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
|
+
import { load } from 'cheerio';
|
|
4
|
+
import cache from '@/utils/cache';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
path: '/:label?', // 路由路径
|
|
8
|
+
categories: ['reading'], // 分类
|
|
9
|
+
example: '/xbookcn/精选作品', // 示例路径
|
|
10
|
+
parameters: { label: '按名称分类,详见https://blog.xbookcn.net/p/all.html' }, // 参数
|
|
11
|
+
features: {
|
|
12
|
+
requireConfig: false,
|
|
13
|
+
requirePuppeteer: false,
|
|
14
|
+
antiCrawler: false,
|
|
15
|
+
supportBT: false,
|
|
16
|
+
supportPodcast: false,
|
|
17
|
+
supportScihub: false,
|
|
18
|
+
},
|
|
19
|
+
name: '短篇', // 源名称
|
|
20
|
+
maintainers: ['Lyunvy'], // 维护者
|
|
21
|
+
handler: async (ctx) => {
|
|
22
|
+
const { label = '精选作品' } = ctx.req.param(); // 从请求参数中获取 label
|
|
23
|
+
const url = `https://blog.xbookcn.net/search/label/${label}`; // 使用反引号构建 URL
|
|
24
|
+
const response = await ofetch(url); // 请求源链接
|
|
25
|
+
const $ = load(response); // 加载 HTML
|
|
26
|
+
|
|
27
|
+
const articles = $('.blog-posts.hfeed .date-outer').find('.post'); // 查找文章
|
|
28
|
+
|
|
29
|
+
const list = articles.toArray().map((elem) => {
|
|
30
|
+
const a = $(elem).find('.post-title a'); // 获取标题链接
|
|
31
|
+
return {
|
|
32
|
+
title: a.text().trim(), // 标题
|
|
33
|
+
link: a.attr('href'), // 链接
|
|
34
|
+
category: [], // 分类
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const items = await Promise.all(
|
|
39
|
+
list.map(
|
|
40
|
+
async (item) =>
|
|
41
|
+
// 使用缓存以避免重复请求
|
|
42
|
+
await cache.tryGet(item.link, async () => {
|
|
43
|
+
const response = await ofetch(item.link); // 请求文章链接
|
|
44
|
+
const $ = load(response); // 加载文章页面
|
|
45
|
+
|
|
46
|
+
// 获取文章的完整描述
|
|
47
|
+
item.description = $('.post-body.entry-content').html() || '无内容'; // 抓取指定内容
|
|
48
|
+
|
|
49
|
+
// 获取分类信息
|
|
50
|
+
const categories = $('.post-labels a')
|
|
51
|
+
.toArray()
|
|
52
|
+
.map((el) => $(el).text().trim());
|
|
53
|
+
item.category = categories; // 添加多个分类信息
|
|
54
|
+
|
|
55
|
+
return item; // 返回带有描述和分类的文章对象
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
title: 'xbookcn', // 源标题
|
|
62
|
+
link: url, // 源链接
|
|
63
|
+
item: items, // 源文章
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -8,7 +8,7 @@ export const route: Route = {
|
|
|
8
8
|
categories: ['multimedia', 'popular'],
|
|
9
9
|
view: ViewType.Audios,
|
|
10
10
|
example: '/xiaoyuzhou/podcast/6021f949a789fca4eff4492c',
|
|
11
|
-
parameters: { id: '播客id,可以在小宇宙播客的 URL 中找到' },
|
|
11
|
+
parameters: { id: '播客 id 或单集 id,可以在小宇宙播客的 URL 中找到' },
|
|
12
12
|
features: {
|
|
13
13
|
requireConfig: false,
|
|
14
14
|
requirePuppeteer: false,
|
|
@@ -19,25 +19,53 @@ export const route: Route = {
|
|
|
19
19
|
},
|
|
20
20
|
radar: [
|
|
21
21
|
{
|
|
22
|
-
source: ['xiaoyuzhoufm.com/podcast/:id'],
|
|
22
|
+
source: ['xiaoyuzhoufm.com/podcast/:id', 'xiaoyuzhoufm.com/episode/:id'],
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
25
|
name: '播客',
|
|
26
|
-
maintainers: ['hondajojo', 'jtsang4'],
|
|
26
|
+
maintainers: ['hondajojo', 'jtsang4', 'pseudoyu'],
|
|
27
27
|
handler,
|
|
28
28
|
url: 'xiaoyuzhoufm.com/',
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
async function handler(ctx) {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const id = ctx.req.param('id');
|
|
33
|
+
let link = `https://www.xiaoyuzhoufm.com/podcast/${id}`;
|
|
34
|
+
let response = await got({
|
|
34
35
|
method: 'get',
|
|
35
36
|
url: link,
|
|
36
37
|
});
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
let $ = load(response.data);
|
|
40
|
+
let page_data = JSON.parse($('#__NEXT_DATA__')[0].children[0].data);
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
if (!page_data.props.pageProps.podcast?.episodes) {
|
|
43
|
+
// If episodes are not found, it might be an episode page
|
|
44
|
+
// Try to get the podcast id from the episode page
|
|
45
|
+
link = `https://www.xiaoyuzhoufm.com/episode/${id}`;
|
|
46
|
+
response = await got({
|
|
47
|
+
method: 'get',
|
|
48
|
+
url: link,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
$ = load(response.data);
|
|
52
|
+
const podcastLink = $('.jsx-605929003.podcast-title .jsx-605929003.name').attr('href');
|
|
53
|
+
if (podcastLink) {
|
|
54
|
+
const podcastId = podcastLink.split('/').pop();
|
|
55
|
+
link = `https://www.xiaoyuzhoufm.com/podcast/${podcastId}`;
|
|
56
|
+
response = await got({
|
|
57
|
+
method: 'get',
|
|
58
|
+
url: link,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
$ = load(response.data);
|
|
62
|
+
page_data = JSON.parse($('#__NEXT_DATA__')[0].children[0].data);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!page_data.props.pageProps.podcast?.episodes) {
|
|
67
|
+
throw new Error('Failed to fetch podcast episodes');
|
|
68
|
+
}
|
|
41
69
|
|
|
42
70
|
const episodes = page_data.props.pageProps.podcast.episodes.map((item) => ({
|
|
43
71
|
title: item.title,
|
|
@@ -14,14 +14,16 @@ export const parseToken = () =>
|
|
|
14
14
|
if (matches) {
|
|
15
15
|
acw_sc__v2 = getAcwScV2ByArg1(matches[1]);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
const acw_sc__v2_cookie = `acw_sc__v2=${acw_sc__v2}`;
|
|
18
18
|
const res = await ofetch.raw('https://xueqiu.com', {
|
|
19
19
|
headers: {
|
|
20
|
-
Cookie:
|
|
20
|
+
Cookie: acw_sc__v2_cookie,
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
const cookieArray = res.headers.getSetCookie();
|
|
24
|
-
|
|
24
|
+
const xq_a_token_cookie = cookieArray.find((c) => c.startsWith('xq_a_token='));
|
|
25
|
+
|
|
26
|
+
return `${acw_sc__v2_cookie}; ${xq_a_token_cookie}`;
|
|
25
27
|
},
|
|
26
28
|
config.cache.routeExpire,
|
|
27
29
|
false
|
|
@@ -82,17 +82,11 @@ async function handler(ctx) {
|
|
|
82
82
|
title: `${id} ${stock_name} - ${source}`,
|
|
83
83
|
link: `https://xueqiu.com/S/${id}`,
|
|
84
84
|
description: `${stock_name} - ${source}`,
|
|
85
|
-
item: data.map((item) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
title: item.title || sanitizeHtml(item.description, { allowedTags: [], allowedAttributes: {} }),
|
|
92
|
-
description: item.description,
|
|
93
|
-
pubDate: parseDate(item.created_at),
|
|
94
|
-
link,
|
|
95
|
-
};
|
|
96
|
-
}),
|
|
85
|
+
item: data.map((item) => ({
|
|
86
|
+
title: item.title || sanitizeHtml(item.description, { allowedTags: [], allowedAttributes: {} }),
|
|
87
|
+
description: item.description,
|
|
88
|
+
pubDate: parseDate(item.created_at),
|
|
89
|
+
link: `https://xueqiu.com${item.target}`,
|
|
90
|
+
})),
|
|
97
91
|
};
|
|
98
92
|
}
|
package/lib/routes/yande/post.ts
CHANGED
|
@@ -4,20 +4,20 @@ import queryString from 'query-string';
|
|
|
4
4
|
|
|
5
5
|
export const route: Route = {
|
|
6
6
|
path: '/post/popular_recent/:period?',
|
|
7
|
-
categories: ['
|
|
7
|
+
categories: ['picture'],
|
|
8
8
|
example: '/yande/post/popular_recent/1d',
|
|
9
9
|
parameters: {
|
|
10
10
|
period: '展示时间',
|
|
11
11
|
},
|
|
12
12
|
radar: [
|
|
13
13
|
{
|
|
14
|
-
source: ['yande.re/post
|
|
14
|
+
source: ['yande.re/post'],
|
|
15
15
|
},
|
|
16
16
|
],
|
|
17
|
-
name: '
|
|
18
|
-
maintainers: ['fashioncj', 'NekoAria'],
|
|
19
|
-
description: `| 最近 24 小时 | 最近一周 | 最近一月 | 最近一年 |
|
|
20
|
-
| ------- | -------- | ------- | -------- |
|
|
17
|
+
name: 'Popular Recent Posts',
|
|
18
|
+
maintainers: ['magic-akari', 'SettingDust', 'fashioncj', 'NekoAria'],
|
|
19
|
+
description: `| 最近 24 小时 | 最近一周 | 最近一月 | 最近一年 |
|
|
20
|
+
| ------- | -------- | ------- | -------- |
|
|
21
21
|
| 1d | 1w | 1m | 1y |`,
|
|
22
22
|
handler,
|
|
23
23
|
};
|