rsshub 1.0.0-master.ff3a9ce → 1.0.0-master.ff3ea5a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config.ts +38 -0
- package/lib/errors/index.tsx +3 -2
- package/lib/middleware/debug.ts +6 -4
- package/lib/middleware/header.ts +4 -2
- package/lib/registry.test.ts +24 -1
- package/lib/registry.ts +40 -11
- package/lib/router.js +1 -1
- package/lib/routes/121/namespace.ts +9 -0
- package/lib/routes/121/templates/description.art +17 -0
- package/lib/routes/121/weather-live.ts +104 -0
- package/lib/routes/141jav/index.ts +3 -0
- package/lib/routes/141ppv/index.ts +3 -0
- package/lib/routes/163/news/rank.ts +1 -1
- package/lib/routes/18comic/album.ts +59 -64
- package/lib/routes/18comic/index.ts +1 -0
- package/lib/routes/18comic/search.ts +53 -4
- package/lib/routes/18comic/utils.ts +70 -1
- package/lib/routes/2048/index.ts +1 -0
- package/lib/routes/30secondsofcode/utils.ts +0 -1
- package/lib/routes/6park/index.ts +1 -1
- package/lib/routes/7mmtv/index.ts +1 -0
- package/lib/routes/91porn/index.ts +1 -0
- package/lib/routes/95mm/tab.ts +1 -0
- package/lib/routes/agefans/detail.ts +1 -1
- package/lib/routes/aliyun/database-month.ts +1 -1
- package/lib/routes/anthropic/research.ts +112 -0
- package/lib/routes/apnews/topics.ts +2 -1
- package/lib/routes/apnews/utils.ts +1 -1
- package/lib/routes/apple/design.ts +54 -0
- package/lib/routes/apple/namespace.ts +1 -1
- package/lib/routes/aqara/post.ts +1 -1
- package/lib/routes/augmentcode/blog.ts +161 -0
- package/lib/routes/augmentcode/namespace.ts +9 -0
- package/lib/routes/augmentcode/templates/description.art +17 -0
- package/lib/routes/azul/namespace.ts +9 -0
- package/lib/routes/azul/packages.ts +105 -0
- package/lib/routes/banshujiang/index.ts +763 -0
- package/lib/routes/banshujiang/namespace.ts +9 -0
- package/lib/routes/banshujiang/templates/description.art +17 -0
- package/lib/routes/bfl/announcements.ts +1 -1
- package/lib/routes/bilibili/cache.ts +78 -0
- package/lib/routes/bilibili/danmaku.ts +1 -1
- package/lib/routes/bilibili/dynamic.ts +8 -2
- package/lib/routes/bilibili/video.ts +31 -73
- package/lib/routes/biquge/index.ts +1 -1
- package/lib/routes/bsky/keyword.ts +15 -10
- package/lib/routes/capitalmind/insights.ts +40 -0
- package/lib/routes/capitalmind/namespace.ts +8 -0
- package/lib/routes/capitalmind/podcasts.ts +41 -0
- package/lib/routes/capitalmind/utils.ts +122 -0
- package/lib/routes/cartoonmad/comic.ts +1 -1
- package/lib/routes/chikubi/index.ts +1 -0
- package/lib/routes/chikubi/tag.ts +1 -0
- package/lib/routes/chocolatey/namespace.ts +9 -0
- package/lib/routes/chocolatey/packages.ts +122 -0
- package/lib/routes/cmde/index.ts +1 -1
- package/lib/routes/cockroachlabs/blog.ts +113 -0
- package/lib/routes/cockroachlabs/namespace.ts +7 -0
- package/lib/routes/cool18/index.ts +4 -1
- package/lib/routes/coomer/index.ts +12 -6
- package/lib/routes/coomer/namespace.ts +1 -1
- package/lib/routes/copymanga/comic.ts +7 -9
- package/lib/routes/css-tricks/articles.ts +48 -0
- package/lib/routes/css-tricks/collections.ts +62 -0
- package/lib/routes/css-tricks/namespace.ts +8 -0
- package/lib/routes/css-tricks/popular.ts +39 -0
- package/lib/routes/css-tricks/utils.ts +103 -0
- package/lib/routes/cursor/changelog.ts +26 -17
- package/lib/routes/cursor/namespace.ts +1 -1
- package/lib/routes/cw/utils.ts +6 -13
- package/lib/routes/dealstreetasia/home.ts +1 -1
- package/lib/routes/dedao/index.ts +3 -3
- package/lib/routes/deepl/blog.ts +422 -0
- package/lib/routes/deepl/namespace.ts +9 -0
- package/lib/routes/deepl/templates/description.art +21 -0
- package/lib/routes/deeplearning/the-batch.ts +1 -1
- package/lib/routes/dev.to/guides.ts +100 -0
- package/lib/routes/dev.to/namespace.ts +8 -0
- package/lib/routes/dev.to/top.ts +105 -0
- package/lib/routes/dgut/jwb.ts +73 -0
- package/lib/routes/dgut/namespace.ts +9 -0
- package/lib/routes/digitalpolicyalert/activity-tracker.ts +135 -0
- package/lib/routes/digitalpolicyalert/namespace.ts +9 -0
- package/lib/routes/dnaindia/common.ts +26 -8
- package/lib/routes/douban/other/list.ts +3 -3
- package/lib/routes/e-hentai/index.ts +4 -1
- package/lib/routes/ehentai/tag.ts +1 -0
- package/lib/routes/englishhome/index.ts +55 -0
- package/lib/routes/englishhome/namespace.ts +6 -0
- package/lib/routes/epicgames/index.ts +2 -2
- package/lib/routes/espn/news.ts +1 -1
- package/lib/routes/expats/czech-news.ts +272 -0
- package/lib/routes/expats/namespace.ts +9 -0
- package/lib/routes/fanbox/index.ts +1 -0
- package/lib/routes/fanbox/utils.ts +1 -1
- package/lib/routes/fansly/tag.ts +1 -0
- package/lib/routes/fantia/search.ts +1 -1
- package/lib/routes/fantube/creator.ts +69 -0
- package/lib/routes/fantube/namespace.ts +7 -0
- package/lib/routes/fantube/templates/post.art +17 -0
- package/lib/routes/fantube/types.ts +100 -0
- package/lib/routes/fantube/utils.ts +268 -0
- package/lib/routes/follow/profile.ts +1 -1
- package/lib/routes/followin/news.ts +1 -1
- package/lib/routes/foresightnews/util.ts +1 -1
- package/lib/routes/freexcomic/book.ts +4 -1
- package/lib/routes/gamer/hot.ts +5 -5
- package/lib/routes/gaoyu/blog.ts +145 -0
- package/lib/routes/gaoyu/namespace.ts +9 -0
- package/lib/routes/gaoyu/templates/description.art +7 -0
- package/lib/routes/geocaching/blogs.ts +2 -2
- package/lib/routes/github/namespace.ts +1 -1
- package/lib/routes/github/private-feed.ts +229 -0
- package/lib/routes/github/star.ts +1 -1
- package/lib/routes/google/extension.ts +9 -10
- package/lib/routes/gov/beijing/bphc/index.ts +1 -1
- package/lib/routes/gov/ccdi/index.ts +1 -1
- package/lib/routes/gov/chongqing/sydwgkzp.ts +22 -6
- package/lib/routes/gov/customs/list.ts +1 -1
- package/lib/routes/gov/general/general.ts +1 -1
- package/lib/routes/gov/hangzhou/zwfw.ts +1 -1
- package/lib/routes/gov/pbc/goutongjiaoliu.ts +1 -1
- package/lib/routes/gov/shenzhen/szlh/index.ts +77 -0
- package/lib/routes/gov/shenzhen/szlh/namespace.ts +8 -0
- package/lib/routes/grist/utils.ts +5 -4
- package/lib/routes/hanime1/search.ts +4 -2
- package/lib/routes/hellogithub/report.ts +1 -1
- package/lib/routes/hit/hitgs.ts +240 -54
- package/lib/routes/hit/templates/description.art +7 -0
- package/lib/routes/hlju/namespace.ts +8 -0
- package/lib/routes/hlju/news.ts +141 -0
- package/lib/routes/hostmonit/cloudflareyes.ts +1 -1
- package/lib/routes/hotukdeals/index.ts +1 -1
- package/lib/routes/hyperdash/namespace.ts +7 -0
- package/lib/routes/hyperdash/templates/description.art +34 -0
- package/lib/routes/hyperdash/top-traders.ts +84 -0
- package/lib/routes/hyperdash/utils.ts +49 -0
- package/lib/routes/hypergryph/arknights/announce.ts +1 -1
- package/lib/routes/ielts/index.ts +1 -1
- package/lib/routes/infoq/topic.ts +16 -13
- package/lib/routes/instagram/web-api/index.ts +17 -13
- package/lib/routes/instagram/web-api/utils.ts +46 -63
- package/lib/routes/jamesclear/book-summaries.ts +40 -0
- package/lib/routes/jamesclear/great-speeches.ts +40 -0
- package/lib/routes/jamesclear/namespace.ts +8 -0
- package/lib/routes/jamesclear/quotes.ts +40 -0
- package/lib/routes/jamesclear/three-two-one.ts +41 -0
- package/lib/routes/jamesclear/utils.ts +22 -0
- package/lib/routes/japanpost/utils.ts +2 -2
- package/lib/routes/javbus/index.ts +3 -0
- package/lib/routes/javdb/tags.ts +1 -0
- package/lib/routes/javlibrary/star.ts +1 -0
- package/lib/routes/javtiful/actress.ts +3 -0
- package/lib/routes/javtiful/channel.ts +3 -0
- package/lib/routes/javtrailers/casts.ts +3 -0
- package/lib/routes/jetbrains/comments.ts +99 -0
- package/lib/routes/jetbrains/namespace.ts +8 -0
- package/lib/routes/jimmyspa/books.ts +1 -1
- package/lib/routes/jimmyspa/news.ts +1 -1
- package/lib/routes/jpxgmn/tab.ts +3 -0
- package/lib/routes/kakuyomu/works.ts +3 -0
- package/lib/routes/kaopu/news.ts +1 -1
- package/lib/routes/kemono/const.ts +1 -1
- package/lib/routes/kemono/index.ts +12 -11
- package/lib/routes/kemono/namespace.ts +1 -1
- package/lib/routes/kiro/blog.ts +131 -0
- package/lib/routes/kiro/changelog.ts +128 -0
- package/lib/routes/kiro/namespace.ts +9 -0
- package/lib/routes/konachan/post.ts +3 -0
- package/lib/routes/kovidgoyal/kitty/changelog.ts +83 -0
- package/lib/routes/kovidgoyal/namespace.ts +7 -0
- package/lib/routes/kunchengblog/essay.ts +1 -1
- package/lib/routes/landiannews/category.ts +1 -1
- package/lib/routes/landiannews/index.ts +1 -1
- package/lib/routes/landiannews/tag.ts +1 -1
- package/lib/routes/line/utils.ts +1 -1
- package/lib/routes/lineageos/changes.ts +79 -0
- package/lib/routes/lineageos/namespace.ts +9 -0
- package/lib/routes/linkedin/cn/renderer.ts +1 -1
- package/lib/routes/liquipedia/cs-matches.ts +42 -14
- package/lib/routes/literotica/new.ts +1 -0
- package/lib/routes/lofter/tag.ts +27 -3
- package/lib/routes/makerworld/contest.ts +51 -0
- package/lib/routes/makerworld/namespace.ts +7 -0
- package/lib/routes/makerworld/trending.ts +45 -0
- package/lib/routes/makerworld/user-upload.ts +54 -0
- package/lib/routes/makerworld/utils.ts +18 -0
- package/lib/routes/manhuagui/comic.ts +1 -1
- package/lib/routes/manus/blog.ts +77 -0
- package/lib/routes/manus/namespace.ts +7 -0
- package/lib/routes/mastodon/tag.ts +48 -0
- package/lib/routes/mathpix/blog.ts +155 -0
- package/lib/routes/mathpix/namespace.ts +9 -0
- package/lib/routes/mathpix/templates/description.art +21 -0
- package/lib/routes/mckinsey/cn/category-map.ts +9 -15
- package/lib/routes/mckinsey/cn/index.ts +77 -40
- package/lib/routes/melonbooks/search.ts +1 -0
- package/lib/routes/metacritic/index.ts +2 -2
- package/lib/routes/meteoblue/namespace.ts +8 -0
- package/lib/routes/meteoblue/weathernews.ts +75 -0
- package/lib/routes/meteor/index.ts +1 -1
- package/lib/routes/microsoft/addon.ts +7 -9
- package/lib/routes/mihoyo/zzz/news.ts +106 -0
- package/lib/routes/missav/new.ts +2 -1
- package/lib/routes/mit/hanlab.ts +61 -0
- package/lib/routes/mit/namespace.ts +6 -0
- package/lib/routes/mittrchina/index.ts +3 -3
- package/lib/routes/mixcloud/config.ts +129 -0
- package/lib/routes/mixcloud/index.ts +163 -107
- package/lib/routes/mixcloud/user-playlist.ts +31 -0
- package/lib/routes/mixi2/community.ts +72 -0
- package/lib/routes/mixi2/discovery.ts +52 -0
- package/lib/routes/mixi2/home.ts +51 -0
- package/lib/routes/mixi2/namespace.ts +8 -0
- package/lib/routes/mixi2/user.ts +77 -0
- package/lib/routes/mixi2/utils.ts +56 -0
- package/lib/routes/modelscope/learn.ts +94 -0
- package/lib/routes/moodysmismicrosite/report.ts +1 -1
- package/lib/routes/musify/index.ts +130 -0
- package/lib/routes/musify/namespace.ts +9 -0
- package/lib/routes/musikguru/namespace.ts +9 -0
- package/lib/routes/musikguru/news.ts +146 -0
- package/lib/routes/musikguru/templates/description.art +21 -0
- package/lib/routes/myfans/post.ts +1 -0
- package/lib/routes/nankai/cc-notice.ts +114 -0
- package/lib/routes/nankai/jwc.ts +131 -0
- package/lib/routes/nankai/namespace.ts +7 -0
- package/lib/routes/nankai/notice.ts +84 -0
- package/lib/routes/nankai/yzb.ts +97 -0
- package/lib/routes/neu/yz.ts +172 -0
- package/lib/routes/newslaundry/explainer.ts +30 -0
- package/lib/routes/newslaundry/namespace.ts +8 -0
- package/lib/routes/newslaundry/nl-cheatsheet.ts +30 -0
- package/lib/routes/newslaundry/nl-collaborations.ts +30 -0
- package/lib/routes/newslaundry/podcast.ts +61 -0
- package/lib/routes/newslaundry/reports.ts +30 -0
- package/lib/routes/newslaundry/shot.ts +30 -0
- package/lib/routes/newslaundry/subscriber-only.ts +30 -0
- package/lib/routes/newslaundry/templates/description.art +28 -0
- package/lib/routes/newslaundry/utils.ts +108 -0
- package/lib/routes/newswav/latest.ts +100 -0
- package/lib/routes/newswav/namespace.ts +7 -0
- package/lib/routes/nhentai/index.ts +1 -0
- package/lib/routes/nifd/research.ts +16 -0
- package/lib/routes/nio/namespace.ts +9 -0
- package/lib/routes/nio/nioradio.ts +75 -0
- package/lib/routes/njust/cs.ts +58 -0
- package/lib/routes/njust/utils.ts +1 -1
- package/lib/routes/ntdm/video.ts +1 -1
- package/lib/routes/nuaa/utils/pypasswaf.ts +1 -1
- package/lib/routes/oilchem/index.ts +1 -1
- package/lib/routes/oncc/money18.ts +1 -1
- package/lib/routes/openai/cookbook.ts +1 -1
- package/lib/routes/paulgraham/article.ts +2 -2
- package/lib/routes/picuki/profile.ts +4 -0
- package/lib/routes/pixiv/bookmarks.ts +1 -1
- package/lib/routes/pixiv/novel-api/series/sfw.ts +1 -1
- package/lib/routes/pixiv/novels.ts +2 -2
- package/lib/routes/pixiv/user.ts +1 -1
- package/lib/routes/playno1/av.ts +1 -0
- package/lib/routes/pornhub/model.ts +3 -7
- package/lib/routes/pornhub/pornstar.ts +2 -7
- package/lib/routes/pornhub/users.ts +2 -7
- package/lib/routes/pornhub/utils.ts +12 -1
- package/lib/routes/qingting/podcast.ts +2 -1
- package/lib/routes/qipamaijia/index.ts +1 -0
- package/lib/routes/questmobile/report.ts +1 -1
- package/lib/routes/railway/index.ts +73 -0
- package/lib/routes/railway/namespace.ts +8 -0
- package/lib/routes/reuters/common.ts +0 -3
- package/lib/routes/rockthejvm/articles.ts +167 -0
- package/lib/routes/rockthejvm/namespace.ts +9 -0
- package/lib/routes/rockthejvm/templates/description.art +7 -0
- package/lib/routes/samrdprc/namespace.ts +7 -0
- package/lib/routes/samrdprc/news.ts +79 -0
- package/lib/routes/sankei/namespace.ts +7 -0
- package/lib/routes/sankei/news.ts +68 -0
- package/lib/routes/sankei/topics.ts +71 -0
- package/lib/routes/sciencenet/user.ts +1 -1
- package/lib/routes/scoop/apps.ts +188 -0
- package/lib/routes/scoop/namespace.ts +9 -0
- package/lib/routes/scoop/templates/description.art +56 -0
- package/lib/routes/scpta/namespace.ts +8 -0
- package/lib/routes/scpta/news.ts +101 -0
- package/lib/routes/seekingalpha/index.ts +1 -1
- package/lib/routes/sehuatang/index.ts +29 -31
- package/lib/routes/setn/index.ts +11 -2
- package/lib/routes/seu/cyber/index.ts +78 -0
- package/lib/routes/sicau/jiaowu.ts +42 -34
- package/lib/routes/sis001/forum.ts +1 -0
- package/lib/routes/sjtu/seiee/icisee.ts +67 -0
- package/lib/routes/sketis/isabelle-dev/blog/index.ts +1 -1
- package/lib/routes/smartlink/index.ts +13 -3
- package/lib/routes/sohu/mp.ts +17 -6
- package/lib/routes/sotwe/namespace.ts +1 -0
- package/lib/routes/sotwe/user.ts +98 -0
- package/lib/routes/spankbang/new-videos.ts +1 -0
- package/lib/routes/spglobal/ratings.ts +1 -1
- package/lib/routes/stanford/blog.ts +77 -0
- package/lib/routes/stanford/namespace.ts +7 -0
- package/lib/routes/syosetu/index.ts +1 -1
- package/lib/routes/t66y/index.ts +1 -0
- package/lib/routes/taobao/mysql.ts +157 -0
- package/lib/routes/taobao/namespace.ts +2 -2
- package/lib/routes/techcrunch/category.ts +48 -0
- package/lib/routes/telegram/channel.ts +2 -2
- package/lib/routes/tesla/cx.ts +1 -1
- package/lib/routes/test/index.ts +1 -1
- package/lib/routes/themoviedb/episodes.ts +1 -1
- package/lib/routes/thewirehindi/category.ts +78 -0
- package/lib/routes/thewirehindi/index.ts +43 -0
- package/lib/routes/thewirehindi/namespace.ts +7 -0
- package/lib/routes/thewirehindi/templates/description.art +9 -0
- package/lib/routes/thewirehindi/utils.ts +33 -0
- package/lib/routes/threads/utils.ts +2 -2
- package/lib/routes/tidb/blog.ts +314 -0
- package/lib/routes/tidb/namespace.ts +9 -0
- package/lib/routes/tumblr/namespace.ts +17 -0
- package/lib/routes/tumblr/posts.ts +74 -0
- package/lib/routes/tumblr/utils.ts +110 -0
- package/lib/routes/tver/namespace.ts +7 -0
- package/lib/routes/tver/series.ts +98 -0
- package/lib/routes/twitter/api/web-api/login.ts +1 -3
- package/lib/routes/twitter/api/web-api/utils.ts +23 -1
- package/lib/routes/twitter/utils.ts +21 -21
- package/lib/routes/udn/breaking-news.ts +2 -2
- package/lib/routes/uestc/auto.ts +1 -1
- package/lib/routes/uestc/cqe.ts +1 -1
- package/lib/routes/uestc/scse.ts +1 -1
- package/lib/routes/uestc/sice.ts +1 -1
- package/lib/routes/uestc/sise.ts +1 -1
- package/lib/routes/upc/jwc.ts +32 -46
- package/lib/routes/uptimerobot/rss.ts +1 -1
- package/lib/routes/visionias/daily-news-summary.ts +65 -0
- package/lib/routes/visionias/monthly-magazine.ts +68 -0
- package/lib/routes/visionias/news-today.ts +3 -13
- package/lib/routes/visionias/utils.ts +5 -5
- package/lib/routes/visionias/weekly-focus.ts +2 -2
- package/lib/routes/wdfxw/bookfree.ts +528 -0
- package/lib/routes/wdfxw/namespace.ts +8 -0
- package/lib/routes/wdfxw/templates/description.art +13 -0
- package/lib/routes/whu/swrh.ts +1 -1
- package/lib/routes/windsurf/blog.ts +118 -0
- package/lib/routes/windsurf/changelog.ts +100 -0
- package/lib/routes/windsurf/namespace.ts +9 -0
- package/lib/routes/windsurf/templates/description.art +21 -0
- package/lib/routes/x6d/index.ts +1 -1
- package/lib/routes/xbookcn/blog.ts +1 -0
- package/lib/routes/xiaohongshu/util.ts +1 -3
- package/lib/routes/xiaoyuzhou/pickup.ts +1 -1
- package/lib/routes/ximalaya/album.ts +32 -70
- package/lib/routes/ximalaya/types.ts +48 -0
- package/lib/routes/ximalaya/utils.ts +9 -7
- package/lib/routes/xmanhua/index.ts +1 -0
- package/lib/routes/xueqiu/cookies.ts +1 -1
- package/lib/routes/xueqiu/user.ts +1 -1
- package/lib/routes/xwenming/index.ts +184 -0
- package/lib/routes/xwenming/namespace.ts +9 -0
- package/lib/routes/yahoo/news/utils.ts +1 -1
- package/lib/routes/yande/post.ts +3 -0
- package/lib/routes/ymgal/game.ts +1 -0
- package/lib/routes/youtube/api/google.ts +27 -0
- package/lib/routes/youtube/api/youtubei.ts +70 -20
- package/lib/routes/youtube/community.ts +3 -1
- package/lib/routes/youtube/utils.ts +16 -14
- package/lib/routes/zaobao/util.ts +8 -5
- package/lib/routes/zhihu/activities.ts +3 -0
- package/lib/routes/zhihu/execlib/x-zse-96-v3.ts +5 -5
- package/lib/routes/zhizhuan100/namespace.ts +7 -0
- package/lib/routes/zhizhuan100/report.ts +79 -0
- package/lib/routes/zimuxia/portfolio.ts +1 -1
- package/lib/routes/zju/sis/index.ts +161 -0
- package/lib/server.ts +5 -0
- package/lib/types.ts +58 -54
- package/lib/utils/helpers.ts +1 -1
- package/lib/utils/logger.ts +1 -1
- package/lib/utils/proxy/index.ts +102 -18
- package/lib/utils/proxy/multi-proxy.ts +139 -0
- package/lib/utils/proxy/unify-proxy.ts +3 -1
- package/lib/utils/puppeteer-utils.test.ts +1 -1
- package/lib/utils/puppeteer.test.ts +14 -27
- package/lib/utils/puppeteer.ts +51 -37
- package/lib/utils/readable-social.test.ts +65 -0
- package/lib/utils/readable-social.ts +15 -1
- package/lib/utils/request-rewriter/fetch.ts +42 -4
- package/package.json +54 -56
- package/lib/routes/mixcloud/queries.ts +0 -2274
- package/lib/routes-deprecated/dev.to/top.js +0 -40
package/lib/routes/hit/hitgs.ts
CHANGED
|
@@ -1,72 +1,258 @@
|
|
|
1
|
-
import { Route } from '@/types';
|
|
1
|
+
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
|
2
|
+
|
|
3
|
+
import { art } from '@/utils/render';
|
|
2
4
|
import cache from '@/utils/cache';
|
|
3
|
-
import
|
|
4
|
-
import { load } from 'cheerio';
|
|
5
|
+
import ofetch from '@/utils/ofetch';
|
|
5
6
|
import { parseDate } from '@/utils/parse-date';
|
|
6
7
|
|
|
8
|
+
import { type CheerioAPI, type Cheerio, load } from 'cheerio';
|
|
9
|
+
import type { Element } from 'domhandler';
|
|
10
|
+
import { type Context } from 'hono';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
|
|
13
|
+
export const handler = async (ctx: Context): Promise<Data> => {
|
|
14
|
+
const { id = 'tzgg' } = ctx.req.param();
|
|
15
|
+
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10);
|
|
16
|
+
|
|
17
|
+
const baseUrl: string = 'https://hitgs.hit.edu.cn';
|
|
18
|
+
const targetUrl: string = new URL(`${id}/list.htm`, baseUrl).href;
|
|
19
|
+
|
|
20
|
+
const response = await ofetch(targetUrl);
|
|
21
|
+
const $: CheerioAPI = load(response);
|
|
22
|
+
const language = $('html').attr('lang') ?? 'zh';
|
|
23
|
+
|
|
24
|
+
let items: DataItem[] = [];
|
|
25
|
+
|
|
26
|
+
items = $('li.news, div.tbt17')
|
|
27
|
+
.slice(0, limit)
|
|
28
|
+
.toArray()
|
|
29
|
+
.map((el): Element => {
|
|
30
|
+
const $el: Cheerio<Element> = $(el);
|
|
31
|
+
|
|
32
|
+
const title: string = $el.find('div.news_title, span.div.news_title, div.bttb2').text();
|
|
33
|
+
const description: string | undefined = art(path.join(__dirname, 'templates/description.art'), {
|
|
34
|
+
intro: $el.find('div.news_text, div.jj5').text(),
|
|
35
|
+
});
|
|
36
|
+
const pubDateStr: string | undefined = $('span.news_meta').text() || ($('span.news_days').text() ? `${$('span.news_days').text()}-${$('span.news_year').text()}` : `${$('div.tm-3').text()}-${$('div.tm-1').text()}`);
|
|
37
|
+
const linkUrl: string | undefined = $el.find('div.news_title a').attr('href') ?? $el.find('div.bttb2 a').attr('href') ?? $el.find('a').attr('href');
|
|
38
|
+
const upDatedStr: string | undefined = pubDateStr;
|
|
39
|
+
|
|
40
|
+
const processedItem: DataItem = {
|
|
41
|
+
title,
|
|
42
|
+
description,
|
|
43
|
+
pubDate: parseDate(pubDateStr),
|
|
44
|
+
link: linkUrl ? new URL(linkUrl, baseUrl).href : undefined,
|
|
45
|
+
content: {
|
|
46
|
+
html: description,
|
|
47
|
+
text: description,
|
|
48
|
+
},
|
|
49
|
+
updated: parseDate(upDatedStr),
|
|
50
|
+
language,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return processedItem;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
items = await Promise.all(
|
|
57
|
+
items.map((item) => {
|
|
58
|
+
if (!item.link) {
|
|
59
|
+
return item;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return cache.tryGet(item.link, async (): Promise<DataItem> => {
|
|
63
|
+
const detailResponse = await ofetch(item.link);
|
|
64
|
+
const $$: CheerioAPI = load(detailResponse);
|
|
65
|
+
|
|
66
|
+
const title: string = $$('h1.arti_title').text() + $$('h2.arti_title').text();
|
|
67
|
+
const description: string | undefined = art(path.join(__dirname, 'templates/description.art'), {
|
|
68
|
+
description: $$('div.wp_articlecontent').html(),
|
|
69
|
+
});
|
|
70
|
+
const pubDateStr: string | undefined = $$('span.arti_update').text().split(/:/).pop()?.trim();
|
|
71
|
+
const upDatedStr: string | undefined = pubDateStr;
|
|
72
|
+
|
|
73
|
+
let processedItem: DataItem = {
|
|
74
|
+
title,
|
|
75
|
+
description,
|
|
76
|
+
pubDate: pubDateStr ? parseDate(pubDateStr) : item.pubDate,
|
|
77
|
+
content: {
|
|
78
|
+
html: description,
|
|
79
|
+
text: description,
|
|
80
|
+
},
|
|
81
|
+
updated: upDatedStr ? parseDate(upDatedStr) : item.updated,
|
|
82
|
+
language,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const $enclosureEl: Cheerio<Element> = $$('a[sudyfile-attr]')
|
|
86
|
+
.filter((_, el) => {
|
|
87
|
+
const $el: Cheerio<Element> = $$(el);
|
|
88
|
+
|
|
89
|
+
return !$el.attr('href')?.endsWith('htm');
|
|
90
|
+
})
|
|
91
|
+
.first();
|
|
92
|
+
|
|
93
|
+
const enclosureUrl: string | undefined = $enclosureEl.attr('href');
|
|
94
|
+
|
|
95
|
+
if (enclosureUrl) {
|
|
96
|
+
const enclosureType: string = `application/${enclosureUrl.split(/\./).pop() || 'octet-stream'}`;
|
|
97
|
+
const enclosureTitle: string | undefined = $enclosureEl.attr('sudyfile-attr')?.match(/'title':'(.*?)'/)?.[1];
|
|
98
|
+
|
|
99
|
+
processedItem = {
|
|
100
|
+
...processedItem,
|
|
101
|
+
enclosure_url: new URL(enclosureUrl, baseUrl).href,
|
|
102
|
+
enclosure_type: enclosureType,
|
|
103
|
+
enclosure_title: enclosureTitle || title,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
...item,
|
|
109
|
+
...processedItem,
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const title: string = $('title').text();
|
|
116
|
+
const author: string = $('p.copyright span').first().text().split(/©/).pop() ?? '';
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
title: `${author ? `${author} - ` : ''}${title}`,
|
|
120
|
+
description: title,
|
|
121
|
+
link: targetUrl,
|
|
122
|
+
item: items,
|
|
123
|
+
allowEmpty: true,
|
|
124
|
+
image: $('div.foot-logo img').attr('src'),
|
|
125
|
+
author,
|
|
126
|
+
language,
|
|
127
|
+
id: targetUrl,
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
7
131
|
export const route: Route = {
|
|
8
|
-
path: '/hitgs',
|
|
132
|
+
path: '/hitgs/:id?',
|
|
133
|
+
name: '研究生院',
|
|
134
|
+
url: 'hitgs.hit.edu.cn',
|
|
135
|
+
maintainers: ['hlmu', 'nczitzk'],
|
|
136
|
+
handler,
|
|
137
|
+
example: '/hit/hitgs/tzgg',
|
|
138
|
+
parameters: {
|
|
139
|
+
category: {
|
|
140
|
+
description: '分类,默认为 `tzgg`,即通知公告,可在对应分类页 URL 中找到',
|
|
141
|
+
options: [
|
|
142
|
+
{
|
|
143
|
+
label: '通知公告',
|
|
144
|
+
value: 'tzgg',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: '综合新闻',
|
|
148
|
+
value: 'zhxw',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: '高水平课程与学术交流',
|
|
152
|
+
value: 'gspkcyxsjl',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: '国家政策',
|
|
156
|
+
value: 'gjzc',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
label: '规章制度',
|
|
160
|
+
value: '17546',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
label: '办事流程',
|
|
164
|
+
value: '17547',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
label: '常见问题',
|
|
168
|
+
value: '17548',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
label: '常见下载',
|
|
172
|
+
value: '17549',
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
description: `:::tip
|
|
178
|
+
订阅 [通知公告](https://hitgs.hit.edu.cn/tzgg/list.htm),其源网址为 \`https://hitgs.hit.edu.cn/tzgg/list.htm\`,请参考该 URL 指定部分构成参数,此时路由为 [\`/hit/hitgs/tzgg\`](https://rsshub.app/hit/hitgs/tzgg)。
|
|
179
|
+
:::
|
|
180
|
+
|
|
181
|
+
<details>
|
|
182
|
+
<summary>更多栏目</summary>
|
|
183
|
+
|
|
184
|
+
| 栏目 | ID |
|
|
185
|
+
| - | - |
|
|
186
|
+
| [通知公告](https://hitgs.hit.edu.cn/tzgg/list.htm) | [tzgg](https://rsshub.app/hit/hitgs/tzgg) |
|
|
187
|
+
| [综合新闻](https://hitgs.hit.edu.cn/zhxw/list.htm) | [zhxw](https://rsshub.app/hit/hitgs/zhxw) |
|
|
188
|
+
| [高水平课程与学术交流](https://hitgs.hit.edu.cn/gspkcyxsjl/list.htm) | [gspkcyxsjl](https://rsshub.app/hit/hitgs/gspkcyxsjl) |
|
|
189
|
+
| [国家政策](https://hitgs.hit.edu.cn/gjzc/list.htm) | [gjzc](https://rsshub.app/hit/hitgs/gjzc) |
|
|
190
|
+
| [规章制度](https://hitgs.hit.edu.cn/17546/list.htm) | [17546](https://rsshub.app/hit/hitgs/17546) |
|
|
191
|
+
| [办事流程](https://hitgs.hit.edu.cn/17547/list.htm) | [17547](https://rsshub.app/hit/hitgs/17547) |
|
|
192
|
+
| [常见问题](https://hitgs.hit.edu.cn/17548/list.htm) | [17548](https://rsshub.app/hit/hitgs/17548) |
|
|
193
|
+
| [常见下载](https://hitgs.hit.edu.cn/17549/list.htm) | [17549](https://rsshub.app/hit/hitgs/17549) |
|
|
194
|
+
|
|
195
|
+
</details>
|
|
196
|
+
`,
|
|
9
197
|
categories: ['university'],
|
|
10
|
-
example: '/hit/hitgs',
|
|
11
|
-
parameters: {},
|
|
12
198
|
features: {
|
|
13
199
|
requireConfig: false,
|
|
14
200
|
requirePuppeteer: false,
|
|
15
201
|
antiCrawler: false,
|
|
202
|
+
supportRadar: true,
|
|
16
203
|
supportBT: false,
|
|
17
204
|
supportPodcast: false,
|
|
18
205
|
supportScihub: false,
|
|
19
206
|
},
|
|
20
207
|
radar: [
|
|
21
208
|
{
|
|
22
|
-
source: ['hitgs.hit.edu.cn
|
|
209
|
+
source: ['hitgs.hit.edu.cn', 'hitgs.hit.edu.cn/:id/list.htm'],
|
|
210
|
+
target: (params) => {
|
|
211
|
+
const id: string = params.id;
|
|
212
|
+
|
|
213
|
+
return `/hit/hitgs${id ? `/${id}` : ''}`;
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
title: '通知公告',
|
|
218
|
+
source: ['hitgs.hit.edu.cn/tzgg/list.htm'],
|
|
219
|
+
target: '/hitgs/tzgg',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
title: '综合新闻',
|
|
223
|
+
source: ['hitgs.hit.edu.cn/zhxw/list.htm'],
|
|
224
|
+
target: '/hitgs/zhxw',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
title: '高水平课程与学术交流',
|
|
228
|
+
source: ['hitgs.hit.edu.cn/gspkcyxsjl/list.htm'],
|
|
229
|
+
target: '/hitgs/gspkcyxsjl',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
title: '国家政策',
|
|
233
|
+
source: ['hitgs.hit.edu.cn/gjzc/list.htm'],
|
|
234
|
+
target: '/hitgs/gjzc',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
title: '规章制度',
|
|
238
|
+
source: ['hitgs.hit.edu.cn/17546/list.htm'],
|
|
239
|
+
target: '/hitgs/17546',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
title: '办事流程',
|
|
243
|
+
source: ['hitgs.hit.edu.cn/17547/list.htm'],
|
|
244
|
+
target: '/hitgs/17547',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
title: '常见问题',
|
|
248
|
+
source: ['hitgs.hit.edu.cn/17548/list.htm'],
|
|
249
|
+
target: '/hitgs/17548',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
title: '常见下载',
|
|
253
|
+
source: ['hitgs.hit.edu.cn/17549/list.htm'],
|
|
254
|
+
target: '/hitgs/17549',
|
|
23
255
|
},
|
|
24
256
|
],
|
|
25
|
-
|
|
26
|
-
maintainers: ['hlmu'],
|
|
27
|
-
handler,
|
|
28
|
-
url: 'hitgs.hit.edu.cn/*',
|
|
257
|
+
view: ViewType.Articles,
|
|
29
258
|
};
|
|
30
|
-
|
|
31
|
-
async function handler() {
|
|
32
|
-
const host = 'https://hitgs.hit.edu.cn';
|
|
33
|
-
|
|
34
|
-
const response = await got(host + '/tzgg/list.htm', {
|
|
35
|
-
headers: {
|
|
36
|
-
Referer: host,
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const $ = load(response.data);
|
|
41
|
-
const list = $('.news_list li')
|
|
42
|
-
.toArray()
|
|
43
|
-
.map((e) => ({
|
|
44
|
-
pubDate: parseDate($('span:nth-child(4)', e).text()),
|
|
45
|
-
title: $('span.Article_BelongCreateOrg.newsfb', e).text() + $('span a', e).attr('title'),
|
|
46
|
-
category: $('span.Article_BelongCreateOrg.newsfb', e).text().slice(1, -1),
|
|
47
|
-
link: host + $('span a', e).attr('href'),
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
const out = await Promise.all(
|
|
51
|
-
list.map((item) =>
|
|
52
|
-
cache.tryGet(item.link, async () => {
|
|
53
|
-
const response = await got(item.link, {
|
|
54
|
-
headers: {
|
|
55
|
-
Referer: host,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
const $ = load(response.data);
|
|
59
|
-
item.description = $('.wp_articlecontent').html();
|
|
60
|
-
item.author = $('div.infobox > div > p > span:nth-child(3)').text().slice(3);
|
|
61
|
-
return item;
|
|
62
|
-
})
|
|
63
|
-
)
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
title: '哈工大研究生院通知公告',
|
|
68
|
-
link: host + '/tzgg/list.htm',
|
|
69
|
-
description: '哈尔滨工业大学研究生院通知公告',
|
|
70
|
-
item: out,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Route, DataItem } from '@/types';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
|
+
import { load } from 'cheerio';
|
|
5
|
+
import { parseDate } from '@/utils/parse-date';
|
|
6
|
+
|
|
7
|
+
export const route: Route = {
|
|
8
|
+
path: '/news/:category?',
|
|
9
|
+
categories: ['university'],
|
|
10
|
+
example: '/hlju/news/hdyw',
|
|
11
|
+
parameters: {
|
|
12
|
+
category: {
|
|
13
|
+
description: '新闻分类,默认为黑大要闻',
|
|
14
|
+
options: [
|
|
15
|
+
{ value: 'hdyw', label: '黑大要闻' },
|
|
16
|
+
{ value: 'jjxy', label: '菁菁校园' },
|
|
17
|
+
{ value: 'rwfc', label: '人物风采' },
|
|
18
|
+
{ value: 'xwdt', label: '新闻动态' },
|
|
19
|
+
{ value: 'jxky', label: '教学科研' },
|
|
20
|
+
{ value: 'xyjw', label: '学院经纬' },
|
|
21
|
+
{ value: 'jlhz', label: '交流合作' },
|
|
22
|
+
{ value: 'cxcy', label: '创新创业' },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
features: {
|
|
27
|
+
requireConfig: false,
|
|
28
|
+
requirePuppeteer: false,
|
|
29
|
+
antiCrawler: false,
|
|
30
|
+
supportBT: false,
|
|
31
|
+
supportPodcast: false,
|
|
32
|
+
supportScihub: false,
|
|
33
|
+
},
|
|
34
|
+
radar: [
|
|
35
|
+
{
|
|
36
|
+
source: ['hdxw.hlju.edu.cn/:category.htm', 'hdxw.hlju.edu.cn/'],
|
|
37
|
+
target: '/news/:category',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
name: '新闻网',
|
|
41
|
+
maintainers: ['LCMs-YoRHa'],
|
|
42
|
+
handler,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
async function handler(ctx) {
|
|
46
|
+
const category = ctx.req.param('category') ?? 'hdyw';
|
|
47
|
+
const baseUrl = 'https://hdxw.hlju.edu.cn';
|
|
48
|
+
const listUrl = `${baseUrl}/${category}.htm`;
|
|
49
|
+
|
|
50
|
+
const response = await ofetch(listUrl);
|
|
51
|
+
const $ = load(response);
|
|
52
|
+
|
|
53
|
+
// 从页面自动获取栏目名称
|
|
54
|
+
const categoryName = $('.bgtitle_list').text().trim() || '黑大要闻';
|
|
55
|
+
|
|
56
|
+
// 查找所有新闻链接 - 匹配 info/ 路径的链接,使用 map 而不是 push
|
|
57
|
+
const list = $('a[href*="info/"]')
|
|
58
|
+
.toArray()
|
|
59
|
+
.map((element) => {
|
|
60
|
+
const item = $(element);
|
|
61
|
+
const link = item.attr('href');
|
|
62
|
+
const title = item.text().trim();
|
|
63
|
+
|
|
64
|
+
if (!title || !link || title.length < 5) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 查找日期信息 - 在同一行或附近
|
|
69
|
+
const parent = item.parent();
|
|
70
|
+
const dateMatch = parent.text().match(/(\d{4})\/(\d{2})\/(\d{2})/);
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
title,
|
|
74
|
+
link: link.startsWith('http') ? link : `${baseUrl}/${link}`,
|
|
75
|
+
pubDate: dateMatch ? parseDate(dateMatch[0].replaceAll('/', '-')) : undefined,
|
|
76
|
+
} satisfies DataItem;
|
|
77
|
+
})
|
|
78
|
+
.filter((item): item is NonNullable<typeof item> => item !== null);
|
|
79
|
+
|
|
80
|
+
// 限制返回数量并去重
|
|
81
|
+
const uniqueList = list.filter((item, index, arr) => arr.findIndex((i) => i.link === item.link) === index).slice(0, 15);
|
|
82
|
+
|
|
83
|
+
// 获取每篇文章的详细内容
|
|
84
|
+
const items = await Promise.all(
|
|
85
|
+
uniqueList.map((item) =>
|
|
86
|
+
cache.tryGet(item.link, async () => {
|
|
87
|
+
// 跳过外部链接
|
|
88
|
+
if (!item.link.includes('hdxw.hlju.edu.cn')) {
|
|
89
|
+
return {
|
|
90
|
+
title: item.title,
|
|
91
|
+
link: item.link,
|
|
92
|
+
description: '外部链接,请点击查看原文',
|
|
93
|
+
pubDate: item.pubDate,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const detailResponse = await ofetch(item.link);
|
|
98
|
+
const $detail = load(detailResponse);
|
|
99
|
+
|
|
100
|
+
// 提取文章内容 - 只使用主要内容选择器
|
|
101
|
+
const content = $detail('.v_news_content');
|
|
102
|
+
let description = '';
|
|
103
|
+
|
|
104
|
+
if (content.length > 0) {
|
|
105
|
+
// 清理内容
|
|
106
|
+
content.find('script, style, .print, .share').remove();
|
|
107
|
+
description = content.html() || '';
|
|
108
|
+
} else {
|
|
109
|
+
description = '内容获取失败,请点击查看原文';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 提取精确的发布时间
|
|
113
|
+
let pubDate = item.pubDate;
|
|
114
|
+
const timeElement = $detail('.timestyle110144');
|
|
115
|
+
if (timeElement.length > 0) {
|
|
116
|
+
const timeText = timeElement.text().trim();
|
|
117
|
+
const timeMatch = timeText.match(/(\d{4}[-/]\d{2}[-/]\d{2})\s*(\d{2}:\d{2}(?::\d{2})?)/);
|
|
118
|
+
if (timeMatch) {
|
|
119
|
+
const dateStr = timeMatch[1].replaceAll('/', '-');
|
|
120
|
+
const timeStr = timeMatch[2];
|
|
121
|
+
pubDate = parseDate(`${dateStr} ${timeStr}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
title: item.title,
|
|
127
|
+
link: item.link,
|
|
128
|
+
description: description || '无法获取文章内容,请点击查看原文',
|
|
129
|
+
pubDate,
|
|
130
|
+
};
|
|
131
|
+
})
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
title: `黑龙江大学新闻网 - ${categoryName}`,
|
|
137
|
+
link: listUrl,
|
|
138
|
+
description: `黑龙江大学新闻网${categoryName}栏目`,
|
|
139
|
+
item: items,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -62,7 +62,7 @@ async function handler(ctx) {
|
|
|
62
62
|
const items = response.info.slice(0, limit).map((item) => {
|
|
63
63
|
const ip = item.ip;
|
|
64
64
|
const latency = item.latency === undefined ? undefined : `${item.latency}ms`;
|
|
65
|
-
const line = item.line === undefined ? undefined :
|
|
65
|
+
const line = item.line === undefined ? undefined : Object.hasOwn(lines, item.line) ? lines[item.line] : item.line;
|
|
66
66
|
const loss = item.loss === undefined ? undefined : `${item.loss}%`;
|
|
67
67
|
const node = item.node;
|
|
68
68
|
const speed = item.speed === undefined ? undefined : `${item.speed} KB/s`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<h3>Trader #{{ rank }}</h3>
|
|
2
|
+
|
|
3
|
+
<p><strong>Address:</strong> <code>{{ address }}</code></p>
|
|
4
|
+
<p><strong>Account Value:</strong> {{ accountValue }}</p>
|
|
5
|
+
|
|
6
|
+
<h4>Main Position</h4>
|
|
7
|
+
<p><strong>Coin:</strong> {{ mainPosition.coin }}</p>
|
|
8
|
+
<p><strong>Position Value:</strong> {{ mainPosition.value }}</p>
|
|
9
|
+
<p><strong>Side:</strong> {{ mainPosition.side }}</p>
|
|
10
|
+
<p><strong>Direction Bias:</strong> {{ directionBias }}</p>
|
|
11
|
+
|
|
12
|
+
<h4>PnL Performance</h4>
|
|
13
|
+
<table>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>Period</th>
|
|
16
|
+
<th>PnL</th>
|
|
17
|
+
</tr>
|
|
18
|
+
<tr>
|
|
19
|
+
<td>Day</td>
|
|
20
|
+
<td>{{ pnl.day.value }}</td>
|
|
21
|
+
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<td>Week</td>
|
|
24
|
+
<td>{{ pnl.week.value }}</td>
|
|
25
|
+
</tr>
|
|
26
|
+
<tr>
|
|
27
|
+
<td>Month</td>
|
|
28
|
+
<td>{{ pnl.month.value }}</td>
|
|
29
|
+
</tr>
|
|
30
|
+
<tr>
|
|
31
|
+
<td>All-time</td>
|
|
32
|
+
<td>{{ pnl.alltime.value }}</td>
|
|
33
|
+
</tr>
|
|
34
|
+
</table>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import { parseDate } from '@/utils/parse-date';
|
|
3
|
+
import { fetchTopTraders, formatCurrency, formatPnL } from './utils';
|
|
4
|
+
import { art } from '@/utils/render';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
|
|
7
|
+
export const route: Route = {
|
|
8
|
+
path: '/top-traders',
|
|
9
|
+
categories: ['finance'],
|
|
10
|
+
example: '/hyperdash/top-traders',
|
|
11
|
+
parameters: {},
|
|
12
|
+
features: {
|
|
13
|
+
requireConfig: false,
|
|
14
|
+
requirePuppeteer: false,
|
|
15
|
+
antiCrawler: false,
|
|
16
|
+
supportBT: false,
|
|
17
|
+
supportPodcast: false,
|
|
18
|
+
supportScihub: false,
|
|
19
|
+
},
|
|
20
|
+
radar: [
|
|
21
|
+
{
|
|
22
|
+
source: ['hyperdash.info/'],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
name: 'Top Traders',
|
|
26
|
+
maintainers: ['pseudoyu'],
|
|
27
|
+
handler,
|
|
28
|
+
description: 'Get the latest top traders data from HyperDash',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
async function handler() {
|
|
32
|
+
const traders = await fetchTopTraders();
|
|
33
|
+
|
|
34
|
+
const items = traders.map((trader, index) => {
|
|
35
|
+
const rank = index + 1;
|
|
36
|
+
|
|
37
|
+
const title = trader.address;
|
|
38
|
+
|
|
39
|
+
const description = art(path.join(__dirname, 'templates/description.art'), {
|
|
40
|
+
rank,
|
|
41
|
+
address: trader.address,
|
|
42
|
+
accountValue: formatCurrency(trader.account_value),
|
|
43
|
+
mainPosition: {
|
|
44
|
+
coin: trader.main_position.coin,
|
|
45
|
+
value: formatCurrency(trader.main_position.value),
|
|
46
|
+
side: trader.main_position.side,
|
|
47
|
+
},
|
|
48
|
+
directionBias: trader.direction_bias !== null && trader.direction_bias !== undefined ? trader.direction_bias.toFixed(2) + '%' : 'N/A',
|
|
49
|
+
pnl: {
|
|
50
|
+
day: {
|
|
51
|
+
value: formatPnL(trader.perp_day_pnl),
|
|
52
|
+
},
|
|
53
|
+
week: {
|
|
54
|
+
value: formatPnL(trader.perp_week_pnl),
|
|
55
|
+
},
|
|
56
|
+
month: {
|
|
57
|
+
value: formatPnL(trader.perp_month_pnl),
|
|
58
|
+
},
|
|
59
|
+
alltime: {
|
|
60
|
+
value: formatPnL(trader.perp_alltime_pnl),
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const baseTime = new Date();
|
|
66
|
+
const orderTimestamp = new Date(baseTime.getTime() - index * 1000); // Each item 1 second apart
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
title,
|
|
70
|
+
description,
|
|
71
|
+
link: `https://hyperdash.info/trader/${trader.address}`,
|
|
72
|
+
pubDate: parseDate(orderTimestamp.toISOString()),
|
|
73
|
+
guid: trader.address,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
title: 'HyperDash Top Traders',
|
|
79
|
+
link: 'https://hyperdash.info/',
|
|
80
|
+
description: 'Top performing traders on HyperDash - real-time cryptocurrency derivatives trading analytics',
|
|
81
|
+
item: items,
|
|
82
|
+
language: 'en' as const,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ofetch } from 'ofetch';
|
|
2
|
+
|
|
3
|
+
export interface TraderData {
|
|
4
|
+
address: string;
|
|
5
|
+
account_value: number;
|
|
6
|
+
main_position: {
|
|
7
|
+
coin: string;
|
|
8
|
+
value: number;
|
|
9
|
+
side: 'LONG' | 'SHORT';
|
|
10
|
+
};
|
|
11
|
+
direction_bias: number;
|
|
12
|
+
perp_day_pnl: number;
|
|
13
|
+
perp_week_pnl: number;
|
|
14
|
+
perp_month_pnl: number;
|
|
15
|
+
perp_alltime_pnl: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function fetchTopTraders(): Promise<TraderData[]> {
|
|
19
|
+
const apiUrl = 'https://hyperdash.info/api/hyperdash/top-traders-cached';
|
|
20
|
+
|
|
21
|
+
const traders: TraderData[] = await ofetch(apiUrl, {
|
|
22
|
+
headers: {
|
|
23
|
+
'x-api-key': 'hyperdash_public_7vN3mK8pQ4wX2cL9hF5tR1bY6gS0jD',
|
|
24
|
+
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return traders;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function formatCurrency(value: number | null): string {
|
|
32
|
+
if (value === null || value === undefined) {
|
|
33
|
+
return 'N/A';
|
|
34
|
+
}
|
|
35
|
+
if (Math.abs(value) >= 1e6) {
|
|
36
|
+
return `$${(value / 1e6).toFixed(2)}M`;
|
|
37
|
+
} else if (Math.abs(value) >= 1e3) {
|
|
38
|
+
return `$${(value / 1e3).toFixed(2)}K`;
|
|
39
|
+
}
|
|
40
|
+
return `$${value.toFixed(2)}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function formatPnL(value: number | null): string {
|
|
44
|
+
if (value === null || value === undefined) {
|
|
45
|
+
return 'N/A';
|
|
46
|
+
}
|
|
47
|
+
const formatted = formatCurrency(value);
|
|
48
|
+
return value >= 0 ? `+${formatted}` : formatted;
|
|
49
|
+
}
|
|
@@ -82,7 +82,7 @@ async function handler(ctx) {
|
|
|
82
82
|
);
|
|
83
83
|
|
|
84
84
|
return {
|
|
85
|
-
title: `《明日方舟》${group === 'SYSTEM' ? '系统' :
|
|
85
|
+
title: `《明日方舟》${group === 'SYSTEM' ? '系统' : group === 'ACTIVITY' ? '活动' : '全部'}公告`,
|
|
86
86
|
link: 'https://ak.hypergryph.com/',
|
|
87
87
|
item: items,
|
|
88
88
|
};
|