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.
Potentially problematic release.
This version of rsshub might be problematic. Click here for more details.
- 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
 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Data, Route, ViewType } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { fetchCollection, rootUrl } from './utils';
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            export const route: Route = {
         
     | 
| 
      
 5 
     | 
    
         
            +
                path: '/nl-collaborations',
         
     | 
| 
      
 6 
     | 
    
         
            +
                view: ViewType.Articles,
         
     | 
| 
      
 7 
     | 
    
         
            +
                categories: ['new-media'],
         
     | 
| 
      
 8 
     | 
    
         
            +
                example: '/newslaundry/nl-collaborations',
         
     | 
| 
      
 9 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 10 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 11 
     | 
    
         
            +
                    requirePuppeteer: false,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    supportPodcast: false,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 16 
     | 
    
         
            +
                },
         
     | 
| 
      
 17 
     | 
    
         
            +
                radar: [
         
     | 
| 
      
 18 
     | 
    
         
            +
                    {
         
     | 
| 
      
 19 
     | 
    
         
            +
                        source: ['newslaundry.com/nl-collaborations'],
         
     | 
| 
      
 20 
     | 
    
         
            +
                        target: '/nl-collaborations',
         
     | 
| 
      
 21 
     | 
    
         
            +
                    },
         
     | 
| 
      
 22 
     | 
    
         
            +
                ],
         
     | 
| 
      
 23 
     | 
    
         
            +
                name: 'NL Collaboration',
         
     | 
| 
      
 24 
     | 
    
         
            +
                maintainers: ['Rjnishant530'],
         
     | 
| 
      
 25 
     | 
    
         
            +
                handler,
         
     | 
| 
      
 26 
     | 
    
         
            +
            };
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            async function handler(): Promise<Data> {
         
     | 
| 
      
 29 
     | 
    
         
            +
                return await fetchCollection('nl-collaborations', `${rootUrl}/nl-collaborations`);
         
     | 
| 
      
 30 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,61 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Data, Route, ViewType } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { fetchCollection, rootUrl } from './utils';
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            export const route: Route = {
         
     | 
| 
      
 5 
     | 
    
         
            +
                path: '/podcast/:category?',
         
     | 
| 
      
 6 
     | 
    
         
            +
                view: ViewType.Articles,
         
     | 
| 
      
 7 
     | 
    
         
            +
                categories: ['new-media'],
         
     | 
| 
      
 8 
     | 
    
         
            +
                example: '/newslaundry/podcast',
         
     | 
| 
      
 9 
     | 
    
         
            +
                parameters: { category: 'Podcast category, see below for details' },
         
     | 
| 
      
 10 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 11 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    requirePuppeteer: false,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    supportPodcast: true,
         
     | 
| 
      
 16 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 17 
     | 
    
         
            +
                },
         
     | 
| 
      
 18 
     | 
    
         
            +
                radar: [
         
     | 
| 
      
 19 
     | 
    
         
            +
                    {
         
     | 
| 
      
 20 
     | 
    
         
            +
                        source: ['newslaundry.com/podcast'],
         
     | 
| 
      
 21 
     | 
    
         
            +
                        target: '/podcast',
         
     | 
| 
      
 22 
     | 
    
         
            +
                    },
         
     | 
| 
      
 23 
     | 
    
         
            +
                    {
         
     | 
| 
      
 24 
     | 
    
         
            +
                        source: ['newslaundry.com/collection/nl-hafta-podcast'],
         
     | 
| 
      
 25 
     | 
    
         
            +
                        target: '/podcast/nl-hafta',
         
     | 
| 
      
 26 
     | 
    
         
            +
                    },
         
     | 
| 
      
 27 
     | 
    
         
            +
                    {
         
     | 
| 
      
 28 
     | 
    
         
            +
                        source: ['newslaundry.com/podcast/whats-your-ism'],
         
     | 
| 
      
 29 
     | 
    
         
            +
                        target: '/podcast/whats-your-ism',
         
     | 
| 
      
 30 
     | 
    
         
            +
                    },
         
     | 
| 
      
 31 
     | 
    
         
            +
                ],
         
     | 
| 
      
 32 
     | 
    
         
            +
                name: 'Podcast',
         
     | 
| 
      
 33 
     | 
    
         
            +
                description: `| Category | URL |
         
     | 
| 
      
 34 
     | 
    
         
            +
            | -------- | --- |
         
     | 
| 
      
 35 
     | 
    
         
            +
            | All Podcasts | [/podcast](https://rsshub.app/newslaundry/podcast) |
         
     | 
| 
      
 36 
     | 
    
         
            +
            | NL Hafta | [/podcast/nl-hafta](https://rsshub.app/newslaundry/podcast/nl-hafta) |
         
     | 
| 
      
 37 
     | 
    
         
            +
            | What's Your Ism? | [/podcast/whats-your-ism](https://rsshub.app/newslaundry/podcast/whats-your-ism) |`,
         
     | 
| 
      
 38 
     | 
    
         
            +
                maintainers: ['Rjnishant530'],
         
     | 
| 
      
 39 
     | 
    
         
            +
                handler,
         
     | 
