rsshub 1.0.0-master.ebff6c5 → 1.0.0-master.ec03e07
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/radar/rules/all.ts +3 -6
- package/lib/api/radar/rules/one.ts +3 -6
- package/lib/app.tsx +2 -0
- package/lib/config.ts +28 -6
- package/lib/errors/index.tsx +10 -3
- package/lib/index.ts +1 -1
- package/lib/middleware/anti-hotlink.test.ts +6 -6
- package/lib/middleware/logger.ts +5 -1
- package/lib/middleware/parameter.test.ts +22 -5
- package/lib/middleware/parameter.ts +47 -17
- package/lib/middleware/template.tsx +14 -10
- package/lib/middleware/trace.ts +25 -0
- package/lib/registry.test.ts +8 -0
- package/lib/registry.ts +8 -0
- package/lib/router.js +0 -3
- package/lib/routes/141jav/index.ts +25 -21
- package/lib/routes/141ppv/index.ts +24 -20
- package/lib/routes/51read/article.ts +82 -0
- package/lib/routes/51read/namespace.ts +6 -0
- package/lib/routes/69shu/article.ts +4 -4
- package/lib/routes/aljazeera/index.ts +2 -2
- package/lib/routes/apnews/rss.ts +2 -1
- package/lib/routes/apnews/sitemap.ts +98 -0
- package/lib/routes/apnews/topics.ts +2 -1
- package/lib/routes/apnews/utils.ts +7 -5
- package/lib/routes/apple/apps.ts +30 -8
- package/lib/routes/asmr-200/index.ts +66 -0
- package/lib/routes/asmr-200/namespace.ts +6 -0
- package/lib/routes/asmr-200/templates/work.art +7 -0
- package/lib/routes/asmr-200/type.ts +96 -0
- package/lib/routes/autocentre/index.ts +29 -0
- package/lib/routes/autocentre/namespace.ts +7 -0
- package/lib/routes/bbc/index.ts +3 -1
- package/lib/routes/bilibili/api-interface.d.ts +1 -0
- package/lib/routes/bilibili/cache.ts +3 -1
- package/lib/routes/bilibili/dynamic.ts +7 -2
- package/lib/routes/bilibili/ranking.ts +2 -1
- package/lib/routes/bilibili/video.ts +2 -1
- package/lib/routes/bing/daily-wallpaper.ts +1 -1
- package/lib/routes/bjnews/cat.ts +43 -0
- package/lib/routes/bjnews/column.ts +43 -0
- package/lib/routes/bjnews/namespace.ts +6 -0
- package/lib/routes/bjnews/utils.ts +19 -0
- package/lib/routes/bjx/fd.ts +35 -26
- package/lib/routes/bluearchive/news.ts +2 -2
- package/lib/routes/bt0/mv.ts +21 -24
- package/lib/routes/bt0/tlist.ts +19 -26
- package/lib/routes/bt0/util.ts +6 -3
- package/lib/routes/buaa/jiaowu.ts +124 -0
- package/lib/routes/buaa/lib/space/newbook.ts +171 -0
- package/lib/routes/buaa/lib/space/templates/newbook.art +44 -0
- package/lib/routes/buaa/news/index.ts +15 -13
- package/lib/routes/buaa/sme.ts +5 -3
- package/lib/routes/cccfna/index.ts +2 -2
- package/lib/routes/cctv/category.ts +16 -12
- package/lib/routes/cctv/xwlb.ts +32 -10
- package/lib/routes/cdu/jwgg.ts +79 -0
- package/lib/routes/cdu/namespace.ts +6 -0
- package/lib/routes/cffex/announcement.ts +73 -0
- package/lib/routes/cffex/namespace.ts +6 -0
- package/lib/routes/chlinlearn/daily-blog.ts +48 -0
- package/lib/routes/chlinlearn/namespcae.ts +6 -0
- package/lib/routes/cnbc/rss.ts +1 -1
- package/lib/routes/copymanga/comic.ts +3 -1
- package/lib/routes/deadbydaylight/index.ts +69 -0
- package/lib/routes/deadbydaylight/namespace.ts +12 -0
- package/lib/routes/devolverdigital/blog.ts +59 -42
- package/lib/routes/digitalcameraworld/news.ts +1 -1
- package/lib/routes/discord/channel.ts +10 -10
- package/lib/routes/discord/discord-api.ts +27 -32
- package/lib/routes/discord/templates/message.art +15 -0
- package/lib/routes/discourse/notifications.ts +2 -1
- package/lib/routes/dockerhub/build.ts +3 -2
- package/lib/routes/dongqiudi/result.ts +1 -1
- package/lib/routes/douban/other/group.ts +2 -1
- package/lib/routes/duckdb/namespace.ts +6 -0
- package/lib/routes/duckdb/news.ts +65 -0
- package/lib/routes/eastmoney/report/index.ts +63 -15
- package/lib/routes/eastmoney/templates/stock_description.art +36 -0
- package/lib/routes/eastmoney/utils.ts +35 -0
- package/lib/routes/epicgames/index.ts +14 -4
- package/lib/routes/fashionnetwork/index.ts +192 -0
- package/lib/routes/fashionnetwork/namespace.ts +8 -0
- package/lib/routes/fashionnetwork/templates/description.art +17 -0
- package/lib/routes/fediverse/timeline.ts +44 -19
- package/lib/routes/flashcat/blog.ts +61 -0
- package/lib/routes/flashcat/namespace.ts +6 -0
- package/lib/routes/foresightnews/util.ts +1 -1
- package/lib/routes/fortunechina/index.ts +24 -14
- package/lib/routes/ftm/index.ts +60 -0
- package/lib/routes/ftm/namespace.ts +6 -0
- package/lib/routes/galxe/index.ts +94 -0
- package/lib/routes/galxe/namespace.ts +9 -0
- package/lib/routes/gdut/oa-news.ts +12 -17
- package/lib/routes/getitfree/util.ts +1 -1
- package/lib/routes/gisreportsonline/index.ts +60 -0
- package/lib/routes/gisreportsonline/namespace.ts +6 -0
- package/lib/routes/github/activity.ts +56 -0
- package/lib/routes/github/issue.ts +3 -2
- package/lib/routes/github/search.ts +20 -18
- package/lib/routes/github/star.ts +4 -3
- package/lib/routes/github/trending.ts +27 -5
- package/lib/routes/google/citations.ts +2 -2
- package/lib/routes/google/research.ts +45 -0
- package/lib/routes/google/scholar.ts +2 -2
- package/lib/routes/gov/chongqing/sydwgkzp.ts +4 -4
- package/lib/routes/gov/lswz/index.ts +289 -0
- package/lib/routes/gov/stats/index.ts +8 -8
- package/lib/routes/gov/zj/ningbogzw-notice.ts +50 -0
- package/lib/routes/gov/zj/ningborsjnotice.ts +50 -0
- package/lib/routes/gq/news.ts +1 -1
- package/lib/routes/gs/developer/blog.ts +58 -0
- package/lib/routes/gs/namespace.ts +9 -0
- package/lib/routes/healthz.ts +8 -0
- package/lib/routes/hitcon/zeroday.ts +1 -1
- package/lib/routes/hket/index.ts +80 -76
- package/lib/routes/hottoys/index.ts +63 -0
- package/lib/routes/hottoys/namespace.ts +6 -0
- package/lib/routes/huxiu/util.ts +2 -2
- package/lib/routes/imhcg/blog.ts +47 -0
- package/lib/routes/imhcg/namespace.ts +7 -0
- package/lib/routes/imop/namespace.ts +10 -0
- package/lib/routes/imop/tianshu.ts +53 -0
- package/lib/routes/infzm/hot.ts +39 -0
- package/lib/routes/infzm/index.ts +3 -30
- package/lib/routes/infzm/utils.ts +34 -0
- package/lib/routes/inspirehep/author.ts +46 -0
- package/lib/routes/inspirehep/literature.ts +42 -0
- package/lib/routes/inspirehep/namespace.ts +7 -0
- package/lib/routes/inspirehep/types.ts +210 -0
- package/lib/routes/inspirehep/utils.ts +15 -0
- package/lib/routes/instagram/private-api/index.ts +20 -3
- package/lib/routes/investor/index.ts +213 -0
- package/lib/routes/investor/namespace.ts +8 -0
- package/lib/routes/iplaysoft/index.ts +68 -0
- package/lib/routes/iplaysoft/namespace.ts +6 -0
- package/lib/routes/iwara/subscriptions.ts +1 -1
- package/lib/routes/j-test/namespace.ts +6 -0
- package/lib/routes/j-test/news.ts +64 -0
- package/lib/routes/japanpost/namespace.ts +7 -1
- package/lib/routes/japanpost/router.ts +40 -0
- package/lib/routes/japanpost/track.ts +1 -23
- package/lib/routes/javbus/index.ts +2 -1
- package/lib/routes/javdb/actors.ts +6 -2
- package/lib/routes/jjwxc/book.ts +4 -3
- package/lib/routes/joins/chinese.ts +218 -0
- package/lib/routes/joins/namespace.ts +8 -0
- package/lib/routes/joins/templates/description.art +17 -0
- package/lib/routes/juejin/dynamic.ts +114 -0
- package/lib/routes/kaopu/news.ts +3 -3
- package/lib/routes/kemono/index.ts +21 -0
- package/lib/routes/keylol/index.ts +56 -11
- package/lib/routes/kurogames/namespace.ts +7 -0
- package/lib/routes/kurogames/wutheringwaves/news.ts +59 -0
- package/lib/routes/kyodonews/index.ts +1 -1
- package/lib/routes/link3/events.ts +86 -0
- package/lib/routes/link3/namespace.ts +6 -0
- package/lib/routes/link3/profile.ts +143 -0
- package/lib/routes/linkedin/cn/renderer.ts +1 -1
- package/lib/routes/lmu/jobs.ts +96 -0
- package/lib/routes/lmu/namespace.ts +17 -0
- package/lib/routes/lmu/templates/jobPosting.art +11 -0
- package/lib/routes/lofter/user.ts +2 -1
- package/lib/routes/luolei/index.ts +1 -1
- package/lib/routes/maccms/index.ts +72 -0
- package/lib/routes/maccms/namespace.ts +9 -0
- package/lib/routes/maccms/type.ts +102 -0
- package/lib/routes/mcmod/index.ts +105 -0
- package/lib/routes/mcmod/namespace.ts +6 -0
- package/lib/routes/mcmod/templates/mod.art +13 -0
- package/lib/routes/metacritic/index.ts +10 -0
- package/lib/routes/metrics.ts +12 -0
- package/lib/routes/microsoft/mcr.ts +1 -1
- package/lib/routes/mihoyo/bbs/img-ranking.ts +4 -4
- package/lib/routes/mihoyo/bbs/static-data.ts +7 -0
- package/lib/routes/minecraft/version.ts +1 -1
- package/lib/routes/mirrormedia/category.ts +101 -0
- package/lib/routes/mirrormedia/index.ts +43 -0
- package/lib/routes/mirrormedia/namespace.ts +6 -0
- package/lib/routes/mirrormedia/utils.ts +19 -0
- package/lib/routes/misskey/user-timeline.ts +42 -0
- package/lib/routes/misskey/utils.ts +41 -1
- package/lib/routes/nasa/apod.ts +4 -3
- package/lib/routes/nasa/namespace.ts +1 -1
- package/lib/routes/nationalgeographic/latest-stories.ts +1 -1
- package/lib/routes/nationalgeographic/templates/stories.art +1 -1
- package/lib/routes/neea/index.ts +47 -19
- package/lib/routes/neea/jlpt.ts +12 -15
- package/lib/routes/neea/namespace.ts +2 -2
- package/lib/routes/newyorker/news.ts +24 -17
- package/lib/routes/nextjs/blog.ts +63 -0
- package/lib/routes/nextjs/namespace.ts +6 -0
- package/lib/routes/nga/forum.ts +3 -2
- package/lib/routes/notion/release.ts +81 -0
- package/lib/routes/nyaa/main.ts +2 -3
- package/lib/routes/nyaa/namespace.ts +10 -0
- package/lib/routes/oschina/news.ts +2 -0
- package/lib/routes/people/index.ts +4 -2
- package/lib/routes/picnob/namespace.ts +1 -4
- package/lib/routes/picnob/user.ts +3 -2
- package/lib/routes/picuki/namespace.ts +1 -4
- package/lib/routes/picuki/profile.ts +11 -7
- package/lib/routes/pixiv/ranking.ts +2 -1
- package/lib/routes/pixiv/search.ts +22 -2
- package/lib/routes/pixiv/user.ts +2 -1
- package/lib/routes/pixiv/utils.ts +3 -3
- package/lib/routes/ps/monthly-games.ts +3 -2
- package/lib/routes/psyche/topic.ts +1 -1
- package/lib/routes/psyche/type.ts +1 -1
- package/lib/routes/psyche/utils.ts +1 -1
- package/lib/routes/qidian/chapter.ts +4 -3
- package/lib/routes/questn/community.ts +76 -0
- package/lib/routes/questn/events.ts +101 -0
- package/lib/routes/questn/namespace.ts +6 -0
- package/lib/routes/questn/util.ts +16 -0
- package/lib/routes/raycast/changelog.ts +54 -0
- package/lib/routes/raycast/namespace.ts +7 -0
- package/lib/routes/react/blog.ts +57 -0
- package/lib/routes/react/namespace.ts +6 -0
- package/lib/routes/readwise/list.ts +152 -0
- package/lib/routes/readwise/namespace.ts +6 -0
- package/lib/routes/rebase/geekdaily.ts +35 -0
- package/lib/routes/rebase/namespace.ts +6 -0
- package/lib/routes/reuters/common.ts +2 -1
- package/lib/routes/rss3/index.ts +157 -0
- package/lib/routes/rss3/interfaces/metadata.ts +67 -0
- package/lib/routes/rss3/namespace.ts +7 -0
- package/lib/routes/rsshub/routes.ts +20 -13
- package/lib/routes/samd/news.ts +1 -1
- package/lib/routes/sara/index.ts +1 -1
- package/lib/routes/sciencedirect/cf-email.ts +0 -1
- package/lib/routes/scut/gzic/media.ts +71 -0
- package/lib/routes/scut/gzic/news.ts +65 -0
- package/lib/routes/scut/gzic/notice.ts +88 -0
- package/lib/routes/shiep/config.ts +4 -10
- package/lib/routes/shiep/index.ts +9 -9
- package/lib/routes/showstart/artist.ts +5 -4
- package/lib/routes/showstart/brand.ts +5 -4
- package/lib/routes/showstart/event.ts +8 -7
- package/lib/routes/showstart/search.ts +43 -9
- package/lib/routes/showstart/service.ts +81 -53
- package/lib/routes/showstart/site.ts +41 -0
- package/lib/routes/showstart/utils.ts +9 -8
- package/lib/routes/sjtu/jwc.ts +4 -1
- package/lib/routes/sjtu/yzb/zkxx.ts +36 -16
- package/lib/routes/smzdm/keyword.ts +3 -2
- package/lib/routes/smzdm/product.ts +86 -0
- package/lib/routes/smzdm/ranking.ts +180 -46
- package/lib/routes/spotify/artist.ts +3 -2
- package/lib/routes/spotify/playlist.ts +3 -2
- package/lib/routes/spotify/show.ts +1 -1
- package/lib/routes/springer/journal.ts +10 -12
- package/lib/routes/sse/sselawsrules.ts +370 -0
- package/lib/routes/sspai/author.ts +1 -1
- package/lib/routes/sspai/column.ts +1 -1
- package/lib/routes/sspai/index.ts +4 -3
- package/lib/routes/sspai/matrix.ts +1 -1
- package/lib/routes/sspai/series-update.ts +1 -1
- package/lib/routes/sspai/tag.ts +1 -1
- package/lib/routes/sspai/topic.ts +1 -1
- package/lib/routes/sustainabilitymag/articles.ts +2 -0
- package/lib/routes/szse/rule.ts +315 -42
- package/lib/routes/t66y/index.ts +29 -7
- package/lib/routes/techcrunch/news.ts +20 -29
- package/lib/routes/techcrunch/templates/description.art +7 -0
- package/lib/routes/telecompaper/news.ts +1 -1
- package/lib/routes/telegram/channel.ts +38 -4
- package/lib/routes/test/index.ts +6 -36
- package/lib/routes/the/index.ts +210 -0
- package/lib/routes/the/namespace.ts +8 -0
- package/lib/routes/the/templates/description.art +27 -0
- package/lib/routes/the/util.ts +307 -0
- package/lib/routes/thoughtworks/index.ts +71 -0
- package/lib/routes/thoughtworks/namespace.ts +6 -0
- package/lib/routes/towardsdatascience/latest.ts +67 -0
- package/lib/routes/towardsdatascience/namespace.ts +6 -0
- package/lib/routes/tsdm39/bd.ts +101 -0
- package/lib/routes/tsdm39/namespace.ts +7 -0
- package/lib/routes/tvb/news.ts +1 -0
- package/lib/routes/twitter/api/index.ts +3 -1
- package/lib/routes/twitter/api/mobile-api/login.ts +155 -131
- package/lib/routes/twitter/api/web-api/api.ts +19 -0
- package/lib/routes/twitter/api/web-api/constants.ts +2 -0
- package/lib/routes/twitter/api/web-api/login.ts +66 -0
- package/lib/routes/twitter/api/web-api/utils.ts +98 -52
- package/lib/routes/twitter/home-latest.ts +60 -0
- package/lib/routes/twitter/home.ts +2 -2
- package/lib/routes/twitter/keyword.ts +3 -2
- package/lib/routes/twitter/likes.ts +1 -1
- package/lib/routes/twitter/list.ts +1 -1
- package/lib/routes/twitter/media.ts +4 -3
- package/lib/routes/twitter/namespace.ts +2 -2
- package/lib/routes/twitter/user.ts +5 -4
- package/lib/routes/twitter/utils.ts +4 -1
- package/lib/routes/uber/blog.ts +1 -1
- package/lib/routes/udn/breaking-news.ts +9 -0
- package/lib/routes/ustc/scms.ts +97 -0
- package/lib/routes/utgd/category.ts +18 -59
- package/lib/routes/utgd/timeline.ts +9 -45
- package/lib/routes/utgd/topic.ts +9 -51
- package/lib/routes/utgd/utils.ts +41 -0
- package/lib/routes/v2ex/tab.ts +3 -2
- package/lib/routes/v2ex/topics.ts +18 -3
- package/lib/routes/v2ex/xna.ts +55 -0
- package/lib/routes/watasuke/blog.ts +1 -1
- package/lib/routes/wchscu/namespace.ts +6 -0
- package/lib/routes/wchscu/recruit.ts +73 -0
- package/lib/routes/weibo/keyword.ts +3 -2
- package/lib/routes/weibo/namespace.ts +1 -1
- package/lib/routes/weibo/search/hot.ts +12 -7
- package/lib/routes/weibo/user.ts +2 -1
- package/lib/routes/weibo/utils.ts +20 -0
- package/lib/routes/wfu/news.ts +1 -1
- package/lib/routes/wordpress/util.ts +1 -1
- package/lib/routes/xiaohongshu/notes.ts +10 -2
- package/lib/routes/xiaohongshu/user.ts +23 -2
- package/lib/routes/xiaoyuzhou/podcast.ts +2 -1
- package/lib/routes/xidian/cs.ts +143 -0
- package/lib/routes/xidian/gr.ts +289 -0
- package/lib/routes/xidian/jwc.ts +1 -0
- package/lib/routes/xidian/namespace.ts +1 -1
- package/lib/routes/xinhuanet/app.ts +109 -0
- package/lib/routes/xinhuanet/namespace.ts +8 -0
- package/lib/routes/xsijishe/forum.ts +5 -0
- package/lib/routes/xsijishe/rank.ts +23 -3
- package/lib/routes/yahoo/news/index.ts +149 -0
- package/lib/routes/yahoo/news/listid.ts +67 -0
- package/lib/routes/yahoo/news/{tw/provider-helper.ts → provider-helper.ts} +9 -4
- package/lib/routes/yahoo/news/{tw/provider.ts → provider.ts} +21 -6
- package/lib/routes/yahoo/news/{tw/utils.ts → utils.ts} +24 -15
- package/lib/routes/yicai/carousel.ts +48 -0
- package/lib/routes/yicai/utils.ts +23 -17
- package/lib/routes/youtube/subscriptions.ts +1 -0
- package/lib/routes/youtube/user.ts +2 -1
- package/lib/routes/yystv/docs.ts +28 -19
- package/lib/routes/zcool/discover.ts +2 -1
- package/lib/routes/zhihu/activities.ts +2 -1
- package/lib/routes/zhihu/answers.ts +5 -1
- package/lib/routes/zhihu/execlib/x-zse-96-v3.ts +2 -0
- package/lib/routes/zhihu/hot.ts +56 -7
- package/lib/routes/zhihu/namespace.ts +3 -0
- package/lib/routes/zhihu/utils.ts +16 -6
- package/lib/routes/zhuwang/index.ts +1 -1
- package/lib/routes/zsxq/types.ts +9 -0
- package/lib/routes/zsxq/utils.ts +4 -3
- package/lib/routes.test.ts +11 -5
- package/lib/setup.test.ts +1 -1
- package/lib/types.ts +20 -0
- package/lib/utils/cache/index.ts +8 -0
- package/lib/utils/camelcase-keys.spec.ts +127 -0
- package/lib/utils/camelcase-keys.ts +27 -0
- package/lib/utils/common-utils.ts +1 -0
- package/lib/utils/ofetch.ts +14 -0
- package/lib/utils/otel/index.ts +2 -0
- package/lib/utils/otel/metric.ts +66 -0
- package/lib/utils/otel/trace.ts +28 -0
- package/lib/utils/request-rewriter/fetch.ts +8 -1
- package/lib/views/atom.tsx +2 -2
- package/lib/views/error.tsx +3 -3
- package/lib/views/index.tsx +4 -3
- package/lib/views/json.ts +1 -1
- package/lib/views/layout.tsx +1 -1
- package/lib/views/rss.tsx +2 -2
- package/package.json +60 -48
- package/lib/routes/moduzy/index.ts +0 -80
- package/lib/routes/moduzy/namespace.ts +0 -17
- package/lib/routes/moduzy/type.ts +0 -95
- package/lib/routes/sse/lawandrules.ts +0 -68
- package/lib/routes/yahoo/news/tw/index.ts +0 -80
- package/lib/routes/yahoo/news/us/index.ts +0 -55
- package/lib/routes/zhihu/hotlist.ts +0 -72
- package/lib/routes-deprecated/bjnews/news.js +0 -44
- package/lib/routes-deprecated/iplay/home.js +0 -26
- package/lib/routes-deprecated/iplay/utils.js +0 -57
- /package/lib/routes/{moduzy → maccms}/templates/vod.art +0 -0
package/lib/routes/hket/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Route } from '@/types';
|
|
1
|
+
import { DataItem, Route } from '@/types';
|
|
2
2
|
import { getCurrentPath } from '@/utils/helpers';
|
|
3
3
|
const __dirname = getCurrentPath(import.meta.url);
|
|
4
4
|
|
|
5
5
|
import cache from '@/utils/cache';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import ofetch from '@/utils/ofetch';
|
|
7
|
+
import * as cheerio from 'cheerio';
|
|
8
8
|
import { parseDate } from '@/utils/parse-date';
|
|
9
9
|
import timezone from '@/utils/timezone';
|
|
10
10
|
import path from 'node:path';
|
|
@@ -39,9 +39,13 @@ export const route: Route = {
|
|
|
39
39
|
supportScihub: false,
|
|
40
40
|
},
|
|
41
41
|
radar: [
|
|
42
|
+
{
|
|
43
|
+
source: ['china.hket.com/:category/*', 'inews.hket.com/:category/*', 'topick.hket.com/:category/*', 'wealth.hket.com/:category/*'],
|
|
44
|
+
target: '/:category',
|
|
45
|
+
},
|
|
42
46
|
{
|
|
43
47
|
source: ['www.hket.com/'],
|
|
44
|
-
target: '',
|
|
48
|
+
target: '/',
|
|
45
49
|
},
|
|
46
50
|
],
|
|
47
51
|
name: '新闻',
|
|
@@ -55,57 +59,57 @@ export const route: Route = {
|
|
|
55
59
|
<details>
|
|
56
60
|
<summary>分类</summary>
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
| sran001 | sran008 | sran010 | sran011 | sran012 | srat006 |
|
|
63
|
+
| -------- | -------- | -------- | -------- | -------- | -------- |
|
|
64
|
+
| 全部新闻 | 财经地产 | 科技信息 | 国际新闻 | 商业新闻 | 香港新闻 |
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
| sran009 | sran009-1 | sran009-2 | sran009-3 | sran009-4 | sran009-5 | sran009-6 |
|
|
67
|
+
| -------- | --------- | --------- | ---------- | --------- | --------- | --------- |
|
|
68
|
+
| 即时财经 | 股市 | 新股 IPO | 新经济追踪 | 当炒股 | 宏观解读 | Hot Talk |
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
| sran011-1 | sran011-2 | sran011-3 |
|
|
71
|
+
| --------- | ------------ | ------------ |
|
|
72
|
+
| 环球政治 | 环球经济金融 | 环球社会热点 |
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
| sran016 | sran016-1 | sran016-2 | sran016-3 | sran016-4 | sran016-5 |
|
|
75
|
+
| ---------- | ---------- | ---------- | ---------- | ---------- | -------------- |
|
|
76
|
+
| 大湾区主页 | 大湾区发展 | 大湾区工作 | 大湾区买楼 | 大湾区消费 | 大湾区投资理财 |
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
| srac002 | srac003 | srac004 | srac005 |
|
|
79
|
+
| -------- | -------- | -------- | -------- |
|
|
80
|
+
| 即时中国 | 经济脉搏 | 国情动向 | 社会热点 |
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
| srat001 | srat008 | srat055 | srat069 | srat070 |
|
|
83
|
+
| ------- | ------- | -------- | -------- | --------- |
|
|
84
|
+
| 话题 | 观点 | 休闲消费 | 娱乐新闻 | TOPick TV |
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
| srat052 | srat052-1 | srat052-2 | srat052-3 |
|
|
87
|
+
| -------- | --------- | ---------- | --------- |
|
|
88
|
+
| 健康主页 | 食用安全 | 医生诊症室 | 保健美颜 |
|
|
85
89
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
| srat053 | srat053-1 | srat053-2 | srat053-3 | srat053-4 |
|
|
91
|
+
| -------- | --------- | --------- | --------- | ---------- |
|
|
92
|
+
| 亲子主页 | 儿童健康 | 育儿经 | 教育 | 亲子好去处 |
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
| srat053-6 | srat053-61 | srat053-62 | srat053-63 | srat053-64 |
|
|
95
|
+
| ----------- | ---------- | ---------- | ---------- | ---------- |
|
|
96
|
+
| Band 1 学堂 | 幼稚园 | 中小学 | 尖子教室 | 海外升学 |
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
| srat072-1 | srat072-2 | srat072-3 | srat072-4 |
|
|
99
|
+
| ---------- | ---------- | ---------------- | ----------------- |
|
|
100
|
+
| 健康身心活 | 抗癌新方向 | 「糖」「心」解密 | 风湿不再 你我自在 |
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
| sraw007 | sraw009 | sraw010 | sraw011 | sraw012 | sraw014 | sraw018 | sraw019 |
|
|
103
|
+
| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
|
104
|
+
| 全部博客 | Bloggers | 收息攻略 | 精明消费 | 退休规划 | 个人增值 | 财富管理 | 绿色金融 |
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
| sraw015 | sraw015-07 | sraw015-08 | sraw015-09 | sraw015-10 |
|
|
107
|
+
| -------- | ---------- | ---------- | ---------- | ---------- |
|
|
108
|
+
| 移民百科 | 海外置业 | 移民攻略 | 移民点滴 | 海外理财 |
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
| sraw020 | sraw020-1 | sraw020-2 | sraw020-3 | sraw020-4 |
|
|
111
|
+
| -------- | ------------ | --------- | --------- | --------- |
|
|
112
|
+
| ESG 主页 | ESG 趋势政策 | ESG 投资 | ESG 企业 | ESG 社会 |
|
|
109
113
|
</details>`,
|
|
110
114
|
};
|
|
111
115
|
|
|
@@ -113,49 +117,45 @@ async function handler(ctx) {
|
|
|
113
117
|
const { category = 'sran001' } = ctx.req.param();
|
|
114
118
|
const baseUrl = urlMap[category.substring(0, 4)].baseUrl;
|
|
115
119
|
|
|
116
|
-
const
|
|
120
|
+
const response = await ofetch(`${baseUrl}/${category}`);
|
|
117
121
|
|
|
118
|
-
const $ = load(response);
|
|
122
|
+
const $ = cheerio.load(response);
|
|
119
123
|
|
|
120
124
|
const list = $('div.listing-title > a')
|
|
121
125
|
.toArray()
|
|
122
126
|
.map((item) => {
|
|
123
127
|
item = $(item);
|
|
128
|
+
const url = item.parent().parent().find('.share-button').data('url');
|
|
124
129
|
return {
|
|
125
130
|
title: item.text().trim(),
|
|
126
|
-
link:
|
|
127
|
-
? // remove tracking parameters
|
|
128
|
-
baseUrl + item.attr('href').split('?')[0].substring(0, item.attr('href').lastIndexOf('/'))
|
|
129
|
-
: item.attr('href').split('?')[0].substring(0, item.attr('href').lastIndexOf('/')),
|
|
131
|
+
link: url.startsWith('http') ? url : baseUrl + url,
|
|
130
132
|
};
|
|
131
|
-
});
|
|
133
|
+
}) as DataItem[];
|
|
132
134
|
|
|
133
135
|
const items = await Promise.all(
|
|
134
136
|
list.map((item) =>
|
|
135
|
-
cache.tryGet(item.link
|
|
136
|
-
if (item.link
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
data = await (item.link.startsWith('https://invest.hket.com/')
|
|
140
|
-
? got.post('https://invest.hket.com/content-api-middleware/content', {
|
|
137
|
+
cache.tryGet(item.link!, async () => {
|
|
138
|
+
if (item.link!.startsWith('https://invest.hket.com/') || item.link!.startsWith('https://ps.hket.com/')) {
|
|
139
|
+
const data = await (item.link!.startsWith('https://invest.hket.com/')
|
|
140
|
+
? ofetch('https://invest.hket.com/content-api-middleware/content', {
|
|
141
141
|
headers: {
|
|
142
|
-
referer: item.link
|
|
142
|
+
referer: item.link!,
|
|
143
143
|
},
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
method: 'POST',
|
|
145
|
+
body: {
|
|
146
|
+
id: item.link!.split('/').pop(),
|
|
146
147
|
channel: 'invest',
|
|
147
148
|
},
|
|
148
149
|
})
|
|
149
|
-
:
|
|
150
|
+
: ofetch('https://data02.hket.com/content', {
|
|
150
151
|
headers: {
|
|
151
|
-
referer: item.link
|
|
152
|
+
referer: item.link!,
|
|
152
153
|
},
|
|
153
|
-
|
|
154
|
-
id: item.link
|
|
154
|
+
query: {
|
|
155
|
+
id: item.link!.split('/').pop(),
|
|
155
156
|
channel: 'epc',
|
|
156
157
|
},
|
|
157
158
|
}));
|
|
158
|
-
data = data.data;
|
|
159
159
|
|
|
160
160
|
item.pubDate = timezone(parseDate(data.displayDate), +8);
|
|
161
161
|
item.updated = timezone(parseDate(data.lastModifiedDate), +8);
|
|
@@ -166,8 +166,8 @@ async function handler(ctx) {
|
|
|
166
166
|
return item;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
const
|
|
170
|
-
const $ = load(response);
|
|
169
|
+
const response = await ofetch(item.link!);
|
|
170
|
+
const $ = cheerio.load(response);
|
|
171
171
|
|
|
172
172
|
item.category = $('.contentTags-container > .hotkey-container-wrapper > .hotkey-container > a')
|
|
173
173
|
.toArray()
|
|
@@ -194,28 +194,32 @@ async function handler(ctx) {
|
|
|
194
194
|
e = $(e);
|
|
195
195
|
e.replaceWith(
|
|
196
196
|
art(path.join(__dirname, 'templates/image.art'), {
|
|
197
|
-
alt: e.
|
|
198
|
-
src: e.
|
|
197
|
+
alt: e.data('alt'),
|
|
198
|
+
src: e.data('src') ?? e.attr('src'),
|
|
199
199
|
})
|
|
200
200
|
);
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
const ldJson = JSON.parse(
|
|
204
|
+
$('script[type="application/ld+json"]')
|
|
205
|
+
.toArray()
|
|
206
|
+
.find((e) => $(e).text().includes('NewsArticle'))?.children[0].data
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
item.description = $('div.article-detail-body-container').html()!;
|
|
210
|
+
item.pubDate = parseDate(ldJson.datePublished);
|
|
211
|
+
item.updated = parseDate(ldJson.dateModified);
|
|
205
212
|
|
|
206
213
|
return item;
|
|
207
214
|
})
|
|
208
215
|
)
|
|
209
216
|
);
|
|
210
217
|
|
|
211
|
-
|
|
212
|
-
title: $('head meta[name=title]').attr('content')
|
|
218
|
+
return {
|
|
219
|
+
title: $('head meta[name=title]').attr('content')?.trim(),
|
|
213
220
|
link: baseUrl + '/' + category,
|
|
214
|
-
description: $('head meta[name=description]').attr('content')
|
|
221
|
+
description: $('head meta[name=description]').attr('content')?.trim(),
|
|
215
222
|
item: items,
|
|
216
223
|
language: 'zh-hk',
|
|
217
224
|
};
|
|
218
|
-
|
|
219
|
-
ctx.set('json', ret);
|
|
220
|
-
return ret;
|
|
221
225
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import { load } from 'cheerio';
|
|
3
|
+
import puppeteer from '@/utils/puppeteer';
|
|
4
|
+
|
|
5
|
+
export const route: Route = {
|
|
6
|
+
path: '/',
|
|
7
|
+
categories: ['shopping'],
|
|
8
|
+
example: '/hottoys',
|
|
9
|
+
radar: [
|
|
10
|
+
{
|
|
11
|
+
source: ['hottoys.com.hk/'],
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
name: 'Toys List',
|
|
15
|
+
maintainers: ['jw0903'],
|
|
16
|
+
handler,
|
|
17
|
+
url: 'hottoys.com.hk/',
|
|
18
|
+
features: {
|
|
19
|
+
requirePuppeteer: true,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
async function handler() {
|
|
24
|
+
const baseUrl = 'https://www.hottoys.com.hk';
|
|
25
|
+
|
|
26
|
+
// 导入 puppeteer 工具类并初始化浏览器实例
|
|
27
|
+
const browser = await puppeteer();
|
|
28
|
+
// 打开一个新标签页
|
|
29
|
+
const page = await browser.newPage();
|
|
30
|
+
// 拦截所有请求
|
|
31
|
+
await page.setRequestInterception(true);
|
|
32
|
+
|
|
33
|
+
page.on('request', (request) => {
|
|
34
|
+
// 在这次例子,我们只允许 HTML 请求
|
|
35
|
+
request.resourceType() === 'document' ? request.continue() : request.abort();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
await page.goto(baseUrl, {
|
|
39
|
+
waitUntil: 'domcontentloaded',
|
|
40
|
+
});
|
|
41
|
+
const response = await page.content();
|
|
42
|
+
page.close();
|
|
43
|
+
const $ = load(response);
|
|
44
|
+
const items = $('li.productListItem')
|
|
45
|
+
.toArray()
|
|
46
|
+
.map((item) => {
|
|
47
|
+
const dom = $(item);
|
|
48
|
+
const a = dom.find('a').first();
|
|
49
|
+
const img = dom.find('img').first();
|
|
50
|
+
return {
|
|
51
|
+
title: img.attr('title') ?? 'hottoys',
|
|
52
|
+
link: `${baseUrl}/${a.attr('href')}`,
|
|
53
|
+
description: `<img src="${baseUrl}${img.attr('src')}" />`,
|
|
54
|
+
guid: a.attr('href'),
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
browser.close();
|
|
58
|
+
return {
|
|
59
|
+
title: 'Hot Toys New Products',
|
|
60
|
+
link: baseUrl,
|
|
61
|
+
item: items,
|
|
62
|
+
};
|
|
63
|
+
}
|
package/lib/routes/huxiu/util.ts
CHANGED
|
@@ -188,7 +188,7 @@ const fetchItem = async (item) => {
|
|
|
188
188
|
const { data: detailResponse } = await got(item.link);
|
|
189
189
|
|
|
190
190
|
const state = parseInitialState(detailResponse);
|
|
191
|
-
const data = state
|
|
191
|
+
const data = state?.briefStoreModule?.brief_detail.brief ?? state?.articleDetail?.articleDetail ?? undefined;
|
|
192
192
|
|
|
193
193
|
if (!data) {
|
|
194
194
|
return item;
|
|
@@ -376,7 +376,7 @@ const processItems = async (items, limit, tryGet) => {
|
|
|
376
376
|
}),
|
|
377
377
|
author: item.user_info?.username ?? item.brief_column?.name ?? item.author_info?.username ?? item.author,
|
|
378
378
|
guid,
|
|
379
|
-
pubDate: item.publish_time ?? item.dateline ? parseDate(item.publish_time ?? item.dateline, 'X') : undefined,
|
|
379
|
+
pubDate: (item.publish_time ?? item.dateline) ? parseDate(item.publish_time ?? item.dateline, 'X') : undefined,
|
|
380
380
|
upvotes: Number.parseInt(upvotes, 10),
|
|
381
381
|
downvotes: Number.parseInt(downvotes, 10),
|
|
382
382
|
comments: Number.parseInt(comments, 10),
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Route, ViewType } from '@/types';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
|
+
import { load } from 'cheerio';
|
|
4
|
+
|
|
5
|
+
export const route: Route = {
|
|
6
|
+
path: '/',
|
|
7
|
+
categories: ['blog'],
|
|
8
|
+
view: ViewType.Notifications,
|
|
9
|
+
example: '/imhcg',
|
|
10
|
+
parameters: {},
|
|
11
|
+
radar: [
|
|
12
|
+
{
|
|
13
|
+
source: ['infos.imhcg.cn'],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
name: 'Engineering blogs',
|
|
17
|
+
maintainers: ['ZiHao256'],
|
|
18
|
+
handler,
|
|
19
|
+
url: 'https://infos.imhcg.cn/',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
async function handler() {
|
|
23
|
+
const response = await ofetch('https://infos.imhcg.cn/');
|
|
24
|
+
const $ = load(response);
|
|
25
|
+
const items = $('li')
|
|
26
|
+
.toArray()
|
|
27
|
+
.map((item) => {
|
|
28
|
+
const title = $(item).find('a.title').text();
|
|
29
|
+
const link = $(item).find('a.title').attr('href');
|
|
30
|
+
const author = $(item).find('p.author').text();
|
|
31
|
+
const time = $(item).find('p.time').text();
|
|
32
|
+
const description = $(item).find('p.text').text();
|
|
33
|
+
return {
|
|
34
|
+
title,
|
|
35
|
+
link,
|
|
36
|
+
author,
|
|
37
|
+
time,
|
|
38
|
+
description,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
title: `Engineering Blogs`,
|
|
44
|
+
link: 'https://infos.imhcg.cn/',
|
|
45
|
+
item: items,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import { load } from 'cheerio';
|
|
3
|
+
import got from '@/utils/got';
|
|
4
|
+
import iconv from 'iconv-lite';
|
|
5
|
+
import cache from '@/utils/cache';
|
|
6
|
+
|
|
7
|
+
const baseUrl = 'http://t.imop.com';
|
|
8
|
+
|
|
9
|
+
export const route: Route = {
|
|
10
|
+
path: '/tianshu',
|
|
11
|
+
categories: ['game'],
|
|
12
|
+
example: '/imop/tianshu',
|
|
13
|
+
radar: [
|
|
14
|
+
{
|
|
15
|
+
source: ['t.imop.com'],
|
|
16
|
+
target: '/tianshu',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
name: '全部消息',
|
|
20
|
+
maintainers: ['zhkgo'],
|
|
21
|
+
handler,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
async function handler() {
|
|
25
|
+
const { data: response } = await got(`${baseUrl}/list/0-1.htm`, { responseType: 'buffer' });
|
|
26
|
+
const $ = load(iconv.decode(response, 'gbk'));
|
|
27
|
+
const list = $('.right .right_top .right_bot .list2 .ul1 ul')
|
|
28
|
+
.toArray()
|
|
29
|
+
.map((item) => {
|
|
30
|
+
item = $(item);
|
|
31
|
+
const href: string = item.find('a').attr('href');
|
|
32
|
+
return {
|
|
33
|
+
title: item.find('a').text(),
|
|
34
|
+
link: href.startsWith('http') ? href : `${baseUrl}${href}`,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
const items = await Promise.all(
|
|
38
|
+
list.map((item) =>
|
|
39
|
+
cache.tryGet(item.link, async () => {
|
|
40
|
+
const { data: response } = await got(item.link, { responseType: 'buffer' });
|
|
41
|
+
const $ = load(iconv.decode(response, 'gbk'));
|
|
42
|
+
item.description = $('.right .right_top .right_bot .articlebox').html();
|
|
43
|
+
return item;
|
|
44
|
+
})
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
title: '天书最新消息',
|
|
50
|
+
link: `${baseUrl}/list/0-1.htm`,
|
|
51
|
+
item: items,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Data, DataItem, Route } from '@/types';
|
|
2
|
+
import type { ContentsResponse } from './types';
|
|
3
|
+
import got from '@/utils/got';
|
|
4
|
+
import { fetchArticles } from './utils';
|
|
5
|
+
|
|
6
|
+
export const route: Route = {
|
|
7
|
+
path: '/hot',
|
|
8
|
+
parameters: {},
|
|
9
|
+
categories: ['traditional-media'],
|
|
10
|
+
example: '/infzm/hot',
|
|
11
|
+
radar: [
|
|
12
|
+
{
|
|
13
|
+
source: ['infzm.com/'],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
name: '热门文章',
|
|
17
|
+
maintainers: ['KarasuShin', 'ranpox', 'xyqfer'],
|
|
18
|
+
handler,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
async function handler(): Promise<Data> {
|
|
22
|
+
const link = 'https://www.infzm.com/';
|
|
23
|
+
const { data } = await got<ContentsResponse>({
|
|
24
|
+
method: 'get',
|
|
25
|
+
url: `https://www.infzm.com/hot_contents`,
|
|
26
|
+
headers: {
|
|
27
|
+
Referer: link,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const resultItem = await fetchArticles(data.data.hot_contents);
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
title: `南方周末-热门文章`,
|
|
35
|
+
link,
|
|
36
|
+
image: 'https://www.infzm.com/favicon.ico',
|
|
37
|
+
item: resultItem as DataItem[],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { Data, DataItem, Route } from '@/types';
|
|
2
2
|
import type { ContentsResponse } from './types';
|
|
3
|
-
import { config } from '@/config';
|
|
4
3
|
import got from '@/utils/got';
|
|
5
|
-
import {
|
|
6
|
-
import timezone from '@/utils/timezone';
|
|
7
|
-
import cache from '@/utils/cache';
|
|
4
|
+
import { fetchArticles } from './utils';
|
|
8
5
|
|
|
9
6
|
export const route: Route = {
|
|
10
7
|
path: '/:id',
|
|
@@ -27,7 +24,7 @@ export const route: Route = {
|
|
|
27
24
|
| 1 | 2 | 3 | 4 | 7 | 8 | 6 | 5 | 131 |`,
|
|
28
25
|
};
|
|
29
26
|
|
|
30
|
-
const baseUrl = 'https://www.infzm.com/contents';
|
|
27
|
+
export const baseUrl = 'https://www.infzm.com/contents';
|
|
31
28
|
|
|
32
29
|
async function handler(ctx): Promise<Data> {
|
|
33
30
|
const id = ctx.req.param('id');
|
|
@@ -40,31 +37,7 @@ async function handler(ctx): Promise<Data> {
|
|
|
40
37
|
},
|
|
41
38
|
});
|
|
42
39
|
|
|
43
|
-
const resultItem = await
|
|
44
|
-
data.data.contents.map(({ id, subject, author, publish_time }) => {
|
|
45
|
-
const link = `${baseUrl}/${id}`;
|
|
46
|
-
|
|
47
|
-
return cache.tryGet(link, async () => {
|
|
48
|
-
const cookie = config.infzm.cookie;
|
|
49
|
-
const response = await got.get<string>({
|
|
50
|
-
method: 'get',
|
|
51
|
-
url: link,
|
|
52
|
-
headers: {
|
|
53
|
-
Referer: link,
|
|
54
|
-
Cookie: cookie || `passport_session=${Math.floor(Math.random() * 100)};`,
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
const $ = load(response.data);
|
|
58
|
-
return {
|
|
59
|
-
title: subject,
|
|
60
|
-
description: $('div.nfzm-content__content').html() ?? '',
|
|
61
|
-
pubDate: timezone(publish_time, +8).toUTCString(),
|
|
62
|
-
link,
|
|
63
|
-
author,
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
})
|
|
67
|
-
);
|
|
40
|
+
const resultItem = await fetchArticles(data.data.contents);
|
|
68
41
|
|
|
69
42
|
return {
|
|
70
43
|
title: `南方周末-${data.data.current_term.title}`,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { config } from '@/config';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
3
|
+
import got from '@/utils/got';
|
|
4
|
+
import timezone from '@/utils/timezone';
|
|
5
|
+
import { load } from 'cheerio';
|
|
6
|
+
import { baseUrl } from '.';
|
|
7
|
+
|
|
8
|
+
export async function fetchArticles(data) {
|
|
9
|
+
return await Promise.all(
|
|
10
|
+
data.map(({ id, subject, author, publish_time }) => {
|
|
11
|
+
const link = `${baseUrl}/${id}`;
|
|
12
|
+
|
|
13
|
+
return cache.tryGet(link, async () => {
|
|
14
|
+
const cookie = config.infzm.cookie;
|
|
15
|
+
const response = await got.get<string>({
|
|
16
|
+
method: 'get',
|
|
17
|
+
url: link,
|
|
18
|
+
headers: {
|
|
19
|
+
Referer: link,
|
|
20
|
+
Cookie: cookie || `passport_session=${Math.floor(Math.random() * 100)};`,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const $ = load(response.data);
|
|
24
|
+
return {
|
|
25
|
+
title: subject,
|
|
26
|
+
description: $('div.nfzm-content__content').html() ?? '',
|
|
27
|
+
pubDate: timezone(publish_time, +8).toUTCString(),
|
|
28
|
+
link,
|
|
29
|
+
author,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import ofetch from '@/utils/ofetch';
|
|
3
|
+
import { AuthorResponse, LiteratureResponse } from './types';
|
|
4
|
+
import cache from '@/utils/cache';
|
|
5
|
+
|
|
6
|
+
import { baseUrl, parseLiterature } from './utils';
|
|
7
|
+
|
|
8
|
+
export const route: Route = {
|
|
9
|
+
path: '/authors/:id',
|
|
10
|
+
example: '/inspirehep/authors/1696909',
|
|
11
|
+
parameters: { id: 'Author ID' },
|
|
12
|
+
name: 'Author Search',
|
|
13
|
+
maintainers: ['TonyRL'],
|
|
14
|
+
radar: [
|
|
15
|
+
{
|
|
16
|
+
source: ['inspirehep.net/authors/:id'],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
handler,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const getAuthorById = (id: string) => cache.tryGet(`inspirehep:author:${id}`, () => ofetch<AuthorResponse>(`${baseUrl}/api/authors/${id}`));
|
|
23
|
+
|
|
24
|
+
async function handler(ctx) {
|
|
25
|
+
const id = ctx.req.param('id');
|
|
26
|
+
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
|
|
27
|
+
|
|
28
|
+
const authorInfo = (await getAuthorById(id)) as AuthorResponse;
|
|
29
|
+
const response = await ofetch<LiteratureResponse>(`${baseUrl}/api/literature`, {
|
|
30
|
+
query: {
|
|
31
|
+
sort: 'mostrecent',
|
|
32
|
+
size: limit,
|
|
33
|
+
page: 1,
|
|
34
|
+
search_type: 'hep-author-publication',
|
|
35
|
+
author: authorInfo.metadata.facet_author_name,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const items = parseLiterature(response.hits.hits);
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
title: `${authorInfo.metadata.name.preferred_name} - INSPIRE`,
|
|
43
|
+
link: `${baseUrl}/authors/${id}`,
|
|
44
|
+
item: items,
|
|
45
|
+
};
|
|
46
|
+
}
|