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
|
@@ -26,7 +26,7 @@ async function handler() {
|
|
|
26
26
|
const html = await cache.tryGet(
|
|
27
27
|
targetUrl,
|
|
28
28
|
async () => {
|
|
29
|
-
const browser = await puppeteer(
|
|
29
|
+
const browser = await puppeteer();
|
|
30
30
|
const page = await browser.newPage();
|
|
31
31
|
await page.setRequestInterception(true);
|
|
32
32
|
page.on('request', (request) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
|
-
import
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
4
|
import utils from './utils';
|
|
5
5
|
|
|
6
6
|
export const route: Route = {
|
|
@@ -32,35 +32,38 @@ async function handler(ctx) {
|
|
|
32
32
|
const infoUrl = 'https://www.infoq.cn/public/v1/topic/getInfo';
|
|
33
33
|
const pageUrl = `https://www.infoq.cn/topic/${paramId}`;
|
|
34
34
|
|
|
35
|
-
const infoBody = Number.isNaN(paramId) ? { alias: paramId } : { id: Number.parseInt(paramId) };
|
|
35
|
+
const infoBody = Number.isNaN(Number(paramId)) ? { alias: paramId } : { id: Number.parseInt(paramId) };
|
|
36
36
|
|
|
37
|
-
const info = await
|
|
37
|
+
const info = await ofetch(infoUrl, {
|
|
38
|
+
method: 'POST',
|
|
38
39
|
headers: {
|
|
39
40
|
Referer: pageUrl,
|
|
40
41
|
},
|
|
41
|
-
|
|
42
|
+
body: infoBody,
|
|
42
43
|
});
|
|
43
|
-
const
|
|
44
|
-
const
|
|
44
|
+
const infoData = info.data;
|
|
45
|
+
const topicName = infoData.name;
|
|
45
46
|
|
|
46
|
-
const resp = await
|
|
47
|
+
const resp = await ofetch(apiUrl, {
|
|
48
|
+
method: 'POST',
|
|
47
49
|
headers: {
|
|
48
50
|
Referer: pageUrl,
|
|
49
51
|
},
|
|
50
|
-
|
|
52
|
+
body: {
|
|
53
|
+
id: infoData.id,
|
|
54
|
+
ptype: 0,
|
|
51
55
|
size: ctx.req.query('limit') ? Number(ctx.req.query('limit')) : 30,
|
|
52
|
-
type,
|
|
53
|
-
id: info.data.data.id,
|
|
56
|
+
type: 0,
|
|
54
57
|
},
|
|
55
58
|
});
|
|
56
59
|
|
|
57
|
-
const data = resp.data
|
|
60
|
+
const data = resp.data;
|
|
58
61
|
const items = await utils.ProcessFeed(data, cache);
|
|
59
62
|
|
|
60
63
|
return {
|
|
61
64
|
title: `InfoQ 话题 - ${topicName}`,
|
|
62
|
-
description:
|
|
63
|
-
image:
|
|
65
|
+
description: infoData.desc,
|
|
66
|
+
image: infoData.cover,
|
|
64
67
|
link: pageUrl,
|
|
65
68
|
item: items,
|
|
66
69
|
};
|
|
@@ -3,7 +3,7 @@ import cache from '@/utils/cache';
|
|
|
3
3
|
import { CookieJar } from 'tough-cookie';
|
|
4
4
|
import { config } from '@/config';
|
|
5
5
|
import { renderItems } from '../common-utils';
|
|
6
|
-
import { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems,
|
|
6
|
+
import { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems, getTagsFeed, renderGuestItems } from './utils';
|
|
7
7
|
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
|
8
8
|
import ConfigNotFoundError from '@/errors/types/config-not-found';
|
|
9
9
|
|
|
@@ -35,7 +35,7 @@ You may need to setup cookie for a less restrictive rate limit and private profi
|
|
|
35
35
|
|
|
36
36
|
async function handler(ctx) {
|
|
37
37
|
// if (!config.instagram || !config.instagram.cookie) {
|
|
38
|
-
// throw
|
|
38
|
+
// throw new ConfigNotFoundError('Instagram RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>');
|
|
39
39
|
// }
|
|
40
40
|
const availableCategories = ['user', 'tags'];
|
|
41
41
|
const { category, key } = ctx.req.param();
|
|
@@ -45,7 +45,7 @@ async function handler(ctx) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
let cookieJar = await cache.get('instagram:cookieJar');
|
|
48
|
-
const wwwClaimV2 = await cache.get('instagram:wwwClaimV2');
|
|
48
|
+
// const wwwClaimV2 = await cache.get('instagram:wwwClaimV2');
|
|
49
49
|
const cacheMiss = !cookieJar;
|
|
50
50
|
|
|
51
51
|
if (cacheMiss) {
|
|
@@ -59,7 +59,7 @@ async function handler(ctx) {
|
|
|
59
59
|
cookieJar = CookieJar.fromJSON(cookieJar);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (!wwwClaimV2
|
|
62
|
+
if (/* !wwwClaimV2 &&*/ cookie && !(await checkLogin(cookieJar))) {
|
|
63
63
|
throw new ConfigNotFoundError('Invalid cookie');
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ async function handler(ctx) {
|
|
|
67
67
|
let items;
|
|
68
68
|
switch (category) {
|
|
69
69
|
case 'user': {
|
|
70
|
-
const userInfo = await getUserInfo(key, cookieJar
|
|
70
|
+
const userInfo = await getUserInfo(key, cookieJar);
|
|
71
71
|
|
|
72
72
|
// User feed metadata
|
|
73
73
|
const biography = userInfo.biography;
|
|
@@ -80,22 +80,26 @@ async function handler(ctx) {
|
|
|
80
80
|
feedLogo = userInfo.profile_pic_url_hd ?? userInfo.hd_profile_pic_url_info?.url ?? userInfo.profile_pic_url;
|
|
81
81
|
feedLink = `${baseUrl}/${username}`;
|
|
82
82
|
|
|
83
|
-
items = cookie ? await getUserFeedItems(id, username, cookieJar
|
|
83
|
+
items = cookie ? await getUserFeedItems(id, username, cookieJar) : [...userInfo.edge_felix_video_timeline.edges, ...userInfo.edge_owner_to_timeline_media.edges];
|
|
84
84
|
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
case 'tags': {
|
|
88
|
+
if (!config.instagram || !config.instagram.cookie) {
|
|
89
|
+
throw new ConfigNotFoundError('Instagram RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>');
|
|
90
|
+
}
|
|
88
91
|
const tag = key;
|
|
89
92
|
|
|
90
93
|
feedTitle = `#${tag} - Instagram`;
|
|
91
|
-
feedLink = `${baseUrl}/explore/
|
|
94
|
+
feedLink = `${baseUrl}/explore/search/keyword/?q=%23${tag}`;
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
const feedData = await getTagsFeed(tag, cookieJar);
|
|
97
|
+
|
|
98
|
+
feedLogo = feedData.profile_pic_url;
|
|
99
|
+
items = feedData.top.sections.flatMap((section) =>
|
|
100
|
+
// either media or clips
|
|
101
|
+
(section.feed_type === 'media' ? section.layout_content.medias : [...section.layout_content.one_by_two_item.clips.items, ...section.layout_content.fill_items]).map((item) => item.media)
|
|
102
|
+
);
|
|
99
103
|
|
|
100
104
|
break;
|
|
101
105
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ofetch from '@/utils/ofetch';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
2
3
|
import { parseDate } from '@/utils/parse-date';
|
|
3
4
|
import { config } from '@/config';
|
|
4
5
|
import { art } from '@/utils/render';
|
|
@@ -6,7 +7,7 @@ import path from 'node:path';
|
|
|
6
7
|
import ConfigNotFoundError from '@/errors/types/config-not-found';
|
|
7
8
|
|
|
8
9
|
const baseUrl = 'https://www.instagram.com';
|
|
9
|
-
const COOKIE_URL =
|
|
10
|
+
const COOKIE_URL = baseUrl;
|
|
10
11
|
|
|
11
12
|
const getCSRFTokenFromJar = async (cookieJar) => {
|
|
12
13
|
const cookieString = await cookieJar.getCookieString(COOKIE_URL);
|
|
@@ -14,45 +15,52 @@ const getCSRFTokenFromJar = async (cookieJar) => {
|
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const getHeaders = async (cookieJar) => ({
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
18
|
+
'sec-fetch-dest': 'empty',
|
|
19
|
+
'sec-fetch-mode': 'cors',
|
|
20
|
+
'sec-fetch-site': 'same-origin',
|
|
21
|
+
'x-asbd-id': 359341,
|
|
22
|
+
'x-csrftoken': await getCSRFTokenFromJar(cookieJar),
|
|
23
|
+
'x-ig-app-id': 936_619_743_392_459,
|
|
24
|
+
'x-ig-www-claim': '0',
|
|
21
25
|
});
|
|
22
26
|
|
|
23
|
-
const checkLogin = async (cookieJar
|
|
24
|
-
const response = await
|
|
27
|
+
const checkLogin = async (cookieJar) => {
|
|
28
|
+
const response = await ofetch(`${baseUrl}/api/v1/web/fxcal/ig_sso_users/`, {
|
|
25
29
|
// cookieJar,
|
|
26
30
|
headers: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
32
|
+
cookie: (await cookieJar.getCookieString(COOKIE_URL)) as string,
|
|
33
|
+
...((await getHeaders(cookieJar)) as unknown as Record<string, string>),
|
|
34
|
+
// 'X-IG-WWW-Claim': '0',
|
|
30
35
|
},
|
|
36
|
+
method: 'POST',
|
|
31
37
|
});
|
|
32
38
|
|
|
33
|
-
const wwwClaimV2 = response.headers['x-ig-set-www-claim'];
|
|
39
|
+
// const wwwClaimV2 = response.headers['x-ig-set-www-claim'];
|
|
34
40
|
|
|
35
|
-
if (wwwClaimV2) {
|
|
36
|
-
|
|
37
|
-
}
|
|
41
|
+
// if (wwwClaimV2) {
|
|
42
|
+
// cache.set('instagram:wwwClaimV2', wwwClaimV2);
|
|
43
|
+
// }
|
|
38
44
|
|
|
39
|
-
return Boolean(response.
|
|
45
|
+
return Boolean(response.status === 'ok');
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
const getUserInfo = async (username, cookieJar
|
|
48
|
+
const getUserInfo = async (username, cookieJar) => {
|
|
43
49
|
let webProfileInfo;
|
|
44
50
|
let id = await cache.get(`instagram:getIdByUsername:${username}`);
|
|
45
51
|
let userInfoCache = await cache.get(`instagram:userInfo:${id}`);
|
|
52
|
+
userInfoCache = userInfoCache && typeof userInfoCache === 'string' ? JSON.parse(userInfoCache) : userInfoCache;
|
|
46
53
|
|
|
47
54
|
if (!userInfoCache) {
|
|
48
55
|
try {
|
|
49
|
-
const response = await
|
|
50
|
-
cookieJar,
|
|
56
|
+
const response = await ofetch.raw(`${baseUrl}/api/v1/users/web_profile_info/`, {
|
|
57
|
+
// cookieJar,
|
|
51
58
|
headers: {
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
cookie: (await cookieJar.getCookieString(COOKIE_URL)) as string,
|
|
60
|
+
...((await getHeaders(cookieJar)) as unknown as Record<string, string>),
|
|
61
|
+
// 'X-IG-WWW-Claim': (await cache.get('instagram:wwwClaimV2')) ?? undefined,
|
|
54
62
|
},
|
|
55
|
-
|
|
63
|
+
query: {
|
|
56
64
|
username,
|
|
57
65
|
},
|
|
58
66
|
});
|
|
@@ -60,7 +68,7 @@ const getUserInfo = async (username, cookieJar, cache) => {
|
|
|
60
68
|
throw new ConfigNotFoundError('Invalid cookie');
|
|
61
69
|
}
|
|
62
70
|
|
|
63
|
-
webProfileInfo = response.
|
|
71
|
+
webProfileInfo = response._data.data.user;
|
|
64
72
|
id = webProfileInfo.id;
|
|
65
73
|
|
|
66
74
|
await cache.set(`instagram:getIdByUsername:${username}`, id, 31_536_000); // 1 year since it will never change
|
|
@@ -73,24 +81,22 @@ const getUserInfo = async (username, cookieJar, cache) => {
|
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
83
|
|
|
76
|
-
userInfoCache = typeof userInfoCache === 'string' ? JSON.parse(userInfoCache) : userInfoCache;
|
|
77
|
-
|
|
78
84
|
return userInfoCache || webProfileInfo;
|
|
79
85
|
};
|
|
80
86
|
|
|
81
|
-
const getUserFeedItems = (id, username, cookieJar
|
|
87
|
+
const getUserFeedItems = (id, username, cookieJar) =>
|
|
82
88
|
cache.tryGet(
|
|
83
89
|
`instagram:feed:${id}`,
|
|
84
90
|
async () => {
|
|
85
|
-
const response = await
|
|
91
|
+
const response = await ofetch.raw(`${baseUrl}/api/v1/feed/user/${username}/username/`, {
|
|
86
92
|
// cookieJar,
|
|
87
93
|
headers: {
|
|
88
|
-
cookie: await cookieJar.getCookieString(COOKIE_URL),
|
|
89
|
-
...(await getHeaders(cookieJar)),
|
|
94
|
+
cookie: (await cookieJar.getCookieString(COOKIE_URL)) as string,
|
|
95
|
+
...((await getHeaders(cookieJar)) as unknown as Record<string, string>),
|
|
90
96
|
// 401 Unauthorized if cookie does not match with IP
|
|
91
|
-
'X-IG-WWW-Claim': await cache.get('instagram:wwwClaimV2'),
|
|
97
|
+
// 'X-IG-WWW-Claim': await cache.get('instagram:wwwClaimV2'),
|
|
92
98
|
},
|
|
93
|
-
|
|
99
|
+
query: {
|
|
94
100
|
count: 30,
|
|
95
101
|
},
|
|
96
102
|
});
|
|
@@ -99,56 +105,33 @@ const getUserFeedItems = (id, username, cookieJar, cache) =>
|
|
|
99
105
|
Please also check if your account is being blocked by Instagram.`);
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
return response.
|
|
108
|
+
return response._data.items;
|
|
103
109
|
},
|
|
104
110
|
config.cache.routeExpire,
|
|
105
111
|
false
|
|
106
112
|
);
|
|
107
113
|
|
|
108
|
-
const
|
|
109
|
-
tryGet(
|
|
114
|
+
const getTagsFeed = (tag, cookieJar) =>
|
|
115
|
+
cache.tryGet(
|
|
110
116
|
`instagram:tags:${tag}`,
|
|
111
117
|
async () => {
|
|
112
|
-
const response = await
|
|
118
|
+
const response = await ofetch(`${baseUrl}/api/v1/tags/web_info/`, {
|
|
113
119
|
// cookieJar, cookieJar is behaving weirdly here, so we use cookie header instead
|
|
114
120
|
headers: {
|
|
115
|
-
cookie: await cookieJar.getCookieString(COOKIE_URL),
|
|
116
|
-
...(await getHeaders(cookieJar)),
|
|
121
|
+
cookie: (await cookieJar.getCookieString(COOKIE_URL)) as string,
|
|
122
|
+
...((await getHeaders(cookieJar)) as unknown as Record<string, string>),
|
|
117
123
|
},
|
|
118
|
-
|
|
124
|
+
query: {
|
|
119
125
|
tag_name: tag,
|
|
120
126
|
},
|
|
121
127
|
});
|
|
122
128
|
|
|
123
|
-
return response.data
|
|
129
|
+
return response.data;
|
|
124
130
|
},
|
|
125
131
|
config.cache.routeExpire,
|
|
126
132
|
false
|
|
127
133
|
);
|
|
128
134
|
|
|
129
|
-
const getLoggedOutTagsFeedItems = async (tag, cookieJar) => {
|
|
130
|
-
const response = await got(`${baseUrl}/api/v1/tags/logged_out_web_info/`, {
|
|
131
|
-
// cookieJar, cookieJar is behaving weirdly here, so we use cookie header instead
|
|
132
|
-
headers: {
|
|
133
|
-
cookie: await cookieJar.getCookieString(COOKIE_URL),
|
|
134
|
-
...(await getHeaders(cookieJar)),
|
|
135
|
-
'X-IG-WWW-Claim': '0',
|
|
136
|
-
},
|
|
137
|
-
searchParams: {
|
|
138
|
-
tag_name: tag,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const cookies = response.headers['set-cookie'];
|
|
143
|
-
if (cookies) {
|
|
144
|
-
for await (const cookie of cookies) {
|
|
145
|
-
await cookieJar.setCookie(cookie, COOKIE_URL);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return response.data.data.hashtag;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
135
|
const renderGuestItems = (items) => {
|
|
153
136
|
const renderVideo = (node, summary) =>
|
|
154
137
|
art(path.join(__dirname, '../templates/video.art'), {
|
|
@@ -212,4 +195,4 @@ const renderGuestItems = (items) => {
|
|
|
212
195
|
});
|
|
213
196
|
};
|
|
214
197
|
|
|
215
|
-
export { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems,
|
|
198
|
+
export { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems, getTagsFeed, renderGuestItems };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Data, Route, ViewType } from '@/types';
|
|
2
|
+
import { rootUrl, fetchContent, processItem } from './utils';
|
|
3
|
+
|
|
4
|
+
export const route: Route = {
|
|
5
|
+
path: '/book-summaries',
|
|
6
|
+
view: ViewType.Articles,
|
|
7
|
+
categories: ['blog'],
|
|
8
|
+
example: '/jamesclear/book-summaries',
|
|
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: ['jamesclear.com/book-summaries'],
|
|
20
|
+
target: '/book-summaries',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
name: 'Book Summaries',
|
|
24
|
+
maintainers: ['Rjnishant530'],
|
|
25
|
+
handler,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
async function handler(): Promise<Data> {
|
|
29
|
+
const summaries = await fetchContent('book-summaries');
|
|
30
|
+
const items = summaries.map((item) => processItem(item));
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
title: 'James Clear - Book Summaries',
|
|
34
|
+
description: 'Book summaries by James Clear',
|
|
35
|
+
link: `${rootUrl}/book-summaries`,
|
|
36
|
+
item: items,
|
|
37
|
+
language: 'en',
|
|
38
|
+
icon: `${rootUrl}/favicon.ico`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Data, Route, ViewType } from '@/types';
|
|
2
|
+
import { rootUrl, fetchContent, processItem } from './utils';
|
|
3
|
+
|
|
4
|
+
export const route: Route = {
|
|
5
|
+
path: '/great-speeches',
|
|
6
|
+
view: ViewType.Articles,
|
|
7
|
+
categories: ['blog'],
|
|
8
|
+
example: '/jamesclear/great-speeches',
|
|
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: ['jamesclear.com/great-speeches'],
|
|
20
|
+
target: '/great-speeches',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
name: 'Great Speeches',
|
|
24
|
+
maintainers: ['Rjnishant530'],
|
|
25
|
+
handler,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
async function handler(): Promise<Data> {
|
|
29
|
+
const speeches = await fetchContent('great-speeches');
|
|
30
|
+
const items = speeches.map((item) => processItem(item));
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
title: 'James Clear - Great Speeches',
|
|
34
|
+
description: 'Collection of great speeches curated by James Clear',
|
|
35
|
+
link: `${rootUrl}/great-speeches`,
|
|
36
|
+
item: items,
|
|
37
|
+
language: 'en',
|
|
38
|
+
icon: `${rootUrl}/favicon.ico`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Data, Route, ViewType } from '@/types';
|
|
2
|
+
import { rootUrl, fetchContent, processItem } from './utils';
|
|
3
|
+
|
|
4
|
+
export const route: Route = {
|
|
5
|
+
path: '/quotes',
|
|
6
|
+
view: ViewType.Articles,
|
|
7
|
+
categories: ['blog'],
|
|
8
|
+
example: '/jamesclear/quotes',
|
|
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: ['jamesclear.com/quotes'],
|
|
20
|
+
target: '/quotes',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
name: 'Quotes',
|
|
24
|
+
maintainers: ['Rjnishant530'],
|
|
25
|
+
handler,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
async function handler(): Promise<Data> {
|
|
29
|
+
const quotes = await fetchContent('quotes');
|
|
30
|
+
const items = quotes.map((item) => processItem(item));
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
title: 'James Clear - Quotes',
|
|
34
|
+
description: 'Quotes from James Clear',
|
|
35
|
+
link: `${rootUrl}/quotes`,
|
|
36
|
+
item: items,
|
|
37
|
+
language: 'en',
|
|
38
|
+
icon: `${rootUrl}/favicon.ico`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Data, Route, ViewType } from '@/types';
|
|
2
|
+
import { rootUrl, fetchContent, processItem } from './utils';
|
|
3
|
+
|
|
4
|
+
export const route: Route = {
|
|
5
|
+
path: '/3-2-1',
|
|
6
|
+
view: ViewType.Articles,
|
|
7
|
+
categories: ['blog'],
|
|
8
|
+
example: '/jamesclear/3-2-1',
|
|
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: ['jamesclear.com/3-2-1'],
|
|
20
|
+
target: '/3-2-1',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
name: '3-2-1 Newsletter',
|
|
24
|
+
maintainers: ['Rjnishant530'],
|
|
25
|
+
handler,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
async function handler(): Promise<Data> {
|
|
29
|
+
const newsletters = await fetchContent('3-2-1');
|
|
30
|
+
const items = newsletters.map((item) => processItem(item));
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
title: 'James Clear - 3-2-1 Newsletter',
|
|
34
|
+
description: '3 ideas, 2 quotes, and 1 question to consider each week',
|
|
35
|
+
link: `${rootUrl}/3-2-1`,
|
|
36
|
+
item: items,
|
|
37
|
+
language: 'en',
|
|
38
|
+
image: `${rootUrl}/wp-content/uploads/2021/04/3-2-1-Featured-Image.png`,
|
|
39
|
+
icon: `${rootUrl}/favicon.ico`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import ofetch from '@/utils/ofetch';
|
|
2
|
+
import { parseDate } from '@/utils/parse-date';
|
|
3
|
+
import { DataItem } from '@/types';
|
|
4
|
+
|
|
5
|
+
export const rootUrl = 'https://jamesclear.com';
|
|
6
|
+
export const apiUrl = `${rootUrl}/wp-json/wp/v2`;
|
|
7
|
+
|
|
8
|
+
export async function fetchContent(endpoint: string) {
|
|
9
|
+
const response = await ofetch(`${apiUrl}/${endpoint}`);
|
|
10
|
+
return response;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function processItem(item: any): DataItem {
|
|
14
|
+
return {
|
|
15
|
+
title: item.title.rendered,
|
|
16
|
+
link: item.link,
|
|
17
|
+
description: item.content.rendered,
|
|
18
|
+
pubDate: parseDate(item.date_gmt),
|
|
19
|
+
author: 'James Clear',
|
|
20
|
+
guid: item.guid.rendered,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -57,10 +57,10 @@ const utils = {
|
|
|
57
57
|
|
|
58
58
|
switch (l) {
|
|
59
59
|
case 'ja':
|
|
60
|
-
customFormat = dayjs(t, formatJaDate, true).isValid() ? formatJaDate :
|
|
60
|
+
customFormat = dayjs(t, formatJaDate, true).isValid() ? formatJaDate : dayjs(t, formatJaDateTime, true).isValid() ? formatJaDateTime : undefined;
|
|
61
61
|
break;
|
|
62
62
|
case 'en':
|
|
63
|
-
customFormat = dayjs(t, formatEnDate, true).isValid() ? formatEnDate :
|
|
63
|
+
customFormat = dayjs(t, formatEnDate, true).isValid() ? formatEnDate : dayjs(t, formatEnDateTime, true).isValid() ? formatEnDateTime : undefined;
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
|
package/lib/routes/javdb/tags.ts
CHANGED