rsshub 1.0.0-master.f7cdf8b → 1.0.0-master.f7f8b7a
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 +3 -3
- package/lib/config.js +21 -8
- package/lib/middleware/cache/index.js +4 -3
- package/lib/middleware/cache/redis.js +3 -3
- package/lib/middleware/onerror.js +8 -0
- package/lib/middleware/template.js +79 -85
- package/lib/router.js +7 -7
- package/lib/routes/index.js +6 -13
- package/lib/utils/common-utils.js +2 -6
- package/lib/utils/render.js +2 -0
- package/lib/v2/1point3acres/maintainer.js +2 -2
- package/lib/v2/95mm/utils.js +3 -2
- package/lib/v2/aliyun/notice.js +1 -1
- package/lib/v2/amazon/maintainer.js +1 -1
- package/lib/v2/apnews/topics.js +1 -1
- package/lib/v2/arcteryx/maintainer.js +3 -3
- package/lib/v2/bangumi/maintainer.js +1 -0
- package/lib/v2/bangumi/radar.js +6 -0
- package/lib/v2/bangumi/router.js +1 -0
- package/lib/v2/bangumi/tv/user/wish.js +38 -0
- package/lib/v2/bellroy/maintainer.js +1 -1
- package/lib/v2/bilibili/cache.js +10 -7
- package/lib/v2/bilibili/maintainer.js +1 -0
- package/lib/v2/bilibili/platform.js +43 -0
- package/lib/v2/bilibili/radar.js +8 -0
- package/lib/v2/bilibili/router.js +1 -0
- package/lib/v2/bilibili/video.js +8 -1
- package/lib/v2/bossdesign/index.js +41 -0
- package/lib/v2/bossdesign/maintainer.js +3 -0
- package/lib/v2/bossdesign/radar.js +13 -0
- package/lib/v2/bossdesign/router.js +3 -0
- package/lib/v2/brave/latest.js +4 -2
- package/lib/v2/buaa/maintainer.js +4 -0
- package/lib/v2/buaa/news/index.js +46 -0
- package/lib/v2/buaa/radar.js +21 -0
- package/lib/v2/buaa/router.js +4 -0
- package/lib/v2/buaa/sme.js +59 -0
- package/lib/v2/cfachina/analygarden.js +60 -0
- package/lib/v2/cfachina/maintainer.js +3 -0
- package/lib/v2/cfachina/radar.js +13 -0
- package/lib/v2/cfachina/router.js +3 -0
- package/lib/v2/cna/maintainer.js +1 -0
- package/lib/v2/cna/radar.js +6 -0
- package/lib/v2/cna/router.js +1 -0
- package/lib/v2/cna/web/index.js +62 -0
- package/lib/v2/cste/radar.js +1 -1
- package/lib/v2/dahecube/radar.js +40 -4
- package/lib/v2/dongqiudi/utils.js +1 -1
- package/lib/v2/douban/maintainer.js +1 -0
- package/lib/v2/douban/other/discussion.js +58 -0
- package/lib/v2/douban/radar.js +8 -0
- package/lib/v2/douban/router.js +1 -0
- package/lib/v2/dut/defaults.js +4 -0
- package/lib/v2/dut/index.js +21 -9
- package/lib/v2/dut/maintainer.js +8 -7
- package/lib/v2/dut/radar.js +37 -29
- package/lib/v2/dut/shortcuts.js +5 -0
- package/lib/v2/egsea/flash.js +30 -0
- package/lib/v2/egsea/maintainer.js +3 -0
- package/lib/v2/egsea/radar.js +13 -0
- package/lib/v2/egsea/router.js +3 -0
- package/lib/v2/fisher-spb/news.js +1 -2
- package/lib/v2/fosshub/radar.js +1 -1
- package/lib/v2/fxiaoke/crm.js +63 -0
- package/lib/v2/fxiaoke/maintainer.js +3 -0
- package/lib/v2/fxiaoke/radar.js +37 -0
- package/lib/v2/fxiaoke/router.js +3 -0
- package/lib/v2/gdsrx/index.js +72 -0
- package/lib/v2/gdsrx/maintainer.js +3 -0
- package/lib/v2/gdsrx/radar.js +61 -0
- package/lib/v2/gdsrx/router.js +3 -0
- package/lib/v2/gogoanimehd/radar.js +1 -1
- package/lib/v2/gogoanimehd/recent-releases.js +1 -1
- package/lib/v2/google/alerts.js +33 -0
- package/lib/v2/google/maintainer.js +1 -0
- package/lib/v2/google/router.js +1 -0
- package/lib/v2/gov/maintainer.js +9 -2
- package/lib/v2/gov/moa/zdscxx.js +104 -0
- package/lib/v2/gov/mot/index.js +66 -0
- package/lib/v2/gov/nea/ghs.js +58 -0
- package/lib/v2/gov/nifdc/index.js +40 -33
- package/lib/v2/gov/radar.js +232 -4
- package/lib/v2/gov/router.js +10 -2
- package/lib/v2/gov/safe/business.js +8 -0
- package/lib/v2/gov/safe/complaint.js +8 -0
- package/lib/v2/gov/safe/templates/message.art +25 -0
- package/lib/v2/gov/safe/util.js +87 -0
- package/lib/v2/gov/zhengce/index.js +99 -0
- package/lib/v2/greasyfork/maintainer.js +1 -0
- package/lib/v2/greasyfork/router.js +1 -0
- package/lib/v2/greasyfork/scripts.js +25 -20
- package/lib/{routes/universities → v2}/harvard/health/blog.js +8 -7
- package/lib/v2/harvard/maintainer.js +3 -0
- package/lib/v2/harvard/radar.js +13 -0
- package/lib/v2/harvard/router.js +3 -0
- package/lib/v2/huxiu/briefColumn.js +13 -25
- package/lib/v2/huxiu/channel.js +28 -0
- package/lib/v2/huxiu/club.js +30 -0
- package/lib/v2/huxiu/collection.js +14 -26
- package/lib/v2/huxiu/maintainer.js +8 -5
- package/lib/v2/huxiu/member.js +27 -0
- package/lib/v2/huxiu/moment.js +11 -25
- package/lib/v2/huxiu/radar.js +24 -16
- package/lib/v2/huxiu/router.js +7 -4
- package/lib/v2/huxiu/search.js +16 -21
- package/lib/v2/huxiu/tag.js +13 -25
- package/lib/v2/huxiu/templates/description.art +46 -0
- package/lib/v2/huxiu/util.js +460 -0
- package/lib/v2/ifi-audio/maintainer.js +1 -1
- package/lib/v2/imiker/jinghua.js +87 -0
- package/lib/v2/imiker/maintainer.js +3 -0
- package/lib/v2/imiker/radar.js +13 -0
- package/lib/v2/imiker/router.js +3 -0
- package/lib/v2/imiker/templates/description.art +32 -0
- package/lib/v2/inoreader/maintainer.js +1 -1
- package/lib/v2/instagram/common-utils.js +7 -4
- package/lib/v2/instagram/templates/images.art +9 -2
- package/lib/v2/instagram/templates/video.art +4 -1
- package/lib/v2/instagram/web-api/index.js +30 -9
- package/lib/v2/instagram/web-api/utils.js +149 -25
- package/lib/v2/kemono/index.js +26 -2
- package/lib/v2/kemono/radar.js +1 -1
- package/lib/v2/kepu/live.js +89 -0
- package/lib/v2/kepu/maintainer.js +3 -0
- package/lib/v2/kepu/radar.js +13 -0
- package/lib/v2/kepu/router.js +3 -0
- package/lib/v2/kepu/templates/description.art +33 -0
- package/lib/v2/leetcode/maintainer.js +1 -1
- package/lib/v2/lightnovel/lightNovel.js +62 -0
- package/lib/v2/lightnovel/maintainer.js +3 -0
- package/lib/v2/lightnovel/radar.js +13 -0
- package/lib/v2/lightnovel/router.js +3 -0
- package/lib/v2/line/radar.js +1 -1
- package/lib/v2/liquipedia/cs_matches.js +52 -0
- package/lib/v2/liquipedia/dota2_matches.js +47 -0
- package/lib/v2/liquipedia/maintainer.js +4 -0
- package/lib/v2/liquipedia/radar.js +19 -0
- package/lib/v2/liquipedia/router.js +4 -0
- package/lib/v2/magazinelib/maintainer.js +1 -1
- package/lib/v2/mihoyo/radar.js +1 -1
- package/lib/v2/missav/maintainer.js +3 -0
- package/lib/v2/missav/new.js +36 -0
- package/lib/v2/missav/radar.js +13 -0
- package/lib/v2/missav/router.js +3 -0
- package/lib/v2/missav/templates/preview.art +3 -0
- package/lib/v2/modb/maintainer.js +3 -0
- package/lib/v2/modb/radar.js +13 -0
- package/lib/v2/modb/router.js +3 -0
- package/lib/v2/modb/topic.js +59 -0
- package/lib/v2/nature/cover.js +32 -42
- package/lib/v2/nature/highlight.js +2 -2
- package/lib/v2/nature/news-and-comment.js +2 -2
- package/lib/v2/nature/news.js +2 -2
- package/lib/v2/nature/research.js +2 -2
- package/lib/v2/nature/siteindex.js +5 -5
- package/lib/v2/nature/utils.js +124 -5
- package/lib/v2/ncu/jwc.js +33 -0
- package/lib/v2/ncu/maintainer.js +3 -0
- package/lib/v2/ncu/radar.js +13 -0
- package/lib/v2/ncu/router.js +3 -0
- package/lib/v2/nmtv/radar.js +1 -1
- package/lib/v2/oo-software/radar.js +1 -1
- package/lib/v2/patagonia/maintainer.js +1 -1
- package/lib/v2/phoronix/index.js +177 -48
- package/lib/v2/phoronix/maintainer.js +1 -1
- package/lib/v2/phoronix/radar.js +3 -3
- package/lib/v2/phoronix/router.js +1 -1
- package/lib/v2/picnob/maintainer.js +1 -1
- package/lib/v2/picnob/templates/desc.art +3 -3
- package/lib/v2/picnob/user.js +74 -37
- package/lib/v2/picnob/utils.js +24 -0
- package/lib/v2/qbitai/category.js +27 -0
- package/lib/v2/qbitai/maintainer.js +4 -0
- package/lib/v2/qbitai/radar.js +19 -0
- package/lib/v2/qbitai/router.js +4 -0
- package/lib/v2/qbitai/tag.js +27 -0
- package/lib/v2/questmobile/maintainer.js +3 -0
- package/lib/v2/questmobile/radar.js +18 -0
- package/lib/v2/questmobile/report.js +127 -0
- package/lib/v2/questmobile/router.js +3 -0
- package/lib/v2/questmobile/templates/description.art +17 -0
- package/lib/v2/readhub/daily.js +43 -0
- package/lib/v2/readhub/index.js +19 -72
- package/lib/v2/readhub/maintainer.js +1 -0
- package/lib/v2/readhub/radar.js +6 -0
- package/lib/v2/readhub/router.js +1 -0
- package/lib/v2/readhub/util.js +69 -0
- package/lib/v2/routledge/book-series.js +78 -0
- package/lib/v2/routledge/maintainer.js +3 -0
- package/lib/v2/routledge/radar.js +13 -0
- package/lib/v2/routledge/router.js +3 -0
- package/lib/v2/routledge/templates/description.art +7 -0
- package/lib/v2/showstart/artist.js +15 -0
- package/lib/v2/showstart/brand.js +15 -0
- package/lib/v2/showstart/const.js +4 -0
- package/lib/v2/showstart/event.js +18 -0
- package/lib/v2/showstart/maintainer.js +6 -0
- package/lib/v2/showstart/radar.js +40 -0
- package/lib/v2/showstart/router.js +6 -0
- package/lib/v2/showstart/search.js +51 -0
- package/lib/v2/showstart/service.js +166 -0
- package/lib/v2/showstart/utils.js +92 -0
- package/lib/v2/snowpeak/maintainer.js +1 -1
- package/lib/v2/sony/maintainer.js +1 -1
- package/lib/v2/sse/disclosure.js +4 -3
- package/lib/v2/sspu/jwc.js +44 -0
- package/lib/v2/sspu/maintainer.js +3 -0
- package/lib/v2/sspu/radar.js +13 -0
- package/lib/v2/sspu/router.js +3 -0
- package/lib/v2/techcrunch/maintainer.js +1 -1
- package/lib/v2/theatlantic/maintainer.js +1 -1
- package/lib/v2/thepaper/radar.js +2 -2
- package/lib/v2/threads/index.js +20 -150
- package/lib/v2/threads/utils.js +147 -0
- package/lib/v2/twitter/keyword.js +1 -3
- package/lib/v2/twitter/media.js +1 -5
- package/lib/v2/twitter/user.js +1 -3
- package/lib/v2/twitter/utils.js +5 -3
- package/lib/v2/twitter/web-api/constants.js +80 -68
- package/lib/v2/twitter/web-api/twitter-api.js +96 -103
- package/lib/v2/uniqlo/maintainer.js +3 -0
- package/lib/v2/uniqlo/new.js +62 -0
- package/lib/v2/uniqlo/radar.js +12 -0
- package/lib/v2/uniqlo/router.js +3 -0
- package/lib/v2/wechat/maintainer.js +1 -1
- package/lib/v2/weibo/maintainer.js +1 -1
- package/lib/v2/weibo/radar.js +1 -1
- package/lib/v2/weibo/router.js +1 -1
- package/lib/v2/weibo/search/hot.js +118 -7
- package/lib/v2/weibo/search/template/digest.art +17 -0
- package/lib/v2/xiaohongshu/util.js +17 -7
- package/lib/v2/xmnn/docs.js +0 -0
- package/lib/v2/xmnn/maintainer.js +1 -0
- package/lib/v2/xmnn/news.js +65 -0
- package/lib/v2/xmnn/radar.js +67 -1
- package/lib/v2/xmnn/router.js +1 -0
- package/lib/v2/xsijishe/maintainer.js +1 -0
- package/lib/v2/xsijishe/radar.js +12 -0
- package/lib/v2/xsijishe/rank.js +60 -0
- package/lib/v2/xsijishe/router.js +1 -0
- package/lib/v2/yahoo/maintainer.js +2 -0
- package/lib/v2/yahoo/news/tw/index.js +24 -0
- package/lib/v2/yahoo/news/tw/provider-helper.js +22 -0
- package/lib/v2/yahoo/news/tw/provider.js +24 -0
- package/lib/v2/yahoo/news/tw/utils.js +129 -0
- package/lib/v2/yahoo/radar.js +29 -1
- package/lib/v2/yahoo/router.js +4 -1
- package/lib/v2/yahoo/templates/youtube.art +1 -0
- package/lib/v2/yuque/book.js +6 -1
- package/lib/v2/yuque/utils.js +16 -0
- package/lib/v2/zagg/maintainer.js +1 -1
- package/lib/views/error.art +1 -1
- package/lib/views/rss3-ums.js +62 -0
- package/lib/views/welcome.art +1 -1
- package/package.json +45 -39
- package/lib/routes/egsea/flash.js +0 -40
- package/lib/routes/gov/moa/sjzxfb.js +0 -20
- package/lib/routes/liquipedia/dota2_matches.js +0 -50
- package/lib/routes/questmobile/report.js +0 -121
- package/lib/routes/uniqlo/stylingbook.js +0 -24
- package/lib/routes/universities/buaa/news/index.js +0 -66
- package/lib/routes/universities/buaa/utils.js +0 -57
- package/lib/v2/gov/zhengce/zuixin.js +0 -39
- package/lib/v2/huxiu/article.js +0 -33
- package/lib/v2/huxiu/author.js +0 -36
- package/lib/v2/huxiu/templates/brief.art +0 -22
- package/lib/v2/huxiu/templates/img.art +0 -3
- package/lib/v2/huxiu/templates/moment.art +0 -16
- package/lib/v2/huxiu/templates/video.art +0 -7
- package/lib/v2/huxiu/utils.js +0 -154
- package/lib/v2/twitter/web-api/twitter-got.js +0 -113
- /package/lib/{routes → v2}/gov/moa/moa.js +0 -0
- /package/lib/v2/yahoo/news/{index.js → us/index.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
4
|
|
|
4
5
|
module.exports = async (ctx) => {
|
|
5
6
|
const rootUrl = 'https://www.health.harvard.edu';
|
|
@@ -12,17 +13,16 @@ module.exports = async (ctx) => {
|
|
|
12
13
|
|
|
13
14
|
const $ = cheerio.load(response.data);
|
|
14
15
|
|
|
15
|
-
const list = $('.text-2xl')
|
|
16
|
-
.
|
|
17
|
-
.map((
|
|
16
|
+
const list = $('.lg\\:text-2xl')
|
|
17
|
+
.toArray()
|
|
18
|
+
.map((item) => {
|
|
18
19
|
item = $(item).parent();
|
|
19
20
|
|
|
20
21
|
return {
|
|
21
22
|
title: item.text(),
|
|
22
23
|
link: item.attr('href'),
|
|
23
24
|
};
|
|
24
|
-
})
|
|
25
|
-
.get();
|
|
25
|
+
});
|
|
26
26
|
|
|
27
27
|
const items = await Promise.all(
|
|
28
28
|
list.map((item) =>
|
|
@@ -33,10 +33,11 @@ module.exports = async (ctx) => {
|
|
|
33
33
|
});
|
|
34
34
|
const content = cheerio.load(detailResponse.data);
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const ldJson = JSON.parse(content('script[type="application/ld+json"]').text())['@graph'].find((i) => i['@type'] === 'Article');
|
|
37
37
|
|
|
38
38
|
item.description = content('.content-repository-content').html();
|
|
39
|
-
item.pubDate =
|
|
39
|
+
item.pubDate = parseDate(ldJson.datePublished);
|
|
40
|
+
item.author = ldJson.author.name;
|
|
40
41
|
|
|
41
42
|
return item;
|
|
42
43
|
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'harvard.edu': {
|
|
3
|
+
_name: 'Harvard University',
|
|
4
|
+
'www.health': [
|
|
5
|
+
{
|
|
6
|
+
title: 'Health Blog',
|
|
7
|
+
docs: 'https://docs.rsshub.app/routes/new-media#harvard-health-publishing',
|
|
8
|
+
source: ['/blog'],
|
|
9
|
+
target: '/harvard/health/blog',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -1,41 +1,29 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
-
|
|
3
|
-
const {
|
|
2
|
+
|
|
3
|
+
const { apiBriefRootUrl, processItems, fetchBriefColumnData } = require('./util');
|
|
4
4
|
|
|
5
5
|
module.exports = async (ctx) => {
|
|
6
6
|
const { id } = ctx.params;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
brief_column_id: id,
|
|
13
|
-
},
|
|
14
|
-
})
|
|
15
|
-
.json();
|
|
16
|
-
const {
|
|
17
|
-
data: { data: briefDetail },
|
|
18
|
-
} = await got.post(`${briefApi}/briefColumn/detail`, {
|
|
7
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
|
|
8
|
+
|
|
9
|
+
const apiUrl = new URL('briefColumn/getContentListByCategoryId', apiBriefRootUrl).href;
|
|
10
|
+
|
|
11
|
+
const { data: response } = await got.post(apiUrl, {
|
|
19
12
|
form: {
|
|
20
13
|
platform: 'www',
|
|
21
14
|
brief_column_id: id,
|
|
15
|
+
pagesize: limit,
|
|
22
16
|
},
|
|
23
17
|
});
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
description: item.preface,
|
|
29
|
-
pubDate: parseDate(item.publish_time, 'X'),
|
|
30
|
-
}));
|
|
19
|
+
ctx.state.json = response.data.datalist;
|
|
20
|
+
|
|
21
|
+
const items = await processItems(response.data.datalist, limit, ctx.cache.tryGet);
|
|
31
22
|
|
|
32
|
-
const
|
|
23
|
+
const data = await fetchBriefColumnData(id);
|
|
33
24
|
|
|
34
25
|
ctx.state.data = {
|
|
35
|
-
title: `虎嗅 - ${briefDetail.name}`,
|
|
36
|
-
description: briefDetail.summary,
|
|
37
|
-
image: briefDetail.head_img,
|
|
38
|
-
link: `${baseUrl}/briefColumn/${id}.html`,
|
|
39
26
|
item: items,
|
|
27
|
+
...data,
|
|
40
28
|
};
|
|
41
29
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
|
|
3
|
+
const { rootUrl, apiArticleRootUrl, processItems, fetchData } = require('./util');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const { id } = ctx.params;
|
|
7
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
|
|
8
|
+
|
|
9
|
+
const apiUrl = new URL(`web/${id ? 'channel' : 'article'}/articleList`, apiArticleRootUrl).href;
|
|
10
|
+
const currentUrl = new URL(id ? `channel/${id}.html` : 'article', rootUrl).href;
|
|
11
|
+
|
|
12
|
+
const { data: response } = await got.post(apiUrl, {
|
|
13
|
+
form: {
|
|
14
|
+
platform: 'www',
|
|
15
|
+
channel_id: id,
|
|
16
|
+
pagesize: limit,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const items = await processItems(response.data?.dataList ?? response.data.datalist, limit, ctx.cache.tryGet);
|
|
21
|
+
|
|
22
|
+
const data = await fetchData(currentUrl);
|
|
23
|
+
|
|
24
|
+
ctx.state.data = {
|
|
25
|
+
item: items,
|
|
26
|
+
...data,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
|
|
3
|
+
const { apiBriefRootUrl, processItems, fetchClubData } = require('./util');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const { id } = ctx.params;
|
|
7
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
|
|
8
|
+
|
|
9
|
+
const apiUrl = new URL('club/briefList', apiBriefRootUrl).href;
|
|
10
|
+
|
|
11
|
+
const { data, briefColumnId } = await fetchClubData(id);
|
|
12
|
+
|
|
13
|
+
const { data: response } = await got.post(apiUrl, {
|
|
14
|
+
form: {
|
|
15
|
+
platform: 'www',
|
|
16
|
+
club_id: id,
|
|
17
|
+
brief_column_id: briefColumnId,
|
|
18
|
+
pagesize: limit,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
ctx.state.json = response.data.datalist;
|
|
23
|
+
|
|
24
|
+
const items = await processItems(response.data.datalist, limit, ctx.cache.tryGet);
|
|
25
|
+
|
|
26
|
+
ctx.state.data = {
|
|
27
|
+
item: items,
|
|
28
|
+
...data,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -1,39 +1,27 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const { parseDate } = require('@/utils/parse-date');
|
|
2
|
+
|
|
3
|
+
const { rootUrl, apiArticleRootUrl, processItems, fetchData } = require('./util');
|
|
5
4
|
|
|
6
5
|
module.exports = async (ctx) => {
|
|
7
6
|
const { id } = ctx.params;
|
|
8
|
-
const
|
|
9
|
-
const { data: response } = await got(link, {
|
|
10
|
-
https: {
|
|
11
|
-
rejectUnauthorized: false,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
7
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 10;
|
|
14
8
|
|
|
15
|
-
const
|
|
9
|
+
const apiUrl = new URL('web/collection/articleList', apiArticleRootUrl).href;
|
|
10
|
+
const currentUrl = new URL(`collection/${id}.html`, rootUrl).href;
|
|
16
11
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
description: e.summary,
|
|
24
|
-
pubDate: parseDate(e.dateline, 'X'),
|
|
25
|
-
author: e.user_info.username,
|
|
26
|
-
}));
|
|
12
|
+
const { data: response } = await got.post(apiUrl, {
|
|
13
|
+
form: {
|
|
14
|
+
platform: 'www',
|
|
15
|
+
collection_id: id,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
27
18
|
|
|
28
|
-
const items = await
|
|
19
|
+
const items = await processItems(response.data.datalist, limit, ctx.cache.tryGet);
|
|
29
20
|
|
|
30
|
-
const
|
|
21
|
+
const data = await fetchData(currentUrl);
|
|
31
22
|
|
|
32
23
|
ctx.state.data = {
|
|
33
|
-
title: info,
|
|
34
|
-
description: collectionDetail.summary,
|
|
35
|
-
image: collectionDetail.icon,
|
|
36
|
-
link,
|
|
37
24
|
item: items,
|
|
25
|
+
...data,
|
|
38
26
|
};
|
|
39
27
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
'/article': ['HenryQW'],
|
|
3
|
-
'/
|
|
4
|
-
'/
|
|
2
|
+
'/article': ['HenryQW', 'nczitzk'],
|
|
3
|
+
'/briefcolumn/:id': ['Fatpandac', 'nczitzk'],
|
|
4
|
+
'/channel/:id?': ['nczitzk'],
|
|
5
|
+
'/club/:id': ['nczitzk'],
|
|
6
|
+
'/collection/:id': ['AlexdanerZe', 'nczitzk'],
|
|
7
|
+
'/member/:id/:type?': ['HenryQW', 'nczitzk'],
|
|
5
8
|
'/moment': ['nczitzk'],
|
|
6
|
-
'/
|
|
7
|
-
'/
|
|
9
|
+
'/search/:keyword': ['xyqfer', 'HenryQW', 'nczitzk'],
|
|
10
|
+
'/tag/:id': ['xyqfer', 'HenryQW', 'nczitzk'],
|
|
8
11
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
|
|
3
|
+
const { rootUrl, apiMemberRootUrl, processItems, fetchData } = require('./util');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const { id, type = 'article' } = ctx.params;
|
|
7
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 10;
|
|
8
|
+
|
|
9
|
+
const apiUrl = new URL(`web/${type}/${type}List`, apiMemberRootUrl).href;
|
|
10
|
+
const currentUrl = new URL(`member/${id}${type === 'article' ? '' : `/${type}`}.html`, rootUrl).href;
|
|
11
|
+
|
|
12
|
+
const { data: response } = await got.post(apiUrl, {
|
|
13
|
+
form: {
|
|
14
|
+
platform: 'www',
|
|
15
|
+
uid: id,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const items = await processItems(response.data.datalist, limit, ctx.cache.tryGet);
|
|
20
|
+
|
|
21
|
+
const data = await fetchData(currentUrl);
|
|
22
|
+
|
|
23
|
+
ctx.state.data = {
|
|
24
|
+
item: items,
|
|
25
|
+
...data,
|
|
26
|
+
};
|
|
27
|
+
};
|
package/lib/v2/huxiu/moment.js
CHANGED
|
@@ -1,39 +1,25 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { baseUrl: rootUrl, momentApi: apiRootUrl } = require('./utils');
|
|
2
|
+
|
|
3
|
+
const { rootUrl, apiMomentRootUrl, processItems, fetchData } = require('./util');
|
|
6
4
|
|
|
7
5
|
module.exports = async (ctx) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
|
|
7
|
+
|
|
8
|
+
const apiUrl = new URL('web-v2/moment/feed', apiMomentRootUrl).href;
|
|
9
|
+
const currentUrl = new URL('moment', rootUrl).href;
|
|
10
10
|
|
|
11
|
-
const response = await got({
|
|
12
|
-
method: 'post',
|
|
13
|
-
url: apiUrl,
|
|
11
|
+
const { data: response } = await got.post(apiUrl, {
|
|
14
12
|
form: {
|
|
15
|
-
last_dateline: parseInt(new Date().getTime() / 1000),
|
|
16
13
|
platform: 'www',
|
|
17
|
-
is_ai: 0,
|
|
18
14
|
},
|
|
19
15
|
});
|
|
20
16
|
|
|
21
|
-
const items = response.data.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
author: item.user_info.username,
|
|
25
|
-
pubDate: parseDate(item.publish_time * 1000),
|
|
26
|
-
description: art(path.join(__dirname, 'templates/moment.art'), {
|
|
27
|
-
description: item.content,
|
|
28
|
-
images: item.img_urls,
|
|
29
|
-
video: item.video,
|
|
30
|
-
comments: item.comment,
|
|
31
|
-
}),
|
|
32
|
-
}));
|
|
17
|
+
const items = await processItems(response.data.moment_list.datalist[0].datalist, limit, ctx.cache.tryGet);
|
|
18
|
+
|
|
19
|
+
const data = await fetchData(currentUrl);
|
|
33
20
|
|
|
34
21
|
ctx.state.data = {
|
|
35
|
-
title: '虎嗅 - 24小时',
|
|
36
|
-
link: currentUrl,
|
|
37
22
|
item: items,
|
|
23
|
+
...data,
|
|
38
24
|
};
|
|
39
25
|
};
|
package/lib/v2/huxiu/radar.js
CHANGED
|
@@ -3,44 +3,52 @@ module.exports = {
|
|
|
3
3
|
_name: '虎嗅',
|
|
4
4
|
'.': [
|
|
5
5
|
{
|
|
6
|
-
title: '
|
|
7
|
-
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu',
|
|
8
|
-
source: ['/article'
|
|
6
|
+
title: '资讯',
|
|
7
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-zi-xun',
|
|
8
|
+
source: ['/article'],
|
|
9
9
|
target: '/huxiu/article',
|
|
10
10
|
},
|
|
11
|
+
{
|
|
12
|
+
title: '频道',
|
|
13
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-pin-dao',
|
|
14
|
+
source: ['/channel'],
|
|
15
|
+
target: (params) => `/huxiu/channel/${params.id.replace(/\.html$/, '')}`,
|
|
16
|
+
},
|
|
11
17
|
{
|
|
12
18
|
title: '24小时',
|
|
13
|
-
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu',
|
|
14
|
-
source: ['/moment'
|
|
19
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-24-xiao-shi',
|
|
20
|
+
source: ['/moment'],
|
|
15
21
|
target: '/huxiu/moment',
|
|
16
22
|
},
|
|
17
23
|
{
|
|
18
24
|
title: '标签',
|
|
19
|
-
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu',
|
|
25
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-biao-qian',
|
|
20
26
|
source: ['/tags/:id'],
|
|
21
|
-
target: (params) => `/huxiu/tag/${params.id.replace(
|
|
27
|
+
target: (params) => `/huxiu/tag/${params.id.replace(/\.html$/, '')}`,
|
|
22
28
|
},
|
|
23
29
|
{
|
|
24
30
|
title: '搜索',
|
|
25
|
-
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu',
|
|
31
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-sou-suo',
|
|
32
|
+
source: ['/'],
|
|
33
|
+
target: '/huxiu/search/:keyword',
|
|
26
34
|
},
|
|
27
35
|
{
|
|
28
36
|
title: '作者',
|
|
29
|
-
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu',
|
|
30
|
-
source: ['/member/:id
|
|
31
|
-
target:
|
|
37
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-zuo-zhe',
|
|
38
|
+
source: ['/member/:id/:type'],
|
|
39
|
+
target: (params) => `/huxiu/member/${params.id}/${params.type.replace(/\.html$/, '')}`,
|
|
32
40
|
},
|
|
33
41
|
{
|
|
34
42
|
title: '文集',
|
|
35
|
-
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu',
|
|
36
|
-
source: ['/collection/:id'
|
|
37
|
-
target: (params) => `/huxiu/collection/${params.id.replace(
|
|
43
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-wen-ji',
|
|
44
|
+
source: ['/collection/:id'],
|
|
45
|
+
target: (params) => `/huxiu/collection/${params.id.replace(/\.html$/, '')}`,
|
|
38
46
|
},
|
|
39
47
|
{
|
|
40
48
|
title: '简报',
|
|
41
|
-
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu',
|
|
49
|
+
docs: 'https://docs.rsshub.app/routes/new-media#hu-xiu-jian-bao',
|
|
42
50
|
source: ['/briefColumn/:id', '/'],
|
|
43
|
-
target: (params) => `/huxiu/briefcolumn/${params.id.replace(
|
|
51
|
+
target: (params) => `/huxiu/briefcolumn/${params.id.replace(/\.html$/, '')}`,
|
|
44
52
|
},
|
|
45
53
|
],
|
|
46
54
|
},
|
package/lib/v2/huxiu/router.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
module.exports = (router) => {
|
|
2
|
-
router.get('/article', require('./
|
|
3
|
-
router.get('/author/:id', require('./
|
|
2
|
+
router.get('/article', require('./channel'));
|
|
3
|
+
router.get('/author/:id/:type?', require('./member'));
|
|
4
|
+
router.get('/briefcolumn/:id', require('./briefColumn'));
|
|
5
|
+
router.get('/channel/:id?', require('./channel'));
|
|
6
|
+
router.get('/club/:id', require('./club'));
|
|
4
7
|
router.get('/collection/:id', require('./collection'));
|
|
8
|
+
router.get('/member/:id/:type?', require('./member'));
|
|
5
9
|
router.get('/moment', require('./moment'));
|
|
6
|
-
router.get('/tag/:id', require('./tag'));
|
|
7
10
|
router.get('/search/:keyword', require('./search'));
|
|
8
|
-
router.get('/
|
|
11
|
+
router.get('/tag/:id', require('./tag'));
|
|
9
12
|
};
|
package/lib/v2/huxiu/search.js
CHANGED
|
@@ -1,40 +1,35 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const { rootUrl, apiSearchRootUrl, generateSignature, processItems, fetchData } = require('./util');
|
|
3
4
|
|
|
4
5
|
module.exports = async (ctx) => {
|
|
5
6
|
const { keyword } = ctx.params;
|
|
6
|
-
const
|
|
7
|
-
const link = utils.baseUrl;
|
|
7
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 20;
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const apiUrl = new URL('api/article', apiSearchRootUrl).href;
|
|
10
|
+
const currentUrl = rootUrl;
|
|
11
|
+
|
|
12
|
+
const { data: response } = await got.post(apiUrl, {
|
|
13
13
|
searchParams: {
|
|
14
14
|
platform: 'www',
|
|
15
15
|
s: keyword,
|
|
16
16
|
sort: '',
|
|
17
17
|
page: 1,
|
|
18
|
-
pagesize:
|
|
19
|
-
appid: '
|
|
20
|
-
...
|
|
18
|
+
pagesize: limit,
|
|
19
|
+
appid: 'hx_search_202303',
|
|
20
|
+
...generateSignature(),
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
author: d.author,
|
|
29
|
-
}));
|
|
24
|
+
const items = await processItems(response.data.datalist, limit, ctx.cache.tryGet);
|
|
25
|
+
|
|
26
|
+
const data = await fetchData(currentUrl);
|
|
27
|
+
data.title = `${keyword}-搜索结果-${data.title}`;
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
ctx.state.json = response.data.datalist;
|
|
32
30
|
|
|
33
|
-
const info = `虎嗅网 - ${keyword}`;
|
|
34
31
|
ctx.state.data = {
|
|
35
|
-
title: info,
|
|
36
|
-
link,
|
|
37
|
-
description: info,
|
|
38
32
|
item: items,
|
|
33
|
+
...data,
|
|
39
34
|
};
|
|
40
35
|
};
|
package/lib/v2/huxiu/tag.js
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
-
const timezone = require('@/utils/timezone');
|
|
2
|
+
|
|
3
|
+
const { rootUrl, processItems, fetchData } = require('./util');
|
|
6
4
|
|
|
7
5
|
module.exports = async (ctx) => {
|
|
8
6
|
const { id } = ctx.params;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 10;
|
|
8
|
+
|
|
9
|
+
const apiUrl = new URL('v2_action/tag_article_list', rootUrl).href;
|
|
10
|
+
const currentUrl = new URL(`tags/${id}.html`, rootUrl).href;
|
|
11
|
+
|
|
12
|
+
const { data: response } = await got.post(apiUrl, {
|
|
13
|
+
form: {
|
|
14
|
+
tag_id: id,
|
|
13
15
|
},
|
|
14
16
|
});
|
|
15
17
|
|
|
16
|
-
const
|
|
17
|
-
const list = $('.related-article li')
|
|
18
|
-
.toArray()
|
|
19
|
-
.map((e) => {
|
|
20
|
-
e = $(e);
|
|
21
|
-
const a = e.find('a');
|
|
22
|
-
return {
|
|
23
|
-
title: a.text(),
|
|
24
|
-
link: `${utils.baseUrl}${a.attr('href')}`,
|
|
25
|
-
pubDate: timezone(parseDate(e.find('.time').text()), 8),
|
|
26
|
-
};
|
|
27
|
-
});
|
|
18
|
+
const items = await processItems(response.data, limit, ctx.cache.tryGet);
|
|
28
19
|
|
|
29
|
-
const
|
|
20
|
+
const data = await fetchData(currentUrl);
|
|
30
21
|
|
|
31
|
-
const info = `虎嗅 - ${$('h1').text()}`;
|
|
32
22
|
ctx.state.data = {
|
|
33
|
-
title: info,
|
|
34
|
-
link,
|
|
35
|
-
description: info,
|
|
36
23
|
item: items,
|
|
24
|
+
...data,
|
|
37
25
|
};
|
|
38
26
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{{ if (!video || !video.src) && image?.src }}
|
|
2
|
+
<figure>
|
|
3
|
+
<img
|
|
4
|
+
{{ if image.width }}
|
|
5
|
+
width={{ image.width }}
|
|
6
|
+
{{ /if }}
|
|
7
|
+
{{ if image.height }}
|
|
8
|
+
height={{ image.height }}
|
|
9
|
+
{{ /if }}
|
|
10
|
+
src="{{ image.src }}">
|
|
11
|
+
</figure>
|
|
12
|
+
{{ /if }}
|
|
13
|
+
|
|
14
|
+
{{ if audio?.src }}
|
|
15
|
+
<audio controls>
|
|
16
|
+
<source src="{{ audio.src }}" type="{{ audio.type }}">
|
|
17
|
+
</audio>
|
|
18
|
+
{{ /if }}
|
|
19
|
+
|
|
20
|
+
{{ if video?.src }}
|
|
21
|
+
<video
|
|
22
|
+
{{ set poster = video.poster || image?.src }}
|
|
23
|
+
{{ if poster }}
|
|
24
|
+
poster="{{ poster }}"
|
|
25
|
+
{{ /if }}
|
|
26
|
+
controls>
|
|
27
|
+
<source
|
|
28
|
+
src="{{ video.src }}"
|
|
29
|
+
type="{{ video.type }}">
|
|
30
|
+
<object data="{{ video.src }}">
|
|
31
|
+
<embed src="{{ video.src }}">
|
|
32
|
+
</object>
|
|
33
|
+
</video>
|
|
34
|
+
{{ /if }}
|
|
35
|
+
|
|
36
|
+
{{ if preface }}
|
|
37
|
+
{{@ preface }}
|
|
38
|
+
{{ /if }}
|
|
39
|
+
|
|
40
|
+
{{ if summary }}
|
|
41
|
+
{{@ summary }}
|
|
42
|
+
{{ /if }}
|
|
43
|
+
|
|
44
|
+
{{ if description }}
|
|
45
|
+
{{@ description }}
|
|
46
|
+
{{ /if }}
|