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
|
@@ -248,7 +248,9 @@ export const paginationTweets = async (endpoint: string, userId: number | undefi
|
|
|
248
248
|
return instructions.instructions;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
const
|
|
251
|
+
const userResult = data?.user?.result;
|
|
252
|
+
const timeline = userResult?.timeline?.timeline || userResult?.timeline?.timeline_v2 || userResult?.timeline_v2?.timeline;
|
|
253
|
+
const instructions = timeline?.instructions;
|
|
252
254
|
if (!instructions) {
|
|
253
255
|
logger.debug(`twitter debug: instructions not found in data: ${JSON.stringify(data)}`);
|
|
254
256
|
}
|
|
@@ -297,11 +299,31 @@ export function gatherLegacyFromData(entries: any[], filterNested?: string[], us
|
|
|
297
299
|
continue;
|
|
298
300
|
}
|
|
299
301
|
t.legacy.user = t.core?.user_result?.result?.legacy || t.core?.user_results?.result?.legacy;
|
|
302
|
+
// Add name and screen_name from core to maintain compatibility
|
|
303
|
+
if (t.legacy.user && t.core?.user_results?.result?.core) {
|
|
304
|
+
const coreUser = t.core.user_results.result.core;
|
|
305
|
+
if (coreUser.name) {
|
|
306
|
+
t.legacy.user.name = coreUser.name;
|
|
307
|
+
}
|
|
308
|
+
if (coreUser.screen_name) {
|
|
309
|
+
t.legacy.user.screen_name = coreUser.screen_name;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
300
312
|
t.legacy.id_str = t.rest_id; // avoid falling back to conversation_id_str elsewhere
|
|
301
313
|
const quote = t.quoted_status_result?.result?.tweet || t.quoted_status_result?.result;
|
|
302
314
|
if (quote) {
|
|
303
315
|
t.legacy.quoted_status = quote.legacy;
|
|
304
316
|
t.legacy.quoted_status.user = quote.core.user_result?.result?.legacy || quote.core.user_results?.result?.legacy;
|
|
317
|
+
// Add name and screen_name from core for quoted status user
|
|
318
|
+
if (t.legacy.quoted_status.user && quote.core?.user_results?.result?.core) {
|
|
319
|
+
const quoteCoreUser = quote.core.user_results.result.core;
|
|
320
|
+
if (quoteCoreUser.name) {
|
|
321
|
+
t.legacy.quoted_status.user.name = quoteCoreUser.name;
|
|
322
|
+
}
|
|
323
|
+
if (quoteCoreUser.screen_name) {
|
|
324
|
+
t.legacy.quoted_status.user.screen_name = quoteCoreUser.screen_name;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
305
327
|
}
|
|
306
328
|
if (t.note_tweet) {
|
|
307
329
|
const tmp = t.note_tweet.note_tweet_results.result;
|
|
@@ -254,7 +254,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
254
254
|
}
|
|
255
255
|
quote += formatMedia(quoteData);
|
|
256
256
|
picsPrefix += generatePicsPrefix(quoteData);
|
|
257
|
-
quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' :
|
|
257
|
+
quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : showSymbolForRetweetAndReply ? ' RT ' : '';
|
|
258
258
|
quoteInTitle += `${author.name}: ${formatText(quoteData)}`;
|
|
259
259
|
|
|
260
260
|
if (readable) {
|
|
@@ -280,21 +280,21 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
280
280
|
// Make title
|
|
281
281
|
let title = '';
|
|
282
282
|
if (showAuthorInTitle) {
|
|
283
|
-
title += originalItem.user
|
|
283
|
+
title += originalItem.user?.name + ': ';
|
|
284
284
|
}
|
|
285
285
|
const isRetweet = originalItem !== item;
|
|
286
286
|
const isQuote = item.is_quote_status;
|
|
287
287
|
if (!isRetweet && (!isQuote || showRetweetTextInTitle)) {
|
|
288
288
|
if (item.in_reply_to_screen_name) {
|
|
289
|
-
title += showEmojiForRetweetAndReply ? '↩️ ' :
|
|
289
|
+
title += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
|
|
290
290
|
}
|
|
291
291
|
title += replaceBreak(originalItem.full_text);
|
|
292
292
|
}
|
|
293
293
|
if (isRetweet) {
|
|
294
|
-
title += showEmojiForRetweetAndReply ? '🔁 ' :
|
|
294
|
+
title += showEmojiForRetweetAndReply ? '🔁 ' : showSymbolForRetweetAndReply ? 'RT ' : '';
|
|
295
295
|
title += item.user.name + ': ';
|
|
296
296
|
if (item.in_reply_to_screen_name) {
|
|
297
|
-
title += showEmojiForRetweetAndReply ? ' ↩️ ' :
|
|
297
|
+
title += showEmojiForRetweetAndReply ? ' ↩️ ' : showSymbolForRetweetAndReply ? ' Re ' : '';
|
|
298
298
|
}
|
|
299
299
|
title += replaceBreak(item.full_text);
|
|
300
300
|
}
|
|
@@ -304,7 +304,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
if (showAuthorAsTitleOnly) {
|
|
307
|
-
title = originalItem.user
|
|
307
|
+
title = originalItem.user?.name;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
// Make description
|
|
@@ -316,12 +316,12 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
316
316
|
if (showAuthorInDesc) {
|
|
317
317
|
if (readable) {
|
|
318
318
|
description += '<small>';
|
|
319
|
-
description += `<a href='https://x.com/${originalItem.user
|
|
319
|
+
description += `<a href='https://x.com/${originalItem.user?.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
|
320
320
|
}
|
|
321
321
|
if (authorNameBold) {
|
|
322
322
|
description += `<strong>`;
|
|
323
323
|
}
|
|
324
|
-
description += originalItem.user
|
|
324
|
+
description += originalItem.user?.name;
|
|
325
325
|
if (authorNameBold) {
|
|
326
326
|
description += `</strong>`;
|
|
327
327
|
}
|
|
@@ -330,16 +330,16 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
330
330
|
}
|
|
331
331
|
description += ' ';
|
|
332
332
|
}
|
|
333
|
-
description += showEmojiForRetweetAndReply ? '🔁' :
|
|
333
|
+
description += showEmojiForRetweetAndReply ? '🔁' : showSymbolForRetweetAndReply ? 'RT' : '';
|
|
334
334
|
if (!showAuthorInDesc) {
|
|
335
335
|
description += ' ';
|
|
336
336
|
if (readable) {
|
|
337
|
-
description += `<a href='https://x.com/${item.user
|
|
337
|
+
description += `<a href='https://x.com/${item.user?.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
|
338
338
|
}
|
|
339
339
|
if (authorNameBold) {
|
|
340
340
|
description += `<strong>`;
|
|
341
341
|
}
|
|
342
|
-
description += item.user
|
|
342
|
+
description += item.user?.name;
|
|
343
343
|
if (authorNameBold) {
|
|
344
344
|
description += `</strong>`;
|
|
345
345
|
}
|
|
@@ -354,7 +354,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
354
354
|
}
|
|
355
355
|
if (showAuthorInDesc) {
|
|
356
356
|
if (readable) {
|
|
357
|
-
description += `<a href='https://x.com/${item.user
|
|
357
|
+
description += `<a href='https://x.com/${item.user?.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
if (showAuthorAvatarInDesc) {
|
|
@@ -363,7 +363,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
363
363
|
if (authorNameBold) {
|
|
364
364
|
description += `<strong>`;
|
|
365
365
|
}
|
|
366
|
-
description += item.user
|
|
366
|
+
description += item.user?.name;
|
|
367
367
|
if (authorNameBold) {
|
|
368
368
|
description += `</strong>`;
|
|
369
369
|
}
|
|
@@ -373,7 +373,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
373
373
|
description += `: `;
|
|
374
374
|
}
|
|
375
375
|
if (item.in_reply_to_screen_name) {
|
|
376
|
-
description += showEmojiForRetweetAndReply ? '↩️ ' :
|
|
376
|
+
description += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
description += item.full_text;
|
|
@@ -393,16 +393,16 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
const link =
|
|
396
|
-
originalItem.user
|
|
397
|
-
? `https://x.com/${originalItem.user
|
|
398
|
-
: `https://x.com/${item.user
|
|
396
|
+
originalItem.user?.screen_name && (originalItem.id_str || originalItem.conversation_id_str)
|
|
397
|
+
? `https://x.com/${originalItem.user?.screen_name}/status/${originalItem.id_str || originalItem.conversation_id_str}`
|
|
398
|
+
: `https://x.com/${item.user?.screen_name}/status/${item.id_str || item.conversation_id_str}`;
|
|
399
399
|
return {
|
|
400
400
|
title,
|
|
401
401
|
author: [
|
|
402
402
|
{
|
|
403
|
-
name: originalItem.user
|
|
404
|
-
url: `https://x.com/${originalItem.user
|
|
405
|
-
avatar: originalItem.user
|
|
403
|
+
name: originalItem.user?.name,
|
|
404
|
+
url: `https://x.com/${originalItem.user?.screen_name}`,
|
|
405
|
+
avatar: originalItem.user?.profile_image_url_https,
|
|
406
406
|
},
|
|
407
407
|
],
|
|
408
408
|
description,
|
|
@@ -414,7 +414,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|
|
414
414
|
(isRetweet && {
|
|
415
415
|
links: [
|
|
416
416
|
{
|
|
417
|
-
url: `https://x.com/${item.user?.screen_name}/status/${item.conversation_id_str}`,
|
|
417
|
+
url: `https://x.com/${item.user?.screen_name || userScreenName}/status/${item.conversation_id_str}`,
|
|
418
418
|
type: 'repost',
|
|
419
419
|
},
|
|
420
420
|
],
|
|
@@ -83,7 +83,7 @@ async function handler(ctx) {
|
|
|
83
83
|
description += body.html();
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
if (data.publisher.name
|
|
86
|
+
if (data.publisher.name.includes('轉角國際 udn Global')) {
|
|
87
87
|
// 轉角24小時
|
|
88
88
|
description = $('.story_body_content')
|
|
89
89
|
.html()
|
|
@@ -94,7 +94,7 @@ async function handler(ctx) {
|
|
|
94
94
|
|
|
95
95
|
return {
|
|
96
96
|
title: item.title,
|
|
97
|
-
author: data.author.name,
|
|
97
|
+
author: [{ name: $('.article-content__author').text().match('中央社')?.at(0) }, { name: data.publisher.name.match('轉角國際 udn Global')?.at(0) }, data.author].filter((e) => Boolean(e.name)),
|
|
98
98
|
description,
|
|
99
99
|
pubDate: timezone(parseDate(item.time.date, 'YYYY-MM-DD HH:mm'), +8),
|
|
100
100
|
category: [data.articleSection, vip ? $('.article-head li.breadcrumb__item:last > b').text() : $("meta[name='subsection']").attr('content'), ...data.keywords.split(',')],
|
package/lib/routes/uestc/auto.ts
CHANGED
|
@@ -31,7 +31,7 @@ export const route: Route = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
async function handler() {
|
|
34
|
-
const browser = await puppeteer(
|
|
34
|
+
const browser = await puppeteer();
|
|
35
35
|
const page = await browser.newPage();
|
|
36
36
|
await page.setRequestInterception(true);
|
|
37
37
|
page.on('request', (request) => {
|
package/lib/routes/uestc/cqe.ts
CHANGED
|
@@ -51,7 +51,7 @@ async function handler(ctx) {
|
|
|
51
51
|
throw new InvalidParameterError('type not supported');
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const browser = await puppeteer(
|
|
54
|
+
const browser = await puppeteer();
|
|
55
55
|
const page = await browser.newPage();
|
|
56
56
|
await page.setRequestInterception(true);
|
|
57
57
|
page.on('request', (request) => {
|
package/lib/routes/uestc/scse.ts
CHANGED
|
@@ -45,7 +45,7 @@ export const route: Route = {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
async function handler() {
|
|
48
|
-
const browser = await puppeteer(
|
|
48
|
+
const browser = await puppeteer();
|
|
49
49
|
const page = await browser.newPage();
|
|
50
50
|
await page.setRequestInterception(true);
|
|
51
51
|
page.on('request', (request) => {
|
package/lib/routes/uestc/sice.ts
CHANGED
|
@@ -32,7 +32,7 @@ export const route: Route = {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
async function handler() {
|
|
35
|
-
const browser = await puppeteer(
|
|
35
|
+
const browser = await puppeteer();
|
|
36
36
|
const page = await browser.newPage();
|
|
37
37
|
await page.setRequestInterception(true);
|
|
38
38
|
page.on('request', (request) => {
|
package/lib/routes/uestc/sise.ts
CHANGED
|
@@ -66,7 +66,7 @@ async function handler(ctx) {
|
|
|
66
66
|
throw new InvalidParameterError('type not supported');
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const browser = await puppeteer(
|
|
69
|
+
const browser = await puppeteer();
|
|
70
70
|
const page = await browser.newPage();
|
|
71
71
|
await page.setRequestInterception(true);
|
|
72
72
|
page.on('request', (request) => {
|
package/lib/routes/upc/jwc.ts
CHANGED
|
@@ -6,46 +6,24 @@ import { parseDate } from '@/utils/parse-date';
|
|
|
6
6
|
import cache from '@/utils/cache';
|
|
7
7
|
import timezone from '@/utils/timezone';
|
|
8
8
|
|
|
9
|
-
const typeDict = {
|
|
10
|
-
tzgg: '', // 默认为所有通知
|
|
11
|
-
'18519': '教学·运行-', // 教学·运行
|
|
12
|
-
'18520': '学业·学籍-', // 学业·学籍
|
|
13
|
-
'18521': '教学·研究-', // 教学·研究
|
|
14
|
-
'18522': '课程·教材-', // 课程·教材
|
|
15
|
-
'18523': '实践·教学-', // 实践·教学
|
|
16
|
-
'18524': '创新·创业-', // 创新·创业
|
|
17
|
-
yywwz: '语言·文字-', // 语言·文字
|
|
18
|
-
jxwjy: '继续·教育-', // 继续·教育
|
|
19
|
-
bkwzs: '本科·招生-', // 本科·招生
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// module.exports = async (ctx) => {
|
|
23
9
|
const handler = async (ctx) => {
|
|
24
10
|
// 从 URL 参数中获取通知分类
|
|
25
11
|
const { type = 'tzgg' } = ctx.req.param();
|
|
26
|
-
// console.log(type);
|
|
27
12
|
const baseUrl = 'https://jwc.upc.edu.cn';
|
|
28
13
|
const { data: response } = await got(`${baseUrl}/${type}/list.htm`);
|
|
29
|
-
// console.log(`${baseUrl}/${typeDict[type]}/list.htm`);
|
|
30
14
|
const $ = load(response);
|
|
31
|
-
// const listItems = $('ul.news_list').find('li');
|
|
32
|
-
// console.log(`List item count: ${listItems.length}`);
|
|
33
|
-
// const list = $('ul.news_list') 只会得到第一个li
|
|
34
15
|
const list = $('ul.news_list')
|
|
35
16
|
.find('li')
|
|
36
17
|
// 使用“toArray()”方法将选择的所有 DOM 元素以数组的形式返回。
|
|
37
18
|
.toArray()
|
|
38
19
|
// 使用“map()”方法遍历数组,并从每个元素中解析需要的数据。
|
|
39
20
|
.map((item) => {
|
|
40
|
-
// console.log(item);
|
|
41
21
|
item = $(item);
|
|
42
22
|
const a = item.find('a').first();
|
|
43
23
|
let linkStr = a.attr('href');
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
linkStr.replace('http://', 'https://');
|
|
48
|
-
} else {
|
|
24
|
+
// 改为https访问并补全站内链接
|
|
25
|
+
linkStr = linkStr.replace('http://', 'https://');
|
|
26
|
+
if (!a.attr('href').startsWith('https://')) {
|
|
49
27
|
linkStr = `${baseUrl}${a.attr('href')}`;
|
|
50
28
|
}
|
|
51
29
|
return {
|
|
@@ -58,33 +36,41 @@ const handler = async (ctx) => {
|
|
|
58
36
|
const items = await Promise.all(
|
|
59
37
|
list.map((item) =>
|
|
60
38
|
cache.tryGet(item.link, async () => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
39
|
+
try {
|
|
40
|
+
const { data: response } = await got(item.link);
|
|
41
|
+
const $ = load(response);
|
|
42
|
+
|
|
43
|
+
if (item.link.includes('news.upc.edu.cn')) {
|
|
44
|
+
item.description = $('.v_news_content').html();
|
|
45
|
+
item.author = $('.nr-zz h2').html();
|
|
46
|
+
} else if (item.link.includes('app.upc.edu.cn')) {
|
|
47
|
+
const scriptContent = $('body script').first().html();
|
|
48
|
+
let dataObj = null;
|
|
49
|
+
if (scriptContent) {
|
|
50
|
+
const match = scriptContent.match(/data\s*:\s*function\s*\(\)\s*{\s*return\s*{[^}]*data\s*:\s*({[\s\S]*?})/);
|
|
51
|
+
if (match && match[1]) {
|
|
52
|
+
const dataStr = match[1];
|
|
53
|
+
dataObj = JSON.parse(dataStr);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
item.description = dataObj.content;
|
|
57
|
+
item.author = dataObj.author;
|
|
58
|
+
} else {
|
|
59
|
+
// 选择类名为“comment-body”的第一个元素
|
|
60
|
+
item.description = $('.read').first().html() || '无法获取正文内容,请手动访问';
|
|
61
|
+
item.author = $('.arti_publisher').html();
|
|
62
|
+
}
|
|
63
|
+
} catch {
|
|
64
|
+
item.description = '正文内容获取失败';
|
|
65
|
+
}
|
|
71
66
|
return item;
|
|
72
67
|
})
|
|
73
68
|
)
|
|
74
69
|
);
|
|
75
70
|
|
|
76
|
-
/* ctx.state.data = {
|
|
77
|
-
// 源标题
|
|
78
|
-
title: `${typeDict[type]}教务处通知-中国石油大学(华东)`,
|
|
79
|
-
// 源链接
|
|
80
|
-
link: `https://jwc.upc.edu.cn/tzgg/list.htm`,
|
|
81
|
-
// 源文章
|
|
82
|
-
item: items,
|
|
83
|
-
}; */
|
|
84
|
-
|
|
85
71
|
return {
|
|
86
72
|
// 源标题
|
|
87
|
-
title: `${
|
|
73
|
+
title: `${$('title').text()}-教务处通知-中国石油大学(华东)`,
|
|
88
74
|
// 源链接
|
|
89
75
|
link: `${baseUrl}/${type}/list.htm`,
|
|
90
76
|
// 源文章
|
|
@@ -111,7 +97,7 @@ export const route: Route = {
|
|
|
111
97
|
target: '/jwc/:type?',
|
|
112
98
|
},
|
|
113
99
|
],
|
|
114
|
-
name: '
|
|
100
|
+
name: '教务处',
|
|
115
101
|
maintainers: ['sddzhyc'],
|
|
116
102
|
description: `| 所有通知 | 教学·运行 | 学业·学籍 | 教学·研究 | 课程·教材 | 实践·教学 | 创新·创业 | 语言·文字 | 继续·教育 | 本科·招生 |
|
|
117
103
|
| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
|
@@ -97,7 +97,7 @@ async function handler(ctx) {
|
|
|
97
97
|
|
|
98
98
|
const monitors = {};
|
|
99
99
|
|
|
100
|
-
const items = rss.items.
|
|
100
|
+
const items = rss.items.toReversed().map((item) => {
|
|
101
101
|
const titleMatch = item.title.match(titleRegex);
|
|
102
102
|
if (!titleMatch) {
|
|
103
103
|
throw new InvalidParameterError('Unexpected title, please open an issue.');
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Data, Route, DataItem } from '@/types';
|
|
2
|
+
import { baseUrl } from './utils';
|
|
3
|
+
|
|
4
|
+
import ofetch from '@/utils/ofetch';
|
|
5
|
+
import { load } from 'cheerio';
|
|
6
|
+
|
|
7
|
+
export const route: Route = {
|
|
8
|
+
path: '/dailySummary',
|
|
9
|
+
example: '/visionias/dailySummary',
|
|
10
|
+
features: {
|
|
11
|
+
requireConfig: false,
|
|
12
|
+
requirePuppeteer: false,
|
|
13
|
+
antiCrawler: false,
|
|
14
|
+
supportBT: false,
|
|
15
|
+
supportPodcast: false,
|
|
16
|
+
supportScihub: false,
|
|
17
|
+
},
|
|
18
|
+
radar: [
|
|
19
|
+
{
|
|
20
|
+
source: ['visionias.in/current-affairs/upsc-daily-news-summary'],
|
|
21
|
+
target: '/dailySummary',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
name: 'Daily News Summary',
|
|
25
|
+
maintainers: ['Rjnishant530'],
|
|
26
|
+
handler,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
async function handler(): Promise<Data> {
|
|
30
|
+
const response = await ofetch(`${baseUrl}/current-affairs/upsc-daily-news-summary`);
|
|
31
|
+
|
|
32
|
+
const items = processNews(response);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
title: 'Daily News Summary | Vision IAS',
|
|
36
|
+
link: `${baseUrl}/current-affairs/upsc-daily-news-summary`,
|
|
37
|
+
description:
|
|
38
|
+
'Get concise and efficient summaries of key articles from prominent newspapers. Our daily news digest ensures quick reading and easy understanding, helping you stay informed about important events and developments without spending hours going through full articles. Perfect for focused and timely updates.',
|
|
39
|
+
language: 'en',
|
|
40
|
+
item: items,
|
|
41
|
+
image: `${baseUrl}/current-affairs/images/news-today-logo.svg`,
|
|
42
|
+
icon: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
43
|
+
logo: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
44
|
+
allowEmpty: true,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function processNews(page) {
|
|
49
|
+
const $ = load(page);
|
|
50
|
+
const items = $(`#quiz-start div[x-data="{ isExpanded: false }"]`)
|
|
51
|
+
.toArray()
|
|
52
|
+
.map((item) => {
|
|
53
|
+
const title = $(item).find('a>h5').text().trim();
|
|
54
|
+
const content = $(item).find('a>div').html() ?? '';
|
|
55
|
+
const link = $(item).find('div>p>a').attr('href') || '';
|
|
56
|
+
return {
|
|
57
|
+
title,
|
|
58
|
+
link,
|
|
59
|
+
guid: link,
|
|
60
|
+
description: content,
|
|
61
|
+
} as DataItem;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return items;
|
|
65
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Data, Route } from '@/types';
|
|
2
|
+
import { baseUrl, extractNews } from './utils';
|
|
3
|
+
|
|
4
|
+
import ofetch from '@/utils/ofetch';
|
|
5
|
+
import { load } from 'cheerio';
|
|
6
|
+
|
|
7
|
+
export const route: Route = {
|
|
8
|
+
path: '/monthlyMagazine',
|
|
9
|
+
example: '/visionias/monthlyMagazine',
|
|
10
|
+
features: {
|
|
11
|
+
requireConfig: false,
|
|
12
|
+
requirePuppeteer: false,
|
|
13
|
+
antiCrawler: false,
|
|
14
|
+
supportBT: false,
|
|
15
|
+
supportPodcast: false,
|
|
16
|
+
supportScihub: false,
|
|
17
|
+
},
|
|
18
|
+
radar: [
|
|
19
|
+
{
|
|
20
|
+
source: ['visionias.in/current-affairs/monthly-magazine'],
|
|
21
|
+
target: '/monthlyMagazine',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
name: 'Monthly Magazine',
|
|
25
|
+
maintainers: ['Rjnishant530'],
|
|
26
|
+
handler,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
async function handler(): Promise<Data> {
|
|
30
|
+
const response = await ofetch(`${baseUrl}/current-affairs/monthly-magazine`);
|
|
31
|
+
|
|
32
|
+
const items = await processNews(response);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
title: 'Monthly Magazine | Vision IAS',
|
|
36
|
+
link: `${baseUrl}/current-affairs/monthly-magazine`,
|
|
37
|
+
description:
|
|
38
|
+
'Monthly Magazine from Vision IAS provides a comprehensive overview of current affairs, covering significant events and developments across various sectors. It is designed to help aspirants stay updated with the latest happenings, enhancing their preparation for competitive exams.',
|
|
39
|
+
language: 'en',
|
|
40
|
+
item: items,
|
|
41
|
+
image: `${baseUrl}/current-affairs/images/news-today-logo.svg`,
|
|
42
|
+
icon: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
43
|
+
logo: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
44
|
+
allowEmpty: true,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function processNews(page) {
|
|
49
|
+
const $ = load(page);
|
|
50
|
+
const divItems = $(`#monthly-table-of-content>div`).toArray();
|
|
51
|
+
const linkItems = divItems.flatMap((item) => {
|
|
52
|
+
const maintitle = $(item).find('button>div:nth-child(2) div.text-left').text().trim();
|
|
53
|
+
return $(item)
|
|
54
|
+
.find('div>ul>li')
|
|
55
|
+
.toArray()
|
|
56
|
+
.map((li) => {
|
|
57
|
+
const itemTitle = $(li).find('a').text().trim();
|
|
58
|
+
const link = $(li).find('a').attr('href')?.trim() || '';
|
|
59
|
+
return {
|
|
60
|
+
title: `${itemTitle} - ${maintitle}`,
|
|
61
|
+
link: link.includes('https://') ? link : `${baseUrl}${link}`,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
const newsPromises = await Promise.allSettled(linkItems.map((item) => extractNews(item, 'main > div > div.flex.flex-col> div.flex.flex-col.w-full.mt-10')));
|
|
66
|
+
|
|
67
|
+
return newsPromises.flatMap((news) => (news.status === 'fulfilled' ? (Array.isArray(news.value) ? news.value : [news.value]) : [{ title: 'Error Parse News' }]));
|
|
68
|
+
}
|
|
@@ -65,8 +65,8 @@ async function handler(ctx): Promise<Data> {
|
|
|
65
65
|
language: 'en',
|
|
66
66
|
item: items,
|
|
67
67
|
image: `${baseUrl}/current-affairs/images/news-today-logo.svg`,
|
|
68
|
-
icon:
|
|
69
|
-
logo:
|
|
68
|
+
icon: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
69
|
+
logo: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
70
70
|
allowEmpty: true,
|
|
71
71
|
};
|
|
72
72
|
}
|
|
@@ -86,15 +86,5 @@ async function processCurrentNews(currentUrl) {
|
|
|
86
86
|
};
|
|
87
87
|
});
|
|
88
88
|
const newsPromises = await Promise.allSettled(items.map((item) => extractNews(item, 'main > div > div.mt-6 > div.flex > div.flex.mt-6')));
|
|
89
|
-
|
|
90
|
-
for (const news of newsPromises) {
|
|
91
|
-
if (news.status === 'fulfilled') {
|
|
92
|
-
finalItems.push(...(Array.isArray(news.value) ? news.value : [news.value]));
|
|
93
|
-
} else {
|
|
94
|
-
finalItems.push({
|
|
95
|
-
title: 'Error Parse News',
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return finalItems;
|
|
89
|
+
return newsPromises.flatMap((news) => (news.status === 'fulfilled' ? (Array.isArray(news.value) ? news.value : [news.value]) : [{ title: 'Error Parse News' }]));
|
|
100
90
|
}
|
|
@@ -29,7 +29,7 @@ export async function extractNews(item, selector) {
|
|
|
29
29
|
if (shortArticles.length !== 0) {
|
|
30
30
|
const items = shortArticles.toArray().map((element) => {
|
|
31
31
|
const mainDiv = $$(element);
|
|
32
|
-
const title = mainDiv.find('a > div >
|
|
32
|
+
const title = mainDiv.find('a > div > h2').text().trim();
|
|
33
33
|
const id = mainDiv.find('a').attr('href');
|
|
34
34
|
const htmlContent = extractArticle(mainDiv.html());
|
|
35
35
|
const innerTags = mainDiv
|
|
@@ -37,7 +37,7 @@ export async function extractNews(item, selector) {
|
|
|
37
37
|
?.nextAll('li')
|
|
38
38
|
.toArray()
|
|
39
39
|
.map((tag) => $$(tag).text());
|
|
40
|
-
const description = art(path.join(__dirname,
|
|
40
|
+
const description = art(path.join(__dirname, 'templates/description.art'), {
|
|
41
41
|
heading: title,
|
|
42
42
|
articleContent: htmlContent,
|
|
43
43
|
});
|
|
@@ -71,13 +71,13 @@ export async function extractNews(item, selector) {
|
|
|
71
71
|
const mainDiv = $$(element);
|
|
72
72
|
const title = mainDiv.find('a > div > h2').text().trim();
|
|
73
73
|
const htmlContent = extractArticle(mainDiv.html(), 'div.ck-content');
|
|
74
|
-
const description = art(path.join(__dirname,
|
|
74
|
+
const description = art(path.join(__dirname, 'templates/description-sub.art'), {
|
|
75
75
|
heading: title,
|
|
76
76
|
articleContent: htmlContent,
|
|
77
77
|
});
|
|
78
78
|
return { description };
|
|
79
79
|
});
|
|
80
|
-
const description = art(path.join(__dirname,
|
|
80
|
+
const description = art(path.join(__dirname, 'templates/description.art'), {
|
|
81
81
|
heading,
|
|
82
82
|
subItems: items,
|
|
83
83
|
});
|
|
@@ -94,7 +94,7 @@ export async function extractNews(item, selector) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function extractArticle(articleDiv, selectorString: string = '
|
|
97
|
+
function extractArticle(articleDiv, selectorString: string = 'div.ck-content') {
|
|
98
98
|
const $ = load(articleDiv, null, false);
|
|
99
99
|
const articleDiv$ = $(articleDiv);
|
|
100
100
|
const articleContent = articleDiv$.find(String(selectorString));
|
|
@@ -49,8 +49,8 @@ async function handler(ctx): Promise<Data> {
|
|
|
49
49
|
language: 'en',
|
|
50
50
|
item: itemsPromise.map((item) => (item.status === 'fulfilled' ? item.value : { title: 'Error Parse News' })),
|
|
51
51
|
image: `${baseUrl}/current-affairs/images/weekly-focus-logo.svg`,
|
|
52
|
-
icon:
|
|
53
|
-
logo:
|
|
52
|
+
icon: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
53
|
+
logo: `https://cdn.visionias.in/new-system-assets/images/home_page/home/vision-logo-footer.png`,
|
|
54
54
|
allowEmpty: true,
|
|
55
55
|
};
|
|
56
56
|
}
|