| 
      
 40 
     | 
    
         
            +
            };
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            async function handler(ctx): Promise<Data> {
         
     | 
| 
      
 43 
     | 
    
         
            +
                const category = ctx.req.param('category');
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                // Map category to collection slug and URL
         
     | 
| 
      
 46 
     | 
    
         
            +
                const categoryMap = {
         
     | 
| 
      
 47 
     | 
    
         
            +
                    'nl-hafta': {
         
     | 
| 
      
 48 
     | 
    
         
            +
                        slug: 'nl-hafta-podcast',
         
     | 
| 
      
 49 
     | 
    
         
            +
                        url: `${rootUrl}/collection/nl-hafta-podcast`,
         
     | 
| 
      
 50 
     | 
    
         
            +
                    },
         
     | 
| 
      
 51 
     | 
    
         
            +
                    'whats-your-ism': {
         
     | 
| 
      
 52 
     | 
    
         
            +
                        slug: 'whats-your-ism-podcast-newslaundry-hindi',
         
     | 
| 
      
 53 
     | 
    
         
            +
                        url: `${rootUrl}/podcast/whats-your-ism`,
         
     | 
| 
      
 54 
     | 
    
         
            +
                    },
         
     | 
| 
      
 55 
     | 
    
         
            +
                };
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                // For main podcast route, skip the first item
         
     | 
| 
      
 58 
     | 
    
         
            +
                const skipFirstItem = !category;
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                return category && categoryMap[category] ? await fetchCollection(categoryMap[category].slug, categoryMap[category].url) : await fetchCollection('podcast', undefined, skipFirstItem);
         
     | 
| 
      
 61 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Data, Route, ViewType } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { fetchCollection } from './utils';
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            export const route: Route = {
         
     | 
| 
      
 5 
     | 
    
         
            +
                path: '/reports',
         
     | 
| 
      
 6 
     | 
    
         
            +
                view: ViewType.Articles,
         
     | 
| 
      
 7 
     | 
    
         
            +
                categories: ['new-media'],
         
     | 
| 
      
 8 
     | 
    
         
            +
                example: '/newslaundry/reports',
         
     | 
| 
      
 9 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 10 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 11 
     | 
    
         
            +
                    requirePuppeteer: false,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    supportPodcast: false,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 16 
     | 
    
         
            +
                },
         
     | 
| 
      
 17 
     | 
    
         
            +
                radar: [
         
     | 
| 
      
 18 
     | 
    
         
            +
                    {
         
     | 
| 
      
 19 
     | 
    
         
            +
                        source: ['newslaundry.com/reports'],
         
     | 
| 
      
 20 
     | 
    
         
            +
                        target: '/reports',
         
     | 
| 
      
 21 
     | 
    
         
            +
                    },
         
     | 
| 
      
 22 
     | 
    
         
            +
                ],
         
     | 
| 
      
 23 
     | 
    
         
            +
                name: 'Reports',
         
     | 
| 
      
 24 
     | 
    
         
            +
                maintainers: ['Rjnishant530'],
         
     | 
| 
      
 25 
     | 
    
         
            +
                handler,
         
     | 
| 
      
 26 
     | 
    
         
            +
            };
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            async function handler(): Promise<Data> {
         
     | 
| 
      
 29 
     | 
    
         
            +
                return await fetchCollection('reports', undefined, true);
         
     | 
| 
      
 30 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Data, Route, ViewType } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { fetchCollection } from './utils';
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            export const route: Route = {
         
     | 
| 
      
 5 
     | 
    
         
            +
                path: '/shot',
         
     | 
| 
      
 6 
     | 
    
         
            +
                view: ViewType.Articles,
         
     | 
| 
      
 7 
     | 
    
         
            +
                categories: ['new-media'],
         
     | 
| 
      
 8 
     | 
    
         
            +
                example: '/newslaundry/shot',
         
     | 
| 
      
 9 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 10 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 11 
     | 
    
         
            +
                    requirePuppeteer: false,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    supportPodcast: false,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 16 
     | 
    
         
            +
                },
         
     | 
| 
      
 17 
     | 
    
         
            +
                radar: [
         
     | 
| 
      
 18 
     | 
    
         
            +
                    {
         
     | 
| 
      
 19 
     | 
    
         
            +
                        source: ['newslaundry.com/shot'],
         
     | 
| 
      
 20 
     | 
    
         
            +
                        target: '/shot',
         
     | 
| 
      
 21 
     | 
    
         
            +
                    },
         
     | 
| 
      
 22 
     | 
    
         
            +
                ],
         
     | 
| 
      
 23 
     | 
    
         
            +
                name: 'Shot',
         
     | 
| 
      
 24 
     | 
    
         
            +
                maintainers: ['Rjnishant530'],
         
     | 
| 
      
 25 
     | 
    
         
            +
                handler,
         
     | 
| 
      
 26 
     | 
    
         
            +
            };
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            async function handler(): Promise<Data> {
         
     | 
| 
      
 29 
     | 
    
         
            +
                return await fetchCollection('shot');
         
     | 
| 
      
 30 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Data, Route, ViewType } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { fetchCollection } from './utils';
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            export const route: Route = {
         
     | 
| 
      
 5 
     | 
    
         
            +
                path: '/subscriber-only',
         
     | 
| 
      
 6 
     | 
    
         
            +
                view: ViewType.Articles,
         
     | 
| 
      
 7 
     | 
    
         
            +
                categories: ['new-media'],
         
     | 
| 
      
 8 
     | 
    
         
            +
                example: '/newslaundry/subscriber-only',
         
     | 
| 
      
 9 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 10 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 11 
     | 
    
         
            +
                    requirePuppeteer: false,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    supportPodcast: false,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 16 
     | 
    
         
            +
                },
         
     | 
| 
      
 17 
     | 
    
         
            +
                radar: [
         
     | 
| 
      
 18 
     | 
    
         
            +
                    {
         
     | 
| 
      
 19 
     | 
    
         
            +
                        source: ['newslaundry.com/subscriber-only'],
         
     | 
| 
      
 20 
     | 
    
         
            +
                        target: '/subscriber-only',
         
     | 
| 
      
 21 
     | 
    
         
            +
                    },
         
     | 
| 
      
 22 
     | 
    
         
            +
                ],
         
     | 
| 
      
 23 
     | 
    
         
            +
                name: 'Subscriber Only',
         
     | 
| 
      
 24 
     | 
    
         
            +
                maintainers: ['Rjnishant530'],
         
     | 
| 
      
 25 
     | 
    
         
            +
                handler,
         
     | 
