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,63 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
5
|
+
|
|
6
|
+
module.exports = async (ctx) => {
|
|
7
|
+
const id = ctx.params.id || 'aall';
|
|
8
|
+
const isTopic = /^\d+$/.test(id);
|
|
9
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
|
|
10
|
+
|
|
11
|
+
const { data: response } = await got({
|
|
12
|
+
method: 'post',
|
|
13
|
+
url: `https://www.cna.com.tw/cna2018api/api/${isTopic ? 'WTopic' : 'WNewsList'}`,
|
|
14
|
+
json: {
|
|
15
|
+
action: '0',
|
|
16
|
+
category: isTopic ? 'newstopic' : id,
|
|
17
|
+
tno: isTopic ? id : undefined,
|
|
18
|
+
pagesize: limit,
|
|
19
|
+
pageidx: 1,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
ResultData: { MetaData: metadata },
|
|
25
|
+
ResultData: resultData,
|
|
26
|
+
} = response;
|
|
27
|
+
const list = (isTopic ? resultData.Topic.NewsItems : resultData.Items).slice(0, limit).map((item) => ({
|
|
28
|
+
title: item.HeadLine,
|
|
29
|
+
link: item.PageUrl,
|
|
30
|
+
pubDate: timezone(parseDate(item.CreateTime), +8),
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
const items = await Promise.all(
|
|
34
|
+
list.map((item) =>
|
|
35
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
36
|
+
const detailResponse = await got({
|
|
37
|
+
method: 'get',
|
|
38
|
+
url: item.link,
|
|
39
|
+
});
|
|
40
|
+
const content = cheerio.load(detailResponse.data);
|
|
41
|
+
const topImage = content('.fullPic').html();
|
|
42
|
+
|
|
43
|
+
item.description = (topImage === null ? '' : topImage) + content('.paragraph').eq(0).html();
|
|
44
|
+
item.category = [
|
|
45
|
+
...content("meta[property='article:tag']")
|
|
46
|
+
.get()
|
|
47
|
+
.map((e) => e.attribs.content),
|
|
48
|
+
content('.active > a').text(),
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
return item;
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
ctx.state.data = {
|
|
57
|
+
title: metadata.Title,
|
|
58
|
+
description: metadata.Description,
|
|
59
|
+
link: metadata.CanonicalUrl,
|
|
60
|
+
image: metadata.Image,
|
|
61
|
+
item: items,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'cna.com.tw': {
|
|
3
|
+
_name: '中央通訊社',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '分类',
|
|
7
|
+
docs: 'https://docs.rsshub.app/routes/traditional-media#zhong-yang-tong-xun-she',
|
|
8
|
+
source: ['/list/:id', '/topic/newstopic/:id'],
|
|
9
|
+
target: (params) => `/cna/${params.id.replace('.aspx', '')}`,
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const { rootUrl, apiRootUrl, processItems, getInfo } = require('./util');
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx) => {
|
|
4
|
+
const { id } = ctx.params;
|
|
5
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5;
|
|
6
|
+
|
|
7
|
+
const apiUrl = new URL('v2/author/author/detail', apiRootUrl).href;
|
|
8
|
+
const currentUrl = new URL(`author/${id}`, rootUrl).href;
|
|
9
|
+
|
|
10
|
+
const items = await processItems(apiUrl, limit, ctx.cache.tryGet, {
|
|
11
|
+
author_id: id,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
ctx.state.data = {
|
|
15
|
+
...{
|
|
16
|
+
item: items,
|
|
17
|
+
},
|
|
18
|
+
...(await getInfo(currentUrl, ctx.cache.tryGet)),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { rootUrl, apiRootUrl, processItems, getInfo } = require('./util');
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx) => {
|
|
4
|
+
const { id = 'news' } = ctx.params;
|
|
5
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5;
|
|
6
|
+
|
|
7
|
+
const apiUrl = new URL(`v2/content/channel/${id === 'news' ? 'getArticle' : 'detail'}`, apiRootUrl).href;
|
|
8
|
+
const currentUrl = new URL(`channel/${id}`, rootUrl).href;
|
|
9
|
+
|
|
10
|
+
const items = await processItems(
|
|
11
|
+
apiUrl,
|
|
12
|
+
limit,
|
|
13
|
+
ctx.cache.tryGet,
|
|
14
|
+
id === 'news'
|
|
15
|
+
? {}
|
|
16
|
+
: {
|
|
17
|
+
channel_id: id,
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
ctx.state.data = {
|
|
22
|
+
...{
|
|
23
|
+
item: items,
|
|
24
|
+
},
|
|
25
|
+
...(await getInfo(currentUrl, ctx.cache.tryGet)),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const { rootUrl, apiRootUrl, processItems, getInfo } = require('./util');
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx) => {
|
|
4
|
+
const { name } = ctx.params;
|
|
5
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5;
|
|
6
|
+
|
|
7
|
+
const apiUrl = new URL('v2/content/tag/tagList', apiRootUrl).href;
|
|
8
|
+
const currentUrl = new URL(`label/${name}`, rootUrl).href;
|
|
9
|
+
|
|
10
|
+
const items = await processItems(apiUrl, limit, ctx.cache.tryGet, {
|
|
11
|
+
tag: name,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
ctx.state.data = {
|
|
15
|
+
...{
|
|
16
|
+
item: items,
|
|
17
|
+
},
|
|
18
|
+
...(await getInfo(currentUrl, ctx.cache.tryGet)),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'cyzone.cn': {
|
|
3
|
+
_name: '创业邦',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '资讯',
|
|
7
|
+
docs: 'https://docs.rsshub.app/routes/new-media#chuang-ye-bang-zi-xun',
|
|
8
|
+
source: ['/channel/:id', '/'],
|
|
9
|
+
target: '/cyzone/:id',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: '作者',
|
|
13
|
+
docs: 'https://docs.rsshub.app/routes/new-media#chuang-ye-bang-zuo-zhe',
|
|
14
|
+
source: ['/author/:id', '/'],
|
|
15
|
+
target: '/cyzone/author/:id',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: '标签',
|
|
19
|
+
docs: 'https://docs.rsshub.app/routes/new-media#chuang-ye-bang-biao-qian',
|
|
20
|
+
source: ['/label/:name', '/'],
|
|
21
|
+
target: '/cyzone/label/:name',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
const rootUrl = 'https://www.cyzone.cn';
|
|
6
|
+
const apiRootUrl = 'https://api1.cyzone.cn';
|
|
7
|
+
const apiShowUrl = new URL('v2/content/app_content/show', apiRootUrl).href;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves information from a given URL using a provided tryGet function.
|
|
11
|
+
* @param {string} url - The URL to retrieve information from.
|
|
12
|
+
* @param {Function} tryGet - The tryGet function that handles the retrieval process.
|
|
13
|
+
* @returns {Promise<Object>} - A promise that resolves to an object containing the retrieved information.
|
|
14
|
+
*/
|
|
15
|
+
const getInfo = (url, tryGet) =>
|
|
16
|
+
tryGet(url, async () => {
|
|
17
|
+
const { data: response } = await got(url);
|
|
18
|
+
|
|
19
|
+
const $ = cheerio.load(response);
|
|
20
|
+
|
|
21
|
+
const avatar = $('img.avatar')?.prop('src')?.split('?')[0] ?? undefined;
|
|
22
|
+
const icon = new URL($('link[rel="icon"]')?.prop('href'), rootUrl).href;
|
|
23
|
+
const image = new URL($('div.logo img')?.prop('src'), rootUrl).href;
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
title: $('title').text(),
|
|
27
|
+
link: url,
|
|
28
|
+
description: $('meta[name="description"]').prop('content'),
|
|
29
|
+
language: 'zh-cn',
|
|
30
|
+
image: avatar || image,
|
|
31
|
+
icon,
|
|
32
|
+
logo: icon,
|
|
33
|
+
subtitle: $('meta[name="keywords"]').prop('content'),
|
|
34
|
+
author: $('meta[name="app-mobile-web-app-title"]').prop('content'),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Process the item list and return the resulting array.
|
|
40
|
+
* @param {string} apiUrl - The URL of the API.
|
|
41
|
+
* @param {number} limit - The limit of the results.
|
|
42
|
+
* @param {function} tryGet - The tryGet function that handles the retrieval process.
|
|
43
|
+
* @param {...Object} searchParams - The search parameter objects.
|
|
44
|
+
* @returns {Promise<Array>} - The processed item array.
|
|
45
|
+
*/
|
|
46
|
+
const processItems = async (apiUrl, limit, tryGet, ...searchParams) => {
|
|
47
|
+
// Merge search parameters
|
|
48
|
+
searchParams = {
|
|
49
|
+
...searchParams.reduce(
|
|
50
|
+
(result, object) => ({
|
|
51
|
+
...result,
|
|
52
|
+
...object,
|
|
53
|
+
}),
|
|
54
|
+
{}
|
|
55
|
+
),
|
|
56
|
+
...{
|
|
57
|
+
size: limit,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const { data: response } = await got(apiUrl, {
|
|
62
|
+
searchParams,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
let items = (response.data?.article ?? response.data?.data ?? response.data).slice(0, limit).map((item) => {
|
|
66
|
+
item = item.item ?? item;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
title: item.title,
|
|
70
|
+
link: /^\/\//.test(item.url) ? `https:${item.url}` : item.url,
|
|
71
|
+
description: item.description,
|
|
72
|
+
category: [item.category_name, ...(item.tags?.split(',') ?? [])],
|
|
73
|
+
guid: item.content_id,
|
|
74
|
+
pubDate: parseDate(item.published_at * 1000),
|
|
75
|
+
upvotes: item.votes ?? 0,
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
items = await Promise.all(
|
|
80
|
+
items.map((item) =>
|
|
81
|
+
tryGet(`cyzone-${item.guid}`, async () => {
|
|
82
|
+
const { data: detailResponse } = await got.post(apiShowUrl, {
|
|
83
|
+
json: {
|
|
84
|
+
content_id: item.guid,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const data = detailResponse.data;
|
|
89
|
+
|
|
90
|
+
const categories = [data.category, ...item.category, ...(data.tags?.split(',') ?? [])];
|
|
91
|
+
|
|
92
|
+
const content = cheerio.load(data.content);
|
|
93
|
+
|
|
94
|
+
content('img').each(function () {
|
|
95
|
+
if (content(this).prop('src')) {
|
|
96
|
+
content(this).prop('src', content(this).prop('src').split('?')[0]);
|
|
97
|
+
} else {
|
|
98
|
+
content(this).remove();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
item.title = data.title;
|
|
103
|
+
item.link = /^\/\//.test(data.link_url) ? `https:${data.link_url}` : data.link_url;
|
|
104
|
+
item.description = content.html();
|
|
105
|
+
item.author = data.author_name ?? data.author;
|
|
106
|
+
item.category = [...new Set(categories)].filter((c) => c);
|
|
107
|
+
item.guid = `cyzone-${item.guid}`;
|
|
108
|
+
item.pubDate = parseDate(data.published_at * 1000);
|
|
109
|
+
item.upvotes = data.votes ?? 0;
|
|
110
|
+
|
|
111
|
+
return item;
|
|
112
|
+
})
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
return items;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
module.exports = {
|
|
120
|
+
rootUrl,
|
|
121
|
+
apiRootUrl,
|
|
122
|
+
|
|
123
|
+
getInfo,
|
|
124
|
+
processItems,
|
|
125
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
const config = require('@/config').value;
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const baseUrl = 'https://delta.io';
|
|
7
|
+
const dataUrl = `${baseUrl}/page-data/blog/page-data.json`;
|
|
8
|
+
|
|
9
|
+
const data = await ctx.cache.tryGet(
|
|
10
|
+
dataUrl,
|
|
11
|
+
async () => {
|
|
12
|
+
const { data } = await got(dataUrl);
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
config.cache.routeExpire,
|
|
16
|
+
false
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const items = data.result.data.allMdx.edges.map(({ node }) => ({
|
|
20
|
+
title: node.frontmatter.title,
|
|
21
|
+
description: node.frontmatter.description,
|
|
22
|
+
author: node.frontmatter.author,
|
|
23
|
+
pubDate: parseDate(node.frontmatter.date),
|
|
24
|
+
link: `${baseUrl}${node.fields.slug}`,
|
|
25
|
+
itunes_item_image: `${baseUrl}${node.frontmatter.thumbnail.childImageSharp.gatsbyImageData.images.fallback.src}`,
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
ctx.state.data = {
|
|
29
|
+
title: 'delta.io blog',
|
|
30
|
+
link: `${baseUrl}/blog`,
|
|
31
|
+
item: items,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -5,14 +5,31 @@ module.exports = async (ctx) => {
|
|
|
5
5
|
const { link, key } = getConfig(ctx);
|
|
6
6
|
|
|
7
7
|
const response = await got(`${link}/notifications.json`, { headers: { 'User-Api-Key': key } }).json();
|
|
8
|
-
|
|
8
|
+
let items = response.notifications.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 10).map((e) => ({
|
|
9
9
|
title: e.fancy_title ?? e.data.badge_name,
|
|
10
|
-
link: `${link}/${e.data.hasOwnProperty('badge_id') ? `badges/${e.data.badge_id}/${e.data.badge_slug}?username=${e.data.username}` :
|
|
10
|
+
link: `${link}/${e.data.hasOwnProperty('badge_id') ? `badges/${e.data.badge_id}/${e.data.badge_slug}?username=${e.data.username}` : `t/topic/${e.topic_id}/${e.post_number}`}`,
|
|
11
11
|
pubDate: new Date(e.created_at),
|
|
12
12
|
author: e.data.display_username ?? e.data.username,
|
|
13
13
|
category: `notification_type:${e.notification_type}`,
|
|
14
|
+
original_post_id: e.data.original_post_id,
|
|
14
15
|
}));
|
|
15
16
|
|
|
17
|
+
if (ctx.params.fulltext === '1') {
|
|
18
|
+
items = await Promise.all(
|
|
19
|
+
items.map((e) => {
|
|
20
|
+
if (e.original_post_id) {
|
|
21
|
+
const post_link = `${link}/posts/${e.original_post_id}.json`;
|
|
22
|
+
return ctx.cache.tryGet(post_link, async () => {
|
|
23
|
+
const { cooked } = await got(post_link, { headers: { 'User-Api-Key': key } }).json();
|
|
24
|
+
return { ...e, description: cooked };
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
const { about } = await got(`${link}/about.json`, { headers: { 'User-Api-Key': key } }).json();
|
|
17
34
|
ctx.state.data = {
|
|
18
35
|
title: `${about.title} - Notifications`,
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const iconv = require('iconv-lite');
|
|
4
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
+
const config = require('@/config').value;
|
|
6
|
+
|
|
7
|
+
function fixUrl(itemLink, baseUrl) {
|
|
8
|
+
// 处理相对链接
|
|
9
|
+
if (itemLink) {
|
|
10
|
+
if (baseUrl && !baseUrl.match(/^https?:\/\//)) {
|
|
11
|
+
if (baseUrl.match(/^\/\//)) {
|
|
12
|
+
baseUrl = 'http:' + baseUrl;
|
|
13
|
+
} else {
|
|
14
|
+
baseUrl = 'http://' + baseUrl;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
itemLink = new URL(itemLink, baseUrl).href;
|
|
18
|
+
}
|
|
19
|
+
return itemLink;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// discuz 7.x 与 discuz x系列 通用文章内容抓取
|
|
23
|
+
async function load(itemLink, charset, header) {
|
|
24
|
+
// 处理编码问题
|
|
25
|
+
const response = await got({
|
|
26
|
+
method: 'get',
|
|
27
|
+
url: itemLink,
|
|
28
|
+
responseType: 'buffer',
|
|
29
|
+
headers: header,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const responseData = iconv.decode(response.data, charset ?? 'utf-8');
|
|
33
|
+
if (!responseData) {
|
|
34
|
+
const description = '获取详细内容失败';
|
|
35
|
+
return { description };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const $ = cheerio.load(responseData);
|
|
39
|
+
|
|
40
|
+
const post = $('div#postlist div[id^=post] td[id^=postmessage]').first();
|
|
41
|
+
|
|
42
|
+
// fix lazyload image
|
|
43
|
+
post.find('img').each((_, img) => {
|
|
44
|
+
img = $(img);
|
|
45
|
+
if (img.attr('src')?.endsWith('none.gif') && img.attr('file')) {
|
|
46
|
+
img.attr('src', img.attr('file') || img.attr('zoomfile'));
|
|
47
|
+
img.removeAttr('file');
|
|
48
|
+
img.removeAttr('zoomfile');
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// 只抓取论坛1楼消息
|
|
53
|
+
const description = post.html();
|
|
54
|
+
|
|
55
|
+
return { description };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = async (ctx) => {
|
|
59
|
+
let link = ctx.params.link;
|
|
60
|
+
const ver = ctx.params.ver ? ctx.params.ver.toUpperCase() : undefined;
|
|
61
|
+
const cid = ctx.params.cid;
|
|
62
|
+
link = link.replace(/:\/\//, ':/').replace(/:\//, '://');
|
|
63
|
+
|
|
64
|
+
const cookie = cid === undefined ? '' : config.discuz.cookies[cid];
|
|
65
|
+
if (cookie === undefined) {
|
|
66
|
+
throw Error('缺少对应论坛的cookie.');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const header = {
|
|
70
|
+
Cookie: cookie,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const response = await got({
|
|
74
|
+
method: 'get',
|
|
75
|
+
url: link,
|
|
76
|
+
responseType: 'buffer',
|
|
77
|
+
headers: header,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const responseData = response.data;
|
|
81
|
+
// 若没有指定编码,则默认utf-8
|
|
82
|
+
const contentType = response.headers['content-type'] || '';
|
|
83
|
+
let $ = cheerio.load(iconv.decode(responseData, 'utf-8'));
|
|
84
|
+
const charset = contentType.match(/charset=([^;]*)/)?.[1] ?? $('meta[charset]').attr('charset') ?? $('meta[http-equiv="Content-Type"]').attr('content')?.split('charset=')?.[1];
|
|
85
|
+
if (charset?.toLowerCase() !== 'utf-8') {
|
|
86
|
+
$ = cheerio.load(iconv.decode(responseData, charset ?? 'utf-8'));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const version = ver ? `DISCUZ! ${ver}` : $('head > meta[name=generator]').attr('content');
|
|
90
|
+
|
|
91
|
+
let items;
|
|
92
|
+
if (version.toUpperCase().startsWith('DISCUZ! 7')) {
|
|
93
|
+
// discuz 7.x 系列
|
|
94
|
+
// 支持全文抓取,限制抓取页面5个
|
|
95
|
+
const list = $('tbody[id^="normalthread"] > tr')
|
|
96
|
+
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5)
|
|
97
|
+
.toArray()
|
|
98
|
+
.map((item) => {
|
|
99
|
+
item = $(item);
|
|
100
|
+
const a = item.find('span[id^=thread] a');
|
|
101
|
+
return {
|
|
102
|
+
title: a.text().trim(),
|
|
103
|
+
link: fixUrl(a.attr('href'), link),
|
|
104
|
+
pubDate: item.find('td.author em').length ? parseDate(item.find('td.author em').text().trim()) : undefined,
|
|
105
|
+
author: item.find('td.author cite a').text().trim(),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
items = await Promise.all(
|
|
110
|
+
list.map((item) =>
|
|
111
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
112
|
+
const { description } = await load(item.link, charset, header);
|
|
113
|
+
|
|
114
|
+
item.description = description;
|
|
115
|
+
return item;
|
|
116
|
+
})
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
} else if (version.toUpperCase().startsWith('DISCUZ! X')) {
|
|
120
|
+
// discuz X 系列
|
|
121
|
+
// 支持全文抓取,限制抓取页面5个
|
|
122
|
+
const list = $('tbody[id^="normalthread"] > tr')
|
|
123
|
+
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5)
|
|
124
|
+
.toArray()
|
|
125
|
+
.map((item) => {
|
|
126
|
+
item = $(item);
|
|
127
|
+
const a = item.find('a.xst');
|
|
128
|
+
return {
|
|
129
|
+
title: a.text(),
|
|
130
|
+
link: fixUrl(a.attr('href'), link),
|
|
131
|
+
pubDate: item.find('td.by:nth-child(3) em span').last().length ? parseDate(item.find('td.by:nth-child(3) em span').last().text().trim()) : undefined,
|
|
132
|
+
author: item.find('td.by:nth-child(3) cite a').text().trim(),
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
items = await Promise.all(
|
|
137
|
+
list.map((item) =>
|
|
138
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
139
|
+
const { description } = await load(item.link, charset, header);
|
|
140
|
+
|
|
141
|
+
item.description = description;
|
|
142
|
+
return item;
|
|
143
|
+
})
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
} else {
|
|
147
|
+
throw Error('不支持当前Discuz版本.');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
ctx.state.data = {
|
|
151
|
+
title: $('head > title').text(),
|
|
152
|
+
description: $('head > meta[name=description]').attr('content'),
|
|
153
|
+
link,
|
|
154
|
+
item: items,
|
|
155
|
+
};
|
|
156
|
+
};
|
|
File without changes
|