rsshub 1.0.0-master.b08045c → 1.0.0-master.b08abca
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 +2 -2
- package/lib/app.js +2 -2
- package/lib/config.js +1 -0
- package/lib/radar-rules.js +0 -17
- package/lib/radar.js +1 -1
- package/lib/router.js +26 -29
- package/lib/utils/logger.js +14 -2
- package/lib/v2/8264/list.js +92 -0
- package/lib/v2/8264/maintainer.js +3 -0
- package/lib/v2/8264/radar.js +355 -0
- package/lib/v2/8264/router.js +3 -0
- package/lib/v2/8264/templates/description.art +5 -0
- package/lib/v2/abskoop/index.js +21 -31
- package/lib/v2/abskoop/nsfw.js +16 -37
- package/lib/v2/abskoop/radar.js +13 -2
- package/lib/v2/ainvest/article.js +42 -0
- package/lib/v2/ainvest/maintainer.js +4 -0
- package/lib/v2/ainvest/news.js +39 -0
- package/lib/v2/ainvest/radar.js +19 -0
- package/lib/v2/ainvest/router.js +4 -0
- package/lib/v2/ainvest/utils.js +73 -0
- package/lib/v2/alternativeto/maintainer.js +4 -0
- package/lib/v2/alternativeto/platform.js +32 -0
- package/lib/v2/alternativeto/radar.js +19 -0
- package/lib/v2/alternativeto/router.js +4 -0
- package/lib/v2/alternativeto/software.js +32 -0
- package/lib/v2/alternativeto/utils.js +22 -0
- package/lib/v2/apnews/topics.js +1 -0
- package/lib/v2/baidu/maintainer.js +1 -0
- package/lib/v2/baidu/radar.js +15 -1
- package/lib/v2/baidu/router.js +1 -0
- package/lib/v2/baidu/templates/tieba_search.art +1 -0
- package/lib/v2/baidu/tieba/search.js +63 -0
- package/lib/v2/bangumi/maintainer.js +1 -0
- package/lib/v2/bangumi/radar.js +9 -9
- package/lib/v2/bangumi/router.js +1 -2
- package/lib/v2/bangumi/tv/subject/ep.js +4 -3
- package/lib/v2/bangumi/tv/subject/index.js +18 -16
- package/lib/v2/bangumi/tv/subject/offcial-subject-api.js +3 -2
- package/lib/v2/bangumi/tv/subject/utils.js +5 -0
- package/lib/{routes → v2}/bbc/index.js +4 -4
- package/lib/v2/bbc/maintainer.js +4 -0
- package/lib/v2/bbc/radar.js +11 -0
- package/lib/v2/bbc/router.js +3 -0
- package/lib/v2/bilibili/dynamic.js +26 -12
- package/lib/v2/bilibili/followings_dynamic.js +1 -1
- package/lib/v2/bilibili/maintainer.js +2 -1
- package/lib/v2/bilibili/router.js +1 -0
- package/lib/v2/bilibili/utils.js +3 -1
- package/lib/v2/bilibili/watchlater.js +44 -0
- package/lib/v2/bjfu/grs.js +22 -36
- package/lib/v2/bjfu/it/index.js +9 -7
- package/lib/v2/bjfu/it/utils.js +38 -29
- package/lib/v2/bjfu/jwc/index.js +3 -8
- package/lib/v2/bjfu/jwc/utils.js +26 -29
- package/lib/v2/bjfu/kjc.js +25 -38
- package/lib/v2/bjfu/news/index.js +12 -9
- package/lib/v2/bjfu/news/utils.js +17 -19
- package/lib/v2/boc/maintainer.js +3 -0
- package/lib/v2/boc/radar.js +13 -0
- package/lib/v2/boc/router.js +3 -0
- package/lib/{routes → v2}/boc/whpj.js +16 -15
- package/lib/{routes → v2}/caus/index.js +7 -6
- package/lib/v2/caus/maintainer.js +3 -0
- package/lib/v2/caus/radar.js +13 -0
- package/lib/v2/caus/router.js +3 -0
- package/lib/v2/cbc/maintainer.js +3 -0
- package/lib/v2/cbc/radar.js +13 -0
- package/lib/v2/cbc/router.js +3 -0
- package/lib/{routes → v2}/cbc/topics.js +11 -26
- package/lib/v2/chinawriter/index.js +88 -0
- package/lib/v2/chinawriter/maintainer.js +3 -0
- package/lib/v2/chinawriter/radar.js +660 -0
- package/lib/v2/chinawriter/router.js +3 -0
- package/lib/v2/cna/index.js +63 -0
- package/lib/v2/cna/maintainer.js +3 -0
- package/lib/v2/cna/radar.js +13 -0
- package/lib/v2/cna/router.js +3 -0
- package/lib/v2/cyzone/author.js +20 -0
- package/lib/v2/cyzone/index.js +27 -0
- package/lib/v2/cyzone/label.js +20 -0
- package/lib/v2/cyzone/maintainer.js +7 -0
- package/lib/v2/cyzone/radar.js +25 -0
- package/lib/v2/cyzone/router.js +6 -0
- package/lib/v2/cyzone/util.js +125 -0
- package/lib/v2/deltaio/blog.js +33 -0
- package/lib/v2/deltaio/maintainer.js +3 -0
- package/lib/v2/deltaio/radar.js +13 -0
- package/lib/v2/deltaio/router.js +3 -0
- package/lib/v2/discourse/maintainer.js +1 -1
- package/lib/v2/discourse/notifications.js +19 -2
- package/lib/v2/discourse/router.js +1 -1
- package/lib/v2/discuz/discuz.js +156 -0
- package/lib/v2/discuz/maintainer.js +5 -0
- package/lib/v2/discuz/radar.js +0 -0
- package/lib/v2/discuz/router.js +5 -0
- package/lib/v2/dn/maintainer.js +3 -0
- package/lib/v2/dn/news.js +90 -0
- package/lib/v2/dn/radar.js +55 -0
- package/lib/v2/dn/router.js +3 -0
- package/lib/v2/dn/templates/description.art +15 -0
- package/lib/v2/domp4/detail.js +4 -2
- package/lib/v2/domp4/latest.js +7 -4
- package/lib/v2/domp4/utils.js +15 -2
- package/lib/v2/dorohedoro/news.js +3 -1
- package/lib/v2/douyin/live.js +45 -15
- package/lib/v2/dribbble/maintainer.js +5 -0
- package/lib/v2/dribbble/radar.js +25 -0
- package/lib/v2/dribbble/router.js +5 -0
- package/lib/v2/dribbble/templates/description.art +15 -0
- package/lib/v2/dribbble/utils.js +156 -0
- package/lib/v2/fantia/user.js +16 -0
- package/lib/v2/gamegene/maintainer.js +3 -0
- package/lib/v2/gamegene/news.js +50 -0
- package/lib/v2/gamegene/radar.js +13 -0
- package/lib/v2/gamegene/router.js +3 -0
- package/lib/v2/github/maintainer.js +1 -0
- package/lib/v2/github/pulse.js +87 -0
- package/lib/v2/github/radar.js +6 -0
- package/lib/v2/github/router.js +1 -0
- package/lib/v2/github/templates/pulse-description.art +24 -0
- package/lib/v2/gov/maintainer.js +1 -0
- package/lib/v2/gov/radar.js +8 -0
- package/lib/v2/gov/router.js +1 -0
- package/lib/v2/gov/shenzhen/zjj/index.js +45 -0
- package/lib/v2/hrbeu/radar.js +3 -3
- package/lib/v2/hrbeu/router.js +1 -1
- package/lib/v2/hrbeu/uae/news.js +66 -0
- package/lib/v2/icbc/maintainer.js +3 -0
- package/lib/v2/icbc/radar.js +13 -0
- package/lib/v2/icbc/router.js +3 -0
- package/lib/v2/icbc/whpj.js +57 -0
- package/lib/v2/iqiyi/maintainer.js +1 -1
- package/lib/v2/iqiyi/video.js +42 -33
- package/lib/v2/ithome/tag.js +14 -3
- package/lib/v2/japanpost/maintainer.js +3 -0
- package/lib/v2/japanpost/radar.js +22 -0
- package/lib/v2/japanpost/router.js +3 -0
- package/lib/v2/japanpost/templates/track_item_desc.art +14 -0
- package/lib/{routes → v2}/japanpost/track.js +32 -29
- package/lib/{routes → v2}/japanpost/utils.js +10 -11
- package/lib/v2/kamen-rider-official/maintainer.js +3 -0
- package/lib/v2/kamen-rider-official/news.js +110 -0
- package/lib/v2/kamen-rider-official/radar.js +18 -0
- package/lib/v2/kamen-rider-official/router.js +3 -0
- package/lib/v2/kamen-rider-official/templates/description.art +10 -0
- package/lib/v2/kantarworldpanel/index.js +96 -0
- package/lib/v2/kantarworldpanel/maintainer.js +3 -0
- package/lib/v2/kantarworldpanel/radar.js +199 -0
- package/lib/v2/kantarworldpanel/router.js +3 -0
- package/lib/v2/kantarworldpanel/templates/description.art +9 -0
- package/lib/v2/kunchengblog/essay.js +35 -19
- package/lib/v2/kunchengblog/radar.js +1 -1
- package/lib/v2/kunchengblog/router.js +1 -1
- package/lib/v2/latepost/index.js +2 -2
- package/lib/v2/latepost/radar.js +1 -1
- package/lib/v2/lemmy/index.js +61 -0
- package/lib/v2/lemmy/maintainer.js +3 -0
- package/lib/v2/lemmy/router.js +3 -0
- package/lib/v2/liulinblog/index.js +98 -0
- package/lib/v2/liulinblog/maintainer.js +6 -2
- package/lib/v2/liulinblog/radar.js +39 -19
- package/lib/v2/liulinblog/router.js +7 -3
- package/lib/v2/lsnu/jiaowc/tzgg.js +52 -0
- package/lib/v2/lsnu/maintainer.js +3 -0
- package/lib/v2/lsnu/radar.js +13 -0
- package/lib/v2/lsnu/router.js +3 -0
- package/lib/v2/luxiangdong/archive.js +28 -0
- package/lib/v2/luxiangdong/maintainer.js +3 -0
- package/lib/v2/luxiangdong/radar.js +13 -0
- package/lib/v2/luxiangdong/router.js +3 -0
- package/lib/v2/mail/imap.js +99 -0
- package/lib/v2/mail/maintainer.js +3 -0
- package/lib/v2/mail/router.js +3 -0
- package/lib/v2/mihoyo/bbs/img-ranking.js +106 -0
- package/lib/v2/mihoyo/{bbs.js → bbs/official.js} +1 -1
- package/lib/v2/mihoyo/bbs/static-data.js +137 -0
- package/lib/v2/mihoyo/maintainer.js +1 -0
- package/lib/v2/mihoyo/radar.js +7 -1
- package/lib/v2/mihoyo/router.js +2 -1
- package/lib/v2/mixcloud/index.js +5 -22
- package/lib/v2/mixcloud/queries.js +187 -179
- package/lib/v2/mydrivers/cid.js +38 -0
- package/lib/v2/mydrivers/index.js +40 -89
- package/lib/v2/mydrivers/maintainer.js +5 -1
- package/lib/v2/mydrivers/radar.js +205 -4
- package/lib/v2/mydrivers/rank.js +40 -0
- package/lib/v2/mydrivers/router.js +4 -1
- package/lib/v2/mydrivers/templates/description.art +5 -0
- package/lib/v2/mydrivers/util.js +125 -0
- package/lib/v2/news/whxw.js +1 -0
- package/lib/v2/nytimes/index.js +1 -4
- package/lib/v2/nytimes/utils.js +5 -0
- package/lib/v2/pornhub/category.js +44 -0
- package/lib/v2/pornhub/category_url.js +25 -0
- package/lib/v2/pornhub/maintainer.js +8 -0
- package/lib/v2/pornhub/model.js +29 -0
- package/lib/v2/pornhub/pornstar.js +29 -0
- package/lib/v2/pornhub/radar.js +46 -0
- package/lib/v2/pornhub/router.js +8 -0
- package/lib/v2/pornhub/search.js +23 -0
- package/lib/v2/pornhub/templates/description.art +11 -0
- package/lib/v2/pornhub/users.js +30 -0
- package/lib/v2/pornhub/utils.js +30 -0
- package/lib/v2/reuters/common.js +52 -26
- package/lib/v2/rfi/maintainer.js +1 -1
- package/lib/v2/rfi/news.js +9 -2
- package/lib/v2/rfi/router.js +1 -1
- package/lib/v2/rsc/journal.js +106 -0
- package/lib/v2/rsc/maintainer.js +3 -0
- package/lib/v2/rsc/radar.js +23 -0
- package/lib/v2/rsc/router.js +3 -0
- package/lib/v2/rsc/templates/image.art +5 -0
- package/lib/v2/rsshub/maintainer.js +1 -0
- package/lib/v2/rsshub/router.js +1 -0
- package/lib/v2/rsshub/routes.js +6 -4
- package/lib/v2/rsshub/transform/html.js +9 -0
- package/lib/v2/rsshub/transform/json.js +1 -0
- package/lib/v2/rsshub/transform/sitemap.js +52 -0
- package/lib/v2/scut/maintainer.js +1 -0
- package/lib/v2/scut/radar.js +34 -0
- package/lib/v2/scut/router.js +1 -0
- package/lib/v2/scut/smae/notice.js +54 -0
- package/lib/v2/sqmc/maintainer.js +3 -0
- package/lib/v2/sqmc/radar.js +13 -0
- package/lib/v2/sqmc/router.js +3 -0
- package/lib/v2/sqmc/www.js +49 -0
- package/lib/v2/stheadline/std/realtime.js +8 -6
- package/lib/v2/stockedge/daily-news.js +1 -1
- package/lib/v2/stockedge/utils.js +1 -0
- package/lib/v2/test/index.js +1 -1
- package/lib/v2/tfc-taiwan/index.js +36 -0
- package/lib/v2/tfc-taiwan/maintainer.js +10 -0
- package/lib/v2/tfc-taiwan/radar.js +31 -0
- package/lib/v2/tfc-taiwan/router.js +7 -0
- package/lib/v2/tfc-taiwan/templates/article.art +7 -0
- package/lib/v2/tfc-taiwan/utils.js +56 -0
- package/lib/v2/thepaper/utils.js +1 -1
- package/lib/v2/toodaylab/index.js +99 -0
- package/lib/v2/toodaylab/maintainer.js +7 -0
- package/lib/v2/toodaylab/radar.js +37 -0
- package/lib/v2/toodaylab/router.js +3 -0
- package/lib/v2/udn/breaking-news.js +10 -5
- package/lib/v2/ustc/eeis.js +5 -4
- package/lib/v2/ustc/sist.js +6 -5
- package/lib/v2/v2ex/maintainer.js +5 -0
- package/lib/v2/v2ex/post.js +35 -0
- package/lib/v2/v2ex/radar.js +35 -0
- package/lib/v2/v2ex/router.js +5 -0
- package/lib/{routes → v2}/v2ex/tab.js +17 -21
- package/lib/{routes → v2}/v2ex/topics.js +1 -1
- package/lib/v2/whu/cs.js +71 -0
- package/lib/v2/whu/gs/index.js +85 -0
- package/lib/v2/whu/maintainer.js +5 -0
- package/lib/v2/whu/news.js +102 -0
- package/lib/v2/whu/radar.js +27 -0
- package/lib/v2/whu/router.js +5 -0
- package/lib/v2/xinpianchang/index.js +19 -0
- package/lib/v2/xinpianchang/maintainer.js +4 -0
- package/lib/v2/xinpianchang/radar.js +28 -0
- package/lib/v2/xinpianchang/rank.js +33 -0
- package/lib/v2/xinpianchang/router.js +5 -0
- package/lib/v2/xinpianchang/templates/description.art +13 -0
- package/lib/v2/xinpianchang/util.js +110 -0
- package/lib/v2/xmut/jwc/bkjw.js +62 -0
- package/lib/v2/xmut/jwc/yjs.js +51 -0
- package/lib/v2/xmut/maintainer.js +3 -0
- package/lib/v2/xmut/radar.js +13 -0
- package/lib/v2/xmut/router.js +4 -0
- package/lib/v2/zodgame/forum.js +61 -23
- package/lib/v2/zodgame/templates/forum.art +1 -1
- package/lib/views/welcome.art +1 -1
- package/package.json +46 -17
- package/lib/routes/cna/index.js +0 -54
- package/lib/routes/cyzone/author.js +0 -55
- package/lib/routes/cyzone/label.js +0 -53
- package/lib/routes/discuz/discuz.js +0 -148
- package/lib/routes/dribbble/utils.js +0 -94
- package/lib/routes/kkj/news.js +0 -52
- package/lib/routes/mail/imap.js +0 -79
- package/lib/routes/pornhub/category.js +0 -22
- package/lib/routes/pornhub/category_url.js +0 -34
- package/lib/routes/pornhub/model.js +0 -35
- package/lib/routes/pornhub/pornstar.js +0 -35
- package/lib/routes/pornhub/search.js +0 -22
- package/lib/routes/pornhub/users.js +0 -35
- package/lib/routes/universities/whu/cs.js +0 -38
- package/lib/routes/universities/whu/news.js +0 -128
- package/lib/routes/v2ex/post.js +0 -39
- package/lib/v2/abskoop/templates/description.art +0 -3
- package/lib/v2/hrbeu/uae/list.js +0 -57
- package/lib/v2/liulinblog/itnews.js +0 -23
- package/lib/v2/liulinblog/kuaixun.js +0 -17
- package/lib/v2/liulinblog/utils.js +0 -42
- /package/lib/{routes → v2}/bbc/utils.js +0 -0
- /package/lib/{routes → v2}/dribbble/keyword.js +0 -0
- /package/lib/{routes → v2}/dribbble/popular.js +0 -0
- /package/lib/{routes → v2}/dribbble/user.js +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
+
const { art } = require('@/utils/render');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
module.exports = async (ctx) => {
|
|
9
|
+
const { language, category = '' } = ctx.params;
|
|
10
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 10;
|
|
11
|
+
|
|
12
|
+
const rootUrl = 'https://dn.com';
|
|
13
|
+
const currentUrl = new URL(`/${language}/news/${category}`, rootUrl).href;
|
|
14
|
+
|
|
15
|
+
const { data: response } = await got(currentUrl);
|
|
16
|
+
|
|
17
|
+
const $ = cheerio.load(response);
|
|
18
|
+
|
|
19
|
+
let items = $('a.list-item')
|
|
20
|
+
.slice(0, limit)
|
|
21
|
+
.toArray()
|
|
22
|
+
.map((item) => {
|
|
23
|
+
item = $(item);
|
|
24
|
+
|
|
25
|
+
const image = item.find('div.img img');
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
title: item.find('h2.ellipse2').text(),
|
|
29
|
+
link: new URL(item.prop('href'), rootUrl).href,
|
|
30
|
+
description: art(path.join(__dirname, 'templates/description.art'), {
|
|
31
|
+
image: image
|
|
32
|
+
? {
|
|
33
|
+
src: image.prop('src'),
|
|
34
|
+
alt: image.prop('alt'),
|
|
35
|
+
}
|
|
36
|
+
: undefined,
|
|
37
|
+
abstracts: item.find('p.abstract').html(),
|
|
38
|
+
}),
|
|
39
|
+
category: item
|
|
40
|
+
.find('span.cat')
|
|
41
|
+
.toArray()
|
|
42
|
+
.map((c) => $(c).text()),
|
|
43
|
+
pubDate: timezone(parseDate(item.find('span.time').text()), +8),
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
items = await Promise.all(
|
|
48
|
+
items.map((item) =>
|
|
49
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
50
|
+
const { data: detailResponse } = await got(item.link);
|
|
51
|
+
|
|
52
|
+
const content = cheerio.load(detailResponse);
|
|
53
|
+
|
|
54
|
+
item.title = content('h1.tit').text();
|
|
55
|
+
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
56
|
+
abstracts: content('div.abstract').html(),
|
|
57
|
+
description: content('div.detail').html(),
|
|
58
|
+
});
|
|
59
|
+
item.author = content('span.author')
|
|
60
|
+
.text()
|
|
61
|
+
.replace(/(By|作者)\s/, '');
|
|
62
|
+
item.category = [
|
|
63
|
+
...item.category,
|
|
64
|
+
...content('div.tags p a')
|
|
65
|
+
.toArray()
|
|
66
|
+
.map((c) => content(c).text()),
|
|
67
|
+
];
|
|
68
|
+
item.pubDate = timezone(parseDate(content('span.date').text()), +8);
|
|
69
|
+
|
|
70
|
+
return item;
|
|
71
|
+
})
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const title = $('a.logo img').prop('alt');
|
|
76
|
+
const icon = $('link[rel="icon"]').prop('href');
|
|
77
|
+
|
|
78
|
+
ctx.state.data = {
|
|
79
|
+
item: items,
|
|
80
|
+
title: `${title} - ${$('div.group a.active').text()}`,
|
|
81
|
+
link: currentUrl,
|
|
82
|
+
description: $('meta[name="description"]').prop('content'),
|
|
83
|
+
language: $('html').prop('lang'),
|
|
84
|
+
image: new URL($('a.logo img').prop('src'), rootUrl).href,
|
|
85
|
+
icon,
|
|
86
|
+
logo: icon,
|
|
87
|
+
subtitle: $('title').text(),
|
|
88
|
+
author: title,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'dn.com': {
|
|
3
|
+
_name: 'DN.com',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: 'The Latest',
|
|
7
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
8
|
+
source: ['/en-us/news/p1', '/en-us/news'],
|
|
9
|
+
target: '/dn/en-us/news',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: 'Industry Information',
|
|
13
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
14
|
+
source: ['/en-us/news/category-1'],
|
|
15
|
+
target: '/dn/en-us/news/category-1',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'Knowledge',
|
|
19
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
20
|
+
source: ['/en-us/news/category-2'],
|
|
21
|
+
target: '/dn/en-us/news/category-2',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: 'Investment',
|
|
25
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
26
|
+
source: ['/en-us/news/category-3'],
|
|
27
|
+
target: '/dn/en-us/news/category-3',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: '最新',
|
|
31
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
32
|
+
source: ['/zh-cn/news/p1', '/zh-cn/news'],
|
|
33
|
+
target: '/dn/zh-cn/news',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: '行业资讯',
|
|
37
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
38
|
+
source: ['/zh-cn/news/category-1'],
|
|
39
|
+
target: '/dn/zh-cn/news/category-1',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: '域名知识',
|
|
43
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
44
|
+
source: ['/zh-cn/news/category-2'],
|
|
45
|
+
target: '/dn/zh-cn/news/category-2',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: '域名投资',
|
|
49
|
+
docs: 'https://docs.rsshub.app/routes/new-media#dn.com-news',
|
|
50
|
+
source: ['/zh-cn/news/category-3'],
|
|
51
|
+
target: '/dn/zh-cn/news/category-3',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
};
|
package/lib/v2/domp4/detail.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const cheerio = require('cheerio');
|
|
2
2
|
const got = require('@/utils/got');
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const { decodeCipherText, composeMagnetUrl, getUrlType, ensureDomain } = require('./utils');
|
|
4
5
|
|
|
5
6
|
// 兼容没有 script 标签的情况,直接解析 dom
|
|
6
7
|
function getDomList($, detailUrl) {
|
|
@@ -68,6 +69,7 @@ function getMetaInfo($) {
|
|
|
68
69
|
|
|
69
70
|
module.exports = async (ctx) => {
|
|
70
71
|
const { id } = ctx.params;
|
|
72
|
+
const { domain } = ctx.query;
|
|
71
73
|
let pureId = id;
|
|
72
74
|
let detailType = 'html';
|
|
73
75
|
// compatible for .html suffix in radar
|
|
@@ -78,7 +80,7 @@ module.exports = async (ctx) => {
|
|
|
78
80
|
if (/^\d+$/.test(pureId)) {
|
|
79
81
|
detailType = 'detail';
|
|
80
82
|
}
|
|
81
|
-
const detailUrl = `${
|
|
83
|
+
const detailUrl = `${ensureDomain(ctx, domain)}/${detailType}/${pureId}.html`;
|
|
82
84
|
|
|
83
85
|
const res = await got(detailUrl);
|
|
84
86
|
const $ = cheerio.load(res.data);
|
package/lib/v2/domp4/latest.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
const latestUrl = `${baseUrl}/custom/update.html`;
|
|
4
|
+
const { defaultDomain, ensureDomain } = require('./utils');
|
|
7
5
|
|
|
8
6
|
function getItemList($, type) {
|
|
9
7
|
const list = $(`#${type} .list-group-item`)
|
|
@@ -12,7 +10,7 @@ function getItemList($, type) {
|
|
|
12
10
|
item = $(item);
|
|
13
11
|
return {
|
|
14
12
|
title: item.find('a').text(),
|
|
15
|
-
link:
|
|
13
|
+
link: `https://${defaultDomain}${item.find('a').attr('href')}`, // fixed domain for guid
|
|
16
14
|
};
|
|
17
15
|
});
|
|
18
16
|
return list;
|
|
@@ -20,6 +18,11 @@ function getItemList($, type) {
|
|
|
20
18
|
|
|
21
19
|
module.exports = async (ctx) => {
|
|
22
20
|
const { type = 'vod' } = ctx.params;
|
|
21
|
+
const { domain } = ctx.query;
|
|
22
|
+
|
|
23
|
+
const hostUrl = ensureDomain(ctx, domain);
|
|
24
|
+
const latestUrl = `${hostUrl}/custom/update.html`;
|
|
25
|
+
|
|
23
26
|
const res = await got.get(latestUrl);
|
|
24
27
|
const $ = cheerio.load(res.data);
|
|
25
28
|
const list = getItemList($, type);
|
package/lib/v2/domp4/utils.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const config = require('@/config').value;
|
|
2
|
+
|
|
3
|
+
const defaultDomain = 'mp4us.com';
|
|
4
|
+
|
|
5
|
+
const allowedDomains = ['domp4.cc', 'mp4kan.com', 'mp4us.com', 'wemp4.com', 'dbmp4.com'];
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* trackers from https://www.domp4.cc/Style/2020/js/base.js?v=2
|
|
@@ -80,10 +84,19 @@ function decodeCipherText(p, a, c, k, e, d) {
|
|
|
80
84
|
return p;
|
|
81
85
|
}
|
|
82
86
|
|
|
87
|
+
function ensureDomain(ctx, domain = defaultDomain) {
|
|
88
|
+
const origin = `https://${domain}`;
|
|
89
|
+
if (!config.feature.allow_user_supply_unsafe_domain && !allowedDomains.includes(new URL(origin).hostname)) {
|
|
90
|
+
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
|
91
|
+
}
|
|
92
|
+
return origin;
|
|
93
|
+
}
|
|
94
|
+
|
|
83
95
|
module.exports = {
|
|
84
|
-
|
|
96
|
+
defaultDomain,
|
|
85
97
|
magnetTrackers,
|
|
86
98
|
getUrlType,
|
|
87
99
|
composeMagnetUrl,
|
|
88
100
|
decodeCipherText,
|
|
101
|
+
ensureDomain,
|
|
89
102
|
};
|
package/lib/v2/douyin/live.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const config = require('@/config').value;
|
|
2
|
-
const { getOriginAvatar
|
|
2
|
+
const { getOriginAvatar } = require('./utils');
|
|
3
|
+
const logger = require('@/utils/logger');
|
|
3
4
|
|
|
4
5
|
module.exports = async (ctx) => {
|
|
5
6
|
const { rid } = ctx.params;
|
|
@@ -9,31 +10,60 @@ module.exports = async (ctx) => {
|
|
|
9
10
|
|
|
10
11
|
const pageUrl = `https://live.douyin.com/${rid}`;
|
|
11
12
|
|
|
12
|
-
const renderData = await ctx.cache.tryGet(
|
|
13
|
+
const renderData = await ctx.cache.tryGet(
|
|
14
|
+
`douyin:live:${rid}`,
|
|
15
|
+
async () => {
|
|
16
|
+
let roomInfo;
|
|
17
|
+
const browser = await require('@/utils/puppeteer')();
|
|
18
|
+
const page = await browser.newPage();
|
|
19
|
+
await page.setRequestInterception(true);
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
page.on('request', (request) => {
|
|
22
|
+
request.resourceType() === 'document' || request.resourceType() === 'script' || request.resourceType() === 'xhr' ? request.continue() : request.abort();
|
|
23
|
+
});
|
|
24
|
+
page.on('response', async (response) => {
|
|
25
|
+
const request = response.request();
|
|
26
|
+
if (request.url().includes('/webcast/room/web/enter')) {
|
|
27
|
+
roomInfo = await response.json();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
logger.debug(`Requesting ${pageUrl}`);
|
|
31
|
+
await page.goto(pageUrl, {
|
|
32
|
+
waitUntil: 'networkidle2',
|
|
33
|
+
});
|
|
34
|
+
browser.close();
|
|
35
|
+
|
|
36
|
+
return roomInfo;
|
|
37
|
+
},
|
|
38
|
+
config.cache.routeExpire,
|
|
39
|
+
false
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (renderData.status_code !== 0) {
|
|
43
|
+
throw Error(`Status code ${renderData.status_code}`);
|
|
16
44
|
}
|
|
17
45
|
|
|
18
|
-
const roomInfo = renderData.
|
|
19
|
-
const
|
|
20
|
-
const
|
|
46
|
+
const roomInfo = renderData.data.data[0];
|
|
47
|
+
const roomOwner = renderData.data.user;
|
|
48
|
+
const nickname = roomOwner.nickname;
|
|
49
|
+
const userAvatar = roomOwner.avatar_thumb.url_list[0];
|
|
21
50
|
|
|
22
51
|
const items = [];
|
|
23
|
-
if (roomInfo.
|
|
24
|
-
if (roomInfo.
|
|
52
|
+
if (roomInfo.id_str) {
|
|
53
|
+
if (roomInfo.status === 2) {
|
|
25
54
|
items.push({
|
|
26
|
-
title: `开播:${roomInfo.
|
|
55
|
+
title: `开播:${roomInfo.title}`,
|
|
56
|
+
description: `<img src="${roomInfo.cover.url_list[0]}">`,
|
|
27
57
|
link: pageUrl,
|
|
28
58
|
author: nickname,
|
|
29
|
-
guid: roomInfo.
|
|
59
|
+
guid: roomInfo.id_str, // roomId is unique for each live event
|
|
30
60
|
});
|
|
31
|
-
} else if (roomInfo.
|
|
61
|
+
} else if (roomInfo.status === 4) {
|
|
32
62
|
items.push({
|
|
33
|
-
title: `当前直播已结束,期待下一场:${roomInfo.
|
|
34
|
-
link: `https://www.douyin.com/user/${
|
|
63
|
+
title: `当前直播已结束,期待下一场:${roomInfo.title}`,
|
|
64
|
+
link: `https://www.douyin.com/user/${roomOwner.sec_uid}`,
|
|
35
65
|
author: nickname,
|
|
36
|
-
guid: roomInfo.
|
|
66
|
+
guid: roomInfo.id_str,
|
|
37
67
|
});
|
|
38
68
|
}
|
|
39
69
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'dribbble.com': {
|
|
3
|
+
_name: 'Dribbble',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: 'Keyword',
|
|
7
|
+
docs: 'https://docs.rsshub.app/routes/design#dribbble',
|
|
8
|
+
source: ['/search/shots/recent'],
|
|
9
|
+
target: (_, url) => `/dribbble/keyword/${new URL(url).searchParams.get('q')}`,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: 'Popular',
|
|
13
|
+
docs: 'https://docs.rsshub.app/routes/design#dribbble',
|
|
14
|
+
source: ['/'],
|
|
15
|
+
target: '/dribbble/popular',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'User (or team)',
|
|
19
|
+
docs: 'https://docs.rsshub.app/routes/design#dribbble',
|
|
20
|
+
source: ['/:name'],
|
|
21
|
+
target: '/dribbble/user/:name',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{{ if shotMedia }}
|
|
2
|
+
{{@ shotMedia }}<br>
|
|
3
|
+
{{ /if }}
|
|
4
|
+
|
|
5
|
+
{{ if description.length }}
|
|
6
|
+
{{@ description.html() }}<br>
|
|
7
|
+
{{ /if }}
|
|
8
|
+
|
|
9
|
+
{{ if shotData.likesCount }}
|
|
10
|
+
{{ shotData.likesCount }} likes<br>
|
|
11
|
+
{{ /if }}
|
|
12
|
+
|
|
13
|
+
{{ if shotData.savesCount }}
|
|
14
|
+
{{ shotData.savesCount }} saves
|
|
15
|
+
{{ /if }}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const { art } = require('@/utils/render');
|
|
5
|
+
const { join } = require('path');
|
|
6
|
+
|
|
7
|
+
// Refactored function to load a link asynchronously
|
|
8
|
+
async function load(link) {
|
|
9
|
+
// Make a GET request to the specified and retrieve the response
|
|
10
|
+
const response = await got(link);
|
|
11
|
+
const $ = cheerio.load(response.data);
|
|
12
|
+
|
|
13
|
+
const shotData = JSON.parse(
|
|
14
|
+
$('script')
|
|
15
|
+
.text()
|
|
16
|
+
.match(/shotData:\s(\{.+?\}),\n/)[1]
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
// Join multiple shots together by selecting elements with class 'media-shot' or 'main-shot' or 'block-media-wrapper'
|
|
20
|
+
// 'block-media-wrapper' is a new class of dribbble
|
|
21
|
+
const shotMedia = $('.media-shot, .main-shot, .block-media-wrapper')
|
|
22
|
+
.toArray()
|
|
23
|
+
.map((element) => {
|
|
24
|
+
const object = $(element);
|
|
25
|
+
|
|
26
|
+
// remove the content that we don't want to show
|
|
27
|
+
object.find('span.cropped-indicator, button').remove();
|
|
28
|
+
|
|
29
|
+
object.find('video').each((_, video) => {
|
|
30
|
+
video = $(video);
|
|
31
|
+
|
|
32
|
+
if (!video.attr('src') && video.data('src')) {
|
|
33
|
+
video.attr('src', video.data('src'));
|
|
34
|
+
video.removeAttr('data-src');
|
|
35
|
+
video.removeAttr('data-video-small');
|
|
36
|
+
video.removeAttr('data-video-medium');
|
|
37
|
+
video.removeAttr('data-video-large');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
object.find('img').each((_, img) => {
|
|
41
|
+
img = $(img);
|
|
42
|
+
|
|
43
|
+
if (img.data('animated-url')) {
|
|
44
|
+
img.attr('src', img.data('animated-url'));
|
|
45
|
+
img.removeAttr('data-animated-url');
|
|
46
|
+
img.removeAttr('srcset');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!img.attr('src') && img.data('src')) {
|
|
50
|
+
img.attr('src', img.data('src').split('?')[0]);
|
|
51
|
+
img.removeAttr('data-src');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
img.attr('src', img.attr('src').split('?')[0]);
|
|
55
|
+
img.removeAttr('srcset');
|
|
56
|
+
img.removeAttr('data-srcset');
|
|
57
|
+
});
|
|
58
|
+
object.find('a').each((_, a) => {
|
|
59
|
+
a = $(a);
|
|
60
|
+
a.removeAttr('data-pswp-srcset');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return object.html();
|
|
64
|
+
})
|
|
65
|
+
.join('');
|
|
66
|
+
|
|
67
|
+
const shotDescription = $('.shot-description-container');
|
|
68
|
+
|
|
69
|
+
const author = `${shotData.shotUser.name}${shotData.shotUser.team.length ? ` for ${shotData.shotUser.team.name}` : ''}`;
|
|
70
|
+
const description = art(join(__dirname, 'templates/description.art'), {
|
|
71
|
+
shotMedia,
|
|
72
|
+
shotData,
|
|
73
|
+
description: shotDescription,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Get the text content of the element with class 'shot-date' and convert it to a UTC string representation of a date
|
|
77
|
+
const pubDate = parseDate(shotData.postedOn);
|
|
78
|
+
|
|
79
|
+
// Return an object containing the description and pubDate
|
|
80
|
+
return {
|
|
81
|
+
description,
|
|
82
|
+
pubDate,
|
|
83
|
+
author,
|
|
84
|
+
category: shotData.tags,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Refactored code with comments for clarity
|
|
89
|
+
|
|
90
|
+
function ProcessFeed(list, caches) {
|
|
91
|
+
const host = 'https://dribbble.com';
|
|
92
|
+
|
|
93
|
+
// Use Promise.all to process all items in the list asynchronously
|
|
94
|
+
return Promise.all(
|
|
95
|
+
list.map((item) => {
|
|
96
|
+
const $ = cheerio.load(item);
|
|
97
|
+
|
|
98
|
+
// The link of item is "/signup/new" when access "https://dribbble.com/search/something"
|
|
99
|
+
// So get url by id
|
|
100
|
+
const itemId = $(item).attr('id').replace('screenshot-', '');
|
|
101
|
+
|
|
102
|
+
// Construct the full item URL using the host and the item ID
|
|
103
|
+
const itemUrl = new URL(`/shots/${itemId}`, host).href;
|
|
104
|
+
|
|
105
|
+
// Return a Promise that resolves to an object combining the single item data and the additional data
|
|
106
|
+
return caches.tryGet(itemUrl, async () => {
|
|
107
|
+
const { description, pubDate, author, category } = await load(itemUrl);
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
title: $('.shot-title').text(),
|
|
111
|
+
link: itemUrl,
|
|
112
|
+
description,
|
|
113
|
+
pubDate,
|
|
114
|
+
author,
|
|
115
|
+
category,
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
})
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves data from a given URL and processes it.
|
|
124
|
+
*
|
|
125
|
+
* @param {Object} ctx - The context object.
|
|
126
|
+
* @param {string} url - The URL to retrieve data from.
|
|
127
|
+
* @param {string} title - The title of the data.
|
|
128
|
+
* @return {Object} - An object containing the retrieved data and metadata.
|
|
129
|
+
*/
|
|
130
|
+
const getData = async (ctx, url, title) => {
|
|
131
|
+
// Make a GET request to the specified URL
|
|
132
|
+
const response = await got(url);
|
|
133
|
+
|
|
134
|
+
// Extract the response data
|
|
135
|
+
const data = response.data;
|
|
136
|
+
|
|
137
|
+
// Load the response data into a cheerio object
|
|
138
|
+
const $ = cheerio.load(data);
|
|
139
|
+
// Get all the list items under the 'ol.dribbbles.group' element
|
|
140
|
+
const list = $('ol.dribbbles.group > li').toArray();
|
|
141
|
+
|
|
142
|
+
// Process the list items using the ProcessFeed function
|
|
143
|
+
const result = await ProcessFeed(list, ctx.cache);
|
|
144
|
+
|
|
145
|
+
// Return an object containing the retrieved data and metadata
|
|
146
|
+
return {
|
|
147
|
+
title,
|
|
148
|
+
link: url,
|
|
149
|
+
description: $('meta[name="description"]').attr('content'),
|
|
150
|
+
item: result,
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
module.exports = {
|
|
155
|
+
getData,
|
|
156
|
+
};
|
package/lib/v2/fantia/user.js
CHANGED
|
@@ -5,6 +5,17 @@ const Config = require('@/config').value.fantia;
|
|
|
5
5
|
module.exports = async (ctx) => {
|
|
6
6
|
const rootUrl = 'https://fantia.jp';
|
|
7
7
|
const userUrl = `${rootUrl}/api/v1/fanclubs/${ctx.params.id}`;
|
|
8
|
+
|
|
9
|
+
const initalResponse = await got({
|
|
10
|
+
method: 'get',
|
|
11
|
+
url: rootUrl,
|
|
12
|
+
headers: {
|
|
13
|
+
Cookie: Config.cookies ? Config.cookies : '',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const csrfToken = initalResponse.data.match(/name="csrf-token" content="(.*?)"\s?\/>/)[1];
|
|
18
|
+
|
|
8
19
|
const response = await got({
|
|
9
20
|
method: 'get',
|
|
10
21
|
url: userUrl,
|
|
@@ -12,6 +23,7 @@ module.exports = async (ctx) => {
|
|
|
12
23
|
Cookie: Config.cookies ? Config.cookies : '',
|
|
13
24
|
},
|
|
14
25
|
});
|
|
26
|
+
|
|
15
27
|
const list = response.data.fanclub.recent_posts.map((item) => ({
|
|
16
28
|
title: item.title,
|
|
17
29
|
link: `${rootUrl}/api/v1/posts/${item.id}`,
|
|
@@ -26,6 +38,10 @@ module.exports = async (ctx) => {
|
|
|
26
38
|
url: item.link,
|
|
27
39
|
headers: {
|
|
28
40
|
Cookie: Config.cookies ? Config.cookies : '',
|
|
41
|
+
'X-CSRF-Token': csrfToken,
|
|
42
|
+
Accept: 'application/json, text/plain, */*',
|
|
43
|
+
Referer: `${rootUrl}/`,
|
|
44
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
29
45
|
},
|
|
30
46
|
});
|
|
31
47
|
item.link = item.link.replace('api/v1/', '');
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const url = 'https://gamegene.cn/news';
|
|
7
|
+
const { data: response } = await got({
|
|
8
|
+
method: 'get',
|
|
9
|
+
url,
|
|
10
|
+
});
|
|
11
|
+
const $ = cheerio.load(response);
|
|
12
|
+
const list = $('div.mr245')
|
|
13
|
+
.toArray()
|
|
14
|
+
.map((item) => {
|
|
15
|
+
item = $(item);
|
|
16
|
+
const aEle = item.find('a').first();
|
|
17
|
+
const href = aEle.attr('href');
|
|
18
|
+
const title = aEle.find('h3').first().text();
|
|
19
|
+
const author = item.find('a.namenode').text();
|
|
20
|
+
const category = item.find('span.r').text();
|
|
21
|
+
return {
|
|
22
|
+
title,
|
|
23
|
+
link: href,
|
|
24
|
+
author,
|
|
25
|
+
category,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
const items = await Promise.all(
|
|
29
|
+
list.map((item) =>
|
|
30
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
31
|
+
const { data: response } = await got({
|
|
32
|
+
method: 'get',
|
|
33
|
+
url: item.link,
|
|
34
|
+
});
|
|
35
|
+
const $ = cheerio.load(response);
|
|
36
|
+
const dateTime = $('div.meta').find('time').first().text();
|
|
37
|
+
item.pubDate = parseDate(dateTime);
|
|
38
|
+
item.description = $('div.content').first().html();
|
|
39
|
+
return item;
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
ctx.state.data = {
|
|
45
|
+
// 在此处输出您的 RSS
|
|
46
|
+
item: items,
|
|
47
|
+
link: url,
|
|
48
|
+
title: '游戏基因 GameGene',
|
|
49
|
+
};
|
|
50
|
+
};
|