| 
      
 26 
     | 
    
         
            +
            };
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            async function handler(): Promise<Data> {
         
     | 
| 
      
 29 
     | 
    
         
            +
                return await fetchCollection('subscriber-only');
         
     | 
| 
      
 30 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {{if subheadline}}
         
     | 
| 
      
 2 
     | 
    
         
            +
            <p><strong>{{subheadline}}</strong></p>
         
     | 
| 
      
 3 
     | 
    
         
            +
            {{/if}}
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            {{if heroImage}}
         
     | 
| 
      
 6 
     | 
    
         
            +
            <figure>
         
     | 
| 
      
 7 
     | 
    
         
            +
              <img src="{{heroImage}}" alt="{{heroAlt}}">
         
     | 
| 
      
 8 
     | 
    
         
            +
              <figcaption>{{heroCaption}}{{if heroAttribution}} ({{heroAttribution}}){{/if}}</figcaption>
         
     | 
| 
      
 9 
     | 
    
         
            +
            </figure>
         
     | 
| 
      
 10 
     | 
    
         
            +
            {{/if}}
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            {{each elements}}
         
     | 
| 
      
 13 
     | 
    
         
            +
              {{if $value.type === 'text'}}
         
     | 
| 
      
 14 
     | 
    
         
            +
                {{@ $value.text}}
         
     | 
| 
      
 15 
     | 
    
         
            +
              {{else if $value.type === 'image'}}
         
     | 
| 
      
 16 
     | 
    
         
            +
                <figure>
         
     | 
| 
      
 17 
     | 
    
         
            +
                  <img src="{{$value.url}}" alt="{{$value.alt}}">
         
     | 
| 
      
 18 
     | 
    
         
            +
                  <figcaption>{{$value.title}}</figcaption>
         
     | 
| 
      
 19 
     | 
    
         
            +
                </figure>
         
     | 
| 
      
 20 
     | 
    
         
            +
              {{else if $value.type === 'jsembed'}}
         
     | 
| 
      
 21 
     | 
    
         
            +
                {{@ $value.content}}
         
     | 
| 
      
 22 
     | 
    
         
            +
              {{else if $value.type === 'youtube-video'}}
         
     | 
| 
      
 23 
     | 
    
         
            +
                <figure>
         
     | 
| 
      
 24 
     | 
    
         
            +
                  <iframe width="560" height="315" src="{{$value.embedUrl}}" frameborder="0" allowfullscreen></iframe>
         
     | 
| 
      
 25 
     | 
    
         
            +
                  <figcaption><a href="{{$value.url}}" target="_blank" rel="noopener noreferrer">Watch on YouTube</a></figcaption>
         
     | 
| 
      
 26 
     | 
    
         
            +
                </figure>
         
     | 
| 
      
 27 
     | 
    
         
            +
              {{/if}}
         
     | 
| 
      
 28 
     | 
    
         
            +
            {{/each}}
         
     | 
| 
         @@ -0,0 +1,108 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Data, DataItem } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import ofetch from '@/utils/ofetch';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { parseDate } from '@/utils/parse-date';
         
     | 
| 
      
 4 
     | 
    
         
            +
            import { art } from '@/utils/render';
         
     | 
| 
      
 5 
     | 
    
         
            +
            import path from 'node:path';
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            export const rootUrl = 'https://www.newslaundry.com';
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            export async function fetchCollection(collectionSlug: string, customUrl?: string, skipFirstItem: boolean = false) {
         
     | 
| 
      
 10 
     | 
    
         
            +
                const apiUrl = `${rootUrl}/api/v1/collections/${collectionSlug}`;
         
     | 
| 
      
 11 
     | 
    
         
            +
                const currentUrl = customUrl || `${rootUrl}/${collectionSlug}`;
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                const response = await ofetch(apiUrl);
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                if (!response.items || !response.items.length) {
         
     | 
| 
      
 16 
     | 
    
         
            +
                    throw new Error('No articles found');
         
     | 
| 
      
 17 
     | 
    
         
            +
                }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                // Skip first item if requested
         
     | 
| 
      
 20 
     | 
    
         
            +
                const itemsToProcess = skipFirstItem ? response.items.slice(1) : response.items;
         
     | 
| 
      
 21 
     | 
    
         
            +
                const items = itemsToProcess.map((item) => processStory(item.story));
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                return {
         
     | 
| 
      
 24 
     | 
    
         
            +
                    title: `${response.name} - Newslaundry`,
         
     | 
| 
      
 25 
     | 
    
         
            +
                    description: response.summary || `${response.name} articles from Newslaundry`,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    link: currentUrl,
         
     | 
| 
      
 27 
     | 
    
         
            +
                    item: items,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    language: 'en',
         
     | 
| 
      
 29 
     | 
    
         
            +
                    logo: `${rootUrl}/favicon.ico`,
         
     | 
| 
      
 30 
     | 
    
         
            +
                    icon: `${rootUrl}/favicon.ico`,
         
     | 
| 
      
 31 
     | 
    
         
            +
                } as Data;
         
     | 
| 
      
 32 
     | 
    
         
            +
            }
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            function processStory(story: any): DataItem {
         
     | 
| 
      
 35 
     | 
    
         
            +
                const articleUrl = story.url;
         
     | 
| 
      
 36 
     | 
    
         
            +
                const pubDate = story['published-at'] ? parseDate(story['published-at']) : null;
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                // Prepare data for template
         
     | 
| 
      
 39 
     | 
    
         
            +
                const heroImage = story['hero-image-s3-key'] ? `https://media.assettype.com/${story['hero-image-s3-key']}?auto=format%2Ccompress&fit=max&dpr=1.0&format=webp` : null;
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                // Extract elements from cards
         
     | 
| 
      
 42 
     | 
    
         
            +
                const elements =
         
     | 
| 
      
 43 
     | 
    
         
            +
                    story.cards?.flatMap(
         
     | 
| 
      
 44 
     | 
    
         
            +
                        (card) =>
         
     | 
| 
      
 45 
     | 
    
         
            +
                            card?.['story-elements']
         
     | 
| 
      
 46 
     | 
    
         
            +
                                ?.map((element) => {
         
     | 
| 
      
 47 
     | 
    
         
            +
                                    if (element.type === 'text' && element.text) {
         
     | 
| 
      
 48 
     | 
    
         
            +
                                        return {
         
     | 
| 
      
 49 
     | 
    
         
            +
                                            type: 'text',
         
     | 
| 
      
 50 
     | 
    
         
            +
                                            text: element.text,
         
     | 
| 
      
 51 
     | 
    
         
            +
                                        };
         
     | 
| 
      
 52 
     | 
    
         
            +
                                    } else if (element.type === 'image' && element['image-s3-key']) {
         
     | 
| 
      
 53 
     | 
    
         
            +
                                        return {
         
     | 
| 
      
 54 
     | 
    
         
            +
                                            type: 'image',
         
     | 
| 
      
 55 
     | 
    
         
            +
                                            url: `https://media.assettype.com/${element['image-s3-key']}?auto=format%2Ccompress&format=webp`,
         
     | 
| 
      
 56 
     | 
    
         
            +
                                            alt: element['alt-text'] || '',
         
     | 
| 
      
 57 
     | 
    
         
            +
                                            title: element.title || '',
         
     | 
| 
      
 58 
     | 
    
         
            +
                                        };
         
     | 
| 
      
 59 
     | 
    
         
            +
                                    } else if (element.type === 'jsembed' && element['embed-js']) {
         
     | 
| 
      
 60 
     | 
    
         
            +
                                        try {
         
     | 
| 
      
 61 
     | 
    
         
            +
                                            return {
         
     | 
| 
      
 62 
     | 
    
         
            +
                                                type: 'jsembed',
         
     | 
| 
      
 63 
     | 
    
         
            +
                                                content: Buffer.from(element['embed-js'], 'base64').toString(),
         
     | 
| 
      
 64 
     | 
    
         
            +
                                            };
         
     | 
| 
      
 65 
     | 
    
         
            +
                                        } catch {
         
     | 
| 
      
 66 
     | 
    
         
            +
                                            // Skip if unable to decode
         
     | 
| 
      
 67 
     | 
    
         
            +
                                            return null;
         
     | 
| 
      
 68 
     | 
    
         
            +
                                        }
         
     | 
| 
      
 69 
     | 
    
         
            +
                                    } else if (element.type === 'youtube-video' && element.url) {
         
     | 
| 
      
 70 
     | 
    
         
            +
                                        return {
         
     | 
| 
      
 71 
     | 
    
         
            +
                                            type: 'youtube-video',
         
     | 
| 
      
 72 
     | 
    
         
            +
                                            url: element.url,
         
     | 
| 
      
 73 
     | 
    
         
            +
                                            embedUrl: element['embed-url'] || '',
         
     | 
| 
      
 74 
     | 
    
         
            +
                                        };
         
     | 
| 
      
 75 
     | 
    
         
            +
                                    }
         
     | 
| 
      
 76 
     | 
    
         
            +
                                    return null;
         
     | 
| 
      
 77 
     | 
    
         
            +
                                })
         
     | 
| 
      
 78 
     | 
    
         
            +
                                .filter(Boolean) || []
         
     | 
| 
      
 79 
     | 
    
         
            +
                    ) || [];
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                // Render content using template
         
     | 
| 
      
 82 
     | 
    
         
            +
                const content = art(path.join(__dirname, 'templates/description.art'), {
         
     | 
| 
      
 83 
     | 
    
         
            +
                    heroImage,
         
     | 
| 
      
 84 
     | 
    
         
            +
                    heroAlt: story['hero-image-alt-text'] || '',
         
     | 
| 
      
 85 
     | 
    
         
            +
                    heroCaption: story['hero-image-caption'] || '',
         
     | 
| 
      
 86 
     | 
    
         
            +
                    heroAttribution: story['hero-image-attribution'],
         
     | 
| 
      
 87 
     | 
    
         
            +
                    elements,
         
     | 
| 
      
 88 
     | 
    
         
            +
                    subheadline: story.subheadline,
         
     | 
| 
      
 89 
     | 
    
         
            +
                });
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                // Extract author information
         
     | 
| 
      
 92 
     | 
    
         
            +
                const authors =
         
     | 
| 
      
 93 
     | 
    
         
            +
                    story.authors?.map((author) => ({
         
     | 
| 
      
 94 
     | 
    
         
            +
                        name: author.name,
         
     | 
| 
      
 95 
     | 
    
         
            +
                        url: author.slug ? `${rootUrl}/author/${author.slug}` : undefined,
         
     | 
| 
      
 96 
     | 
    
         
            +
                    })) || [];
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                return {
         
     | 
| 
      
 99 
     | 
    
         
            +
                    title: story.headline,
         
     | 
| 
      
 100 
     | 
    
         
            +
                    link: articleUrl,
         
     | 
| 
      
 101 
     | 
    
         
            +
                    image: heroImage,
         
     | 
| 
      
 102 
     | 
    
         
            +
                    description: content || story.subheadline,
         
     | 
| 
      
 103 
     | 
    
         
            +
                    pubDate,
         
     | 
| 
      
 104 
     | 
    
         
            +
                    updated: story['last-correction-published-at'] ? parseDate(story['last-correction-published-at']) : undefined,
         
     | 
| 
      
 105 
     | 
    
         
            +
                    author: authors.length > 0 ? authors : story['author-name'],
         
     | 
| 
      
 106 
     | 
    
         
            +
                    category: story.tags?.map((tag) => tag.name) || [],
         
     | 
| 
      
 107 
     | 
    
         
            +
                } as DataItem;
         
     | 
| 
      
 108 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,100 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Route } 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: '/',
         
     | 
| 
      
 9 
     | 
    
         
            +
                categories: ['new-media'],
         
     | 
| 
      
 10 
     | 
    
         
            +
                example: '/newswav',
         
     | 
| 
      
 11 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 12 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    requirePuppeteer: false,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 16 
     | 
    
         
            +
                    supportPodcast: false,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 18 
     | 
    
         
            +
                },
         
     | 
| 
      
 19 
     | 
    
         
            +
                radar: [
         
     | 
| 
      
 20 
     | 
    
         
            +
                    {
         
     | 
| 
      
 21 
     | 
    
         
            +
                        source: ['newswav.com/latest', 'newswav.com'],
         
     | 
| 
      
 22 
     | 
    
         
            +
                    },
         
     | 
| 
      
 23 
     | 
    
         
            +
                ],
         
     | 
| 
      
 24 
     | 
    
         
            +
                name: 'Latest',
         
     | 
| 
      
 25 
     | 
    
         
            +
                maintainers: ['TonyRL'],
         
     | 
| 
      
 26 
     | 
    
         
            +
                handler,
         
     | 
| 
      
 27 
     | 
    
         
            +
            };
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            async function handler() {
         
     | 
| 
      
 30 
     | 
    
         
            +
                const baseUrl = 'https://newswav.com';
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                const response = await ofetch(`https://feed-api.newswav.com/api/web/feeds/latest`, {
         
     | 
| 
      
 33 
     | 
    
         
            +
                    query: {
         
     | 
| 
      
 34 
     | 
    
         
            +
                        languages: 'en,ms,zh',
         
     | 
| 
      
 35 
     | 
    
         
            +
                    },
         
     | 
| 
      
 36 
     | 
    
         
            +
                });
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                const list = response.data.content
         
     | 
| 
      
 39 
     | 
    
         
            +
                    .filter((i) => i.contentId !== 'AD')
         
     | 
| 
      
 40 
     | 
    
         
            +
                    .map((i) => ({
         
     | 
| 
      
 41 
     | 
    
         
            +
                        title: i.title,
         
     | 
| 
      
 42 
     | 
    
         
            +
                        description: i.description,
         
     | 
| 
      
 43 
     | 
    
         
            +
                        category: i.topics.map((topic) => topic.en),
         
     | 
| 
      
 44 
     | 
    
         
            +
                        link: `${baseUrl}/article/${i.permalink}`,
         
     | 
| 
      
 45 
     | 
    
         
            +
                        permalink: i.permalink,
         
     | 
| 
      
 46 
     | 
    
         
            +
                        pubDate: parseDate(i.publishedAt),
         
     | 
| 
      
 47 
     | 
    
         
            +
                        author: i.publisher.name,
         
     | 
| 
      
 48 
     | 
    
         
            +
                        image: i.thumbnailUrl,
         
     | 
| 
      
 49 
     | 
    
         
            +
                    }));
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                const items = await Promise.all(
         
     | 
| 
      
 52 
     | 
    
         
            +
                    list.map((item) =>
         
     | 
| 
      
 53 
     | 
    
         
            +
                        cache.tryGet(item.link, async () => {
         
     | 
| 
      
 54 
     | 
    
         
            +
                            const response = await ofetch(`https://api.newswav.com/v4/api/v1/web/contents/${item.permalink}`);
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                            if (response.contentType === 'video') {
         
     | 
| 
      
 57 
     | 
    
         
            +
                                const video = response.meta.video;
         
     | 
| 
      
 58 
     | 
    
         
            +
                                item.description = `<video controls preload="metadata" poster="${video.thumbnailUrl}"><source src="${video.videoUrl}" type="${video.mimeType}"></video><br>${video.content}`;
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                                return item;
         
     | 
| 
      
 61 
     | 
    
         
            +
                            } else if (response.contentType === 'podcast') {
         
     | 
| 
      
 62 
     | 
    
         
            +
                                const podcast = response.meta.podcast;
         
     | 
| 
      
 63 
     | 
    
         
            +
                                item.description = `<audio controls"><source src="${podcast.url}" type="audio/mpeg"></audio><br>${podcast.content}`;
         
     | 
| 
      
 64 
     | 
    
         
            +
                                item.enclosure_type = 'audio/mpeg';
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                                return item;
         
     | 
| 
      
 67 
     | 
    
         
            +
                            }
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                            const article = response.meta.article;
         
     | 
| 
      
 70 
     | 
    
         
            +
                            const $ = load(article.content);
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                            $('*')
         
     | 
| 
      
 73 
     | 
    
         
            +
                                .contents()
         
     | 
| 
      
 74 
     | 
    
         
            +
                                .filter((_, element) => element.type === 'comment' && element.data.trim() === 'AD')
         
     | 
| 
      
 75 
     | 
    
         
            +
                                .remove();
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                            $('iframe').each((_, element) => {
         
     | 
| 
      
 78 
     | 
    
         
            +
                                const $element = $(element);
         
     | 
| 
      
 79 
     | 
    
         
            +
                                if ($element.attr('src')?.includes('ga4-track.html') || $element.attr('src')?.includes('ga4-v2-track.html')) {
         
     | 
| 
      
 80 
     | 
    
         
            +
                                    $element.remove();
         
     | 
| 
      
 81 
     | 
    
         
            +
                                }
         
     | 
| 
      
 82 
     | 
    
         
            +
                            });
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                            item.description = $.html();
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                            const image = new URL(article.originalUrl);
         
     | 
| 
      
 87 
     | 
    
         
            +
                            item.image = image.pathname.startsWith('/1000x0,q50=/') ? image.pathname.replace('/1000x0,q50=/', '') : image.pathname;
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                            return item;
         
     | 
| 
      
 90 
     | 
    
         
            +
                        })
         
     | 
| 
      
 91 
     | 
    
         
            +
                    )
         
     | 
| 
      
 92 
     | 
    
         
            +
                );
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                return {
         
     | 
| 
      
 95 
     | 
    
         
            +
                    title: 'Newswav - Malaysia’s #1 Content Aggregator | Malaysia Breaking News, World News, and Latest News',
         
     | 
| 
      
 96 
     | 
    
         
            +
                    description: 'Latest news, videos and podcasts on Politics, Lifestyle, Sports, Current Affairs, Business & Finance, Entertainment and more from Malaysia & around the world.',
         
     | 
| 
      
 97 
     | 
    
         
            +
                    link: `${baseUrl}/latest`,
         
     | 
| 
      
 98 
     | 
    
         
            +
                    item: items,
         
     | 
| 
      
 99 
     | 
    
         
            +
                };
         
     | 
| 
      
 100 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -62,6 +62,22 @@ async function handler(ctx) { 
     | 
|
| 
       62 
62 
     | 
    
         
             
                            const content = load(detailResponse.data);
         
     | 
| 
       63 
63 
     | 
    
         
             
                            item.description = content('div.qrd-content').html();
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
      
 65 
     | 
    
         
            +
                            const $enclosureEl = content('div.report-bottom a').first();
         
     | 
| 
      
 66 
     | 
    
         
            +
                            const enclosureUrl = $enclosureEl.attr('href');
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                            if (enclosureUrl) {
         
     | 
| 
      
 69 
     | 
    
         
            +
                                const enclosureItem = {
         
     | 
| 
      
 70 
     | 
    
         
            +
                                    enclosure_url: new URL(enclosureUrl, rootUrl).href,
         
     | 
| 
      
 71 
     | 
    
         
            +
                                    enclosure_type: `application/${enclosureUrl.split(/\./).pop() ?? 'pdf'}`,
         
     | 
| 
      
 72 
     | 
    
         
            +
                                    enclosure_title: $enclosureEl.prev().text(),
         
     | 
| 
      
 73 
     | 
    
         
            +
                                };
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                                item = {
         
     | 
| 
      
 76 
     | 
    
         
            +
                                    ...item,
         
     | 
| 
      
 77 
     | 
    
         
            +
                                    ...enclosureItem,
         
     | 
| 
      
 78 
     | 
    
         
            +
                                };
         
     | 
| 
      
 79 
     | 
    
         
            +
                            }
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
       65 
81 
     | 
    
         
             
                            return item;
         
     | 
| 
       66 
82 
     | 
    
         
             
                        })
         
     | 
| 
       67 
83 
     | 
    
         
             
                    )
         
     | 
| 
         @@ -0,0 +1,75 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Route } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import ofetch from '@/utils/ofetch';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { parseDate } from '@/utils/parse-date';
         
     | 
| 
      
 4 
     | 
    
         
            +
            import { URLSearchParams } from 'node:url';
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            export const route: Route = {
         
     | 
| 
      
 7 
     | 
    
         
            +
                path: '/nioradio/:albumid',
         
     | 
| 
      
 8 
     | 
    
         
            +
                categories: ['multimedia'],
         
     | 
| 
      
 9 
     | 
    
         
            +
                description: `
         
     | 
| 
      
 10 
     | 
    
         
            +
            :::tip
         
     | 
| 
      
 11 
     | 
    
         
            +
            **如何获取电台 ID?**
         
     | 
| 
      
 12 
     | 
    
         
            +
            打开蔚来 APP 后,点击“此地”→“NIO Radio”,找到自己想要转换为播客的专辑,分享后在生成的链接中找到\`container_id=\`后方的数字即可。
         
     | 
| 
      
 13 
     | 
    
         
            +
            常见电台 ID:
         
     | 
| 
      
 14 
     | 
    
         
            +
            | 电台名称          | 电台 ID |
         
     | 
| 
      
 15 
     | 
    
         
            +
            | :------------ | :---- |
         
     | 
| 
      
 16 
     | 
    
         
            +
            | 资讯充电站(早间版)    | 5     |
         
     | 
| 
      
 17 
     | 
    
         
            +
            | 资讯充电站(晚间版)    | 23    |
         
     | 
| 
      
 18 
     | 
    
         
            +
            | E 次元财经报       | 148   |
         
     | 
| 
      
 19 
     | 
    
         
            +
            | 塞萌不塞车         | 661   |
         
     | 
| 
      
 20 
     | 
    
         
            +
            | 乐行记           | 11    |
         
     | 
| 
      
 21 
     | 
    
         
            +
            | Weekend Dance | 547   |
         
     | 
| 
      
 22 
     | 
    
         
            +
            :::`,
         
     | 
| 
      
 23 
     | 
    
         
            +
                example: '/nio/nioradio/5',
         
     | 
| 
      
 24 
     | 
    
         
            +
                parameters: { albumid: '电台专辑 ID' },
         
     | 
| 
      
 25 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 26 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 27 
     | 
    
         
            +
                    requirePuppeteer: false,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 29 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 30 
     | 
    
         
            +
                    supportPodcast: true,
         
     | 
| 
      
 31 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 32 
     | 
    
         
            +
                },
         
     | 
| 
      
 33 
     | 
    
         
            +
                name: 'NIO Radio',
         
     | 
| 
      
 34 
     | 
    
         
            +
                maintainers: ['marcosteam'],
         
     | 
| 
      
 35 
     | 
    
         
            +
                handler: async (ctx) => {
         
     | 
| 
      
 36 
     | 
    
         
            +
                    const { albumid } = ctx.req.param();
         
     | 
| 
      
 37 
     | 
    
         
            +
                    const req = new URLSearchParams({
         
     | 
| 
      
 38 
     | 
    
         
            +
                        albumId: albumid,
         
     | 
| 
      
 39 
     | 
    
         
            +
                        sorttype: '2',
         
     | 
| 
      
 40 
     | 
    
         
            +
                        pagenum: '1',
         
     | 
| 
      
 41 
     | 
    
         
            +
                        pagesize: '10',
         
     | 
| 
      
 42 
     | 
    
         
            +
                    }).toString();
         
     | 
| 
      
 43 
     | 
    
         
            +
                    const data = await ofetch('https://gateway-front-external.nio.com/moat/100914/v2/audio/list', {
         
     | 
| 
      
 44 
     | 
    
         
            +
                        method: 'POST',
         
     | 
| 
      
 45 
     | 
    
         
            +
                        body: req,
         
     | 
| 
      
 46 
     | 
    
         
            +
                        headers: {
         
     | 
| 
      
 47 
     | 
    
         
            +
                            'Content-Type': 'application/x-www-form-urlencoded',
         
     | 
| 
      
 48 
     | 
    
         
            +
                        },
         
     | 
| 
      
 49 
     | 
    
         
            +
                    });
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                    const podcasts = data.result.dataList;
         
     | 
| 
      
 52 
     | 
    
         
            +
                    const podcastName = podcasts[0].albumName;
         
     | 
| 
      
 53 
     | 
    
         
            +
                    const podcastImage = podcasts[0].albumPic;
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    const items = podcasts.map((podcast) => ({
         
     | 
| 
      
 56 
     | 
    
         
            +
                        title: podcast.audioName,
         
     | 
| 
      
 57 
     | 
    
         
            +
                        link: `https://app.nio.com/app/radio/share/?item_type=1&item_id=${String(podcast.audioId).slice(1)}&container_id=${albumid}`,
         
     | 
| 
      
 58 
     | 
    
         
            +
                        pubDate: parseDate(podcast.onlineTime),
         
     | 
| 
      
 59 
     | 
    
         
            +
                        description: podcast.albumDesc,
         
     | 
| 
      
 60 
     | 
    
         
            +
                        author: podcast.host.join(', '),
         
     | 
| 
      
 61 
     | 
    
         
            +
                        itunes_item_image: podcast.albumPic,
         
     | 
| 
      
 62 
     | 
    
         
            +
                        itunes_duration: podcast.duration / 1000,
         
     | 
| 
      
 63 
     | 
    
         
            +
                        enclosure_url: podcast.aacPlayUrl192,
         
     | 
| 
      
 64 
     | 
    
         
            +
                        enclosure_length: podcast.aacFileSize192,
         
     | 
| 
      
 65 
     | 
    
         
            +
                        enclosure_type: 'audio/x-m4a',
         
     | 
| 
      
 66 
     | 
    
         
            +
                    }));
         
     | 
| 
      
 67 
     | 
    
         
            +
                    return {
         
     | 
| 
      
 68 
     | 
    
         
            +
                        title: `NIO Radio - ${podcastName}`,
         
     | 
| 
      
 69 
     | 
    
         
            +
                        link: 'https://www.nio.com',
         
     | 
| 
      
 70 
     | 
    
         
            +
                        itunes_author: podcasts[0].host.join(', '),
         
     | 
| 
      
 71 
     | 
    
         
            +
                        image: podcastImage,
         
     | 
| 
      
 72 
     | 
    
         
            +
                        item: items,
         
     | 
| 
      
 73 
     | 
    
         
            +
                    };
         
     | 
| 
      
 74 
     | 
    
         
            +
                },
         
     | 
| 
      
 75 
     | 
    
         
            +
            };
         
     | 
| 
         @@ -0,0 +1,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { Route } from '@/types';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { load } from 'cheerio';
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { parseDate } from '@/utils/parse-date';
         
     | 
| 
      
 4 
     | 
    
         
            +
            import timezone from '@/utils/timezone';
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { getContent } from './utils';
         
     | 
| 
      
 6 
     | 
    
         
            +
            import InvalidParameterError from '@/errors/types/invalid-parameter';
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            const map = new Map([
         
     | 
| 
      
 9 
     | 
    
         
            +
                ['xyxw', { title: '南京理工大学计算机学院 -- 学院新闻', id: '/1817' }],
         
     | 
| 
      
 10 
     | 
    
         
            +
                ['tzgg', { title: '南京理工大学计算机学院 -- 通知公告', id: '/1820' }],
         
     | 
| 
      
 11 
     | 
    
         
            +
                ['xsdt', { title: '南京理工大学计算机学院 -- 学术动态', id: '/5790' }],
         
     | 
| 
      
 12 
     | 
    
         
            +
            ]);
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            const host = 'https://cs.njust.edu.cn';
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            export const route: Route = {
         
     | 
| 
      
 17 
     | 
    
         
            +
                path: '/cs/:type?',
         
     | 
| 
      
 18 
     | 
    
         
            +
                categories: ['university'],
         
     | 
| 
      
 19 
     | 
    
         
            +
                example: '/njust/cs/xyxw',
         
     | 
| 
      
 20 
     | 
    
         
            +
                parameters: { type: '分类名,见下表,默认为学院新闻' },
         
     | 
| 
      
 21 
     | 
    
         
            +
                features: {
         
     | 
| 
      
 22 
     | 
    
         
            +
                    requireConfig: false,
         
     | 
| 
      
 23 
     | 
    
         
            +
                    requirePuppeteer: true,
         
     | 
| 
      
 24 
     | 
    
         
            +
                    antiCrawler: false,
         
     | 
| 
      
 25 
     | 
    
         
            +
                    supportBT: false,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    supportPodcast: false,
         
     | 
| 
      
 27 
     | 
    
         
            +
                    supportScihub: false,
         
     | 
| 
      
 28 
     | 
    
         
            +
                },
         
     | 
| 
      
 29 
     | 
    
         
            +
                name: '计算机学院',
         
     | 
| 
      
 30 
     | 
    
         
            +
                maintainers: ['Horacecxk', 'jasongzy'],
         
     | 
| 
      
 31 
     | 
    
         
            +
                handler,
         
     | 
| 
      
 32 
     | 
    
         
            +
                description: `| 学院新闻 | 通知公告 | 学术动态 |
         
     | 
| 
      
 33 
     | 
    
         
            +
            | -------- | -------- | -------- |
         
     | 
| 
      
 34 
     | 
    
         
            +
            | xyxw     | tzgg     | xsdt     |`,
         
     | 
| 
      
 35 
     | 
    
         
            +
            };
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            async function handler(ctx) {
         
     | 
| 
      
 38 
     | 
    
         
            +
                const type = ctx.req.param('type') ?? 'xyxw';
         
     | 
| 
      
 39 
     | 
    
         
            +
                const info = map.get(type);
         
     | 
| 
      
 40 
     | 
    
         
            +
                if (!info) {
         
     | 
| 
      
 41 
     | 
    
         
            +
                    throw new InvalidParameterError('invalid type');
         
     | 
| 
      
 42 
     | 
    
         
            +
                }
         
     | 
| 
      
 43 
     | 
    
         
            +
                const id = info.id;
         
     | 
| 
      
 44 
     | 
    
         
            +
                const siteUrl = host + id + '/list.htm';
         
     | 
| 
      
 45 
     | 
    
         
            +
                const html = await getContent(siteUrl, true);
         
     | 
| 
      
 46 
     | 
    
         
            +
                const $ = load(html);
         
     | 
| 
      
 47 
     | 
    
         
            +
                const list = $('div#wp_news_w9').find('a');
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                return {
         
     | 
| 
      
 50 
     | 
    
         
            +
                    title: info.title,
         
     | 
| 
      
 51 
     | 
    
         
            +
                    link: siteUrl,
         
     | 
| 
      
 52 
     | 
    
         
            +
                    item: list.toArray().map((item) => ({
         
     | 
| 
      
 53 
     | 
    
         
            +
                        title: $(item).find('span[class="column-news-title"]').text().trim(),
         
     | 
| 
      
 54 
     | 
    
         
            +
                        pubDate: timezone(parseDate($(item).find('span[class="column-news-date news-date-hide"]').text(), 'YYYY-MM-DD'), +8),
         
     | 
| 
      
 55 
     | 
    
         
            +
                        link: $(item).attr('href'),
         
     | 
| 
      
 56 
     | 
    
         
            +
                    })),
         
     | 
| 
      
 57 
     | 
    
         
            +
                };
         
     | 
| 
      
 58 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -3,7 +3,7 @@ import puppeteer from '@/utils/puppeteer'; 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            async function getContent(url, pptr = false) {
         
     | 
| 
       5 
5 
     | 
    
         
             
                if (pptr) {
         
     | 
| 
       6 
     | 
    
         
            -
                    const browser = await puppeteer( 
     | 
| 
      
 6 
     | 
    
         
            +
                    const browser = await puppeteer();
         
     | 
| 
       7 
7 
     | 
    
         
             
                    try {
         
     | 
| 
       8 
8 
     | 
    
         
             
                        const page = await browser.newPage();
         
     | 
| 
       9 
9 
     | 
    
         
             
                        // 更改 window.navigator.webdriver 值以避开反爬
         
     | 
    
        package/lib/routes/ntdm/video.ts
    CHANGED
    
    
| 
         @@ -6,7 +6,7 @@ import puppeteer from '@/utils/puppeteer'; 
     | 
|
| 
       6 
6 
     | 
    
         
             
             * @desc 返回一个可用的cookie,使用 `got` 发起请求的时候,传入到`options.headers.cookie`即可
         
     | 
| 
       7 
7 
     | 
    
         
             
             */
         
     | 
| 
       8 
8 
     | 
    
         
             
            export default async function getCookie(host) {
         
     | 
| 
       9 
     | 
    
         
            -
                const browser = await puppeteer( 
     | 
| 
      
 9 
     | 
    
         
            +
                const browser = await puppeteer();
         
     | 
| 
       10 
10 
     | 
    
         
             
                const page = await browser.newPage();
         
     | 
| 
       11 
11 
     | 
    
         
             
                await page.setRequestInterception(true);
         
     | 
| 
       12 
12 
     | 
    
         
             
                page.on('request', (request) => {
         
     | 
| 
         @@ -39,7 +39,7 @@ async function handler(ctx) { 
     | 
|
| 
       39 
39 
     | 
    
         
             
                const route = category === '' ? '' : `/${category}${subCategory === '' ? '' : `/${subCategory}`}`;
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                const rootUrl = `https://${type === '' ? 'www' : 'list'}.oilchem.net`;
         
     | 
| 
       42 
     | 
    
         
            -
                const currentUrl = `${rootUrl}${type === '' ? '/1/' :  
     | 
| 
      
 42 
     | 
    
         
            +
                const currentUrl = `${rootUrl}${type === '' ? '/1/' : type === 'list' ? route : `/${routes[`/${type}${route}`]}`}`;
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                const response = await got({
         
     | 
| 
       45 
45 
     | 
    
         
             
                    method: 'get',
         
     | 
| 
         @@ -54,7 +54,7 @@ async function handler(ctx) { 
     | 
|
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
                const toApiUrl = (date) => `${rootUrl}/cnt/utf8/content/${date}/articleList/list_${id}_all.js`;
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                let apiUrl = id === 'ipo' ? ipoApiUrl :  
     | 
| 
      
 57 
     | 
    
         
            +
                let apiUrl = id === 'ipo' ? ipoApiUrl : id === 'industry' ? industryApiUrl : toApiUrl(dayjs().format('YYYYMMDD')),
         
     | 
| 
       58 
58 
     | 
    
         
             
                    hasArticle = false,
         
     | 
| 
       59 
59 
     | 
    
         
             
                    items = [],
         
     | 
| 
       60 
60 
     | 
    
         
             
                    i = 0,
         
     | 
| 
         @@ -29,7 +29,7 @@ async function handler() { 
     | 
|
| 
       29 
29 
     | 
    
         
             
                    const response = await ofetch(currentUrl);
         
     | 
| 
       30 
30 
     | 
    
         
             
                    const $ = load(response);
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                    let items = $('[class="min-h-[90vh]"] .grid a')
         
     | 
| 
      
 32 
     | 
    
         
            +
                    let items = $('[class="min-h-[90vh] mt-4"] .grid a')
         
     | 
| 
       33 
33 
     | 
    
         
             
                        .toArray()
         
     | 
| 
       34 
34 
     | 
    
         
             
                        .map((element) => {
         
     | 
| 
       35 
35 
     | 
    
         
             
                            const $element = $(element);
         
     |