@jackwener/opencli 1.0.6 → 1.1.1
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/.agents/skills/cross-project-adapter-migration/SKILL.md +2 -2
- package/.github/pull_request_template.md +7 -0
- package/.github/workflows/doc-check.yml +36 -0
- package/.github/workflows/docs.yml +7 -42
- package/CHANGELOG.md +23 -0
- package/CLI-EXPLORER.md +9 -8
- package/README.md +51 -10
- package/README.zh-CN.md +29 -11
- package/SKILL.md +102 -33
- package/dist/browser/cdp.js +6 -1
- package/dist/browser/page.d.ts +4 -1
- package/dist/browser/page.js +7 -1
- package/dist/build-manifest.js +23 -16
- package/dist/cli-manifest.json +951 -296
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +225 -148
- package/dist/clis/antigravity/serve.js +296 -47
- package/dist/clis/apple-podcasts/commands.test.d.ts +2 -0
- package/dist/clis/apple-podcasts/commands.test.js +76 -0
- package/dist/clis/apple-podcasts/search.js +2 -2
- package/dist/clis/apple-podcasts/top.js +9 -2
- package/dist/clis/arxiv/paper.js +21 -0
- package/dist/clis/arxiv/search.js +24 -0
- package/dist/clis/arxiv/utils.d.ts +18 -0
- package/dist/clis/arxiv/utils.js +49 -0
- package/dist/clis/bilibili/dynamic.js +1 -1
- package/dist/clis/bilibili/favorite.js +1 -1
- package/dist/clis/bilibili/feed.js +1 -1
- package/dist/clis/bilibili/following.js +1 -1
- package/dist/clis/bilibili/history.js +1 -1
- package/dist/clis/bilibili/me.js +1 -1
- package/dist/clis/bilibili/ranking.js +1 -1
- package/dist/clis/bilibili/search.js +3 -3
- package/dist/clis/bilibili/subtitle.js +1 -1
- package/dist/clis/bilibili/user-videos.js +1 -1
- package/dist/{bilibili.d.ts → clis/bilibili/utils.d.ts} +1 -1
- package/dist/clis/bloomberg/businessweek.d.ts +1 -0
- package/dist/clis/bloomberg/businessweek.js +17 -0
- package/dist/clis/bloomberg/economics.d.ts +1 -0
- package/dist/clis/bloomberg/economics.js +17 -0
- package/dist/clis/bloomberg/feeds.d.ts +1 -0
- package/dist/clis/bloomberg/feeds.js +15 -0
- package/dist/clis/bloomberg/industries.d.ts +1 -0
- package/dist/clis/bloomberg/industries.js +17 -0
- package/dist/clis/bloomberg/main.d.ts +1 -0
- package/dist/clis/bloomberg/main.js +17 -0
- package/dist/clis/bloomberg/markets.d.ts +1 -0
- package/dist/clis/bloomberg/markets.js +17 -0
- package/dist/clis/bloomberg/news.d.ts +1 -0
- package/dist/clis/bloomberg/news.js +105 -0
- package/dist/clis/bloomberg/opinions.d.ts +1 -0
- package/dist/clis/bloomberg/opinions.js +17 -0
- package/dist/clis/bloomberg/politics.d.ts +1 -0
- package/dist/clis/bloomberg/politics.js +17 -0
- package/dist/clis/bloomberg/tech.d.ts +1 -0
- package/dist/clis/bloomberg/tech.js +17 -0
- package/dist/clis/bloomberg/utils.d.ts +34 -0
- package/dist/clis/bloomberg/utils.js +364 -0
- package/dist/clis/bloomberg/utils.test.d.ts +1 -0
- package/dist/clis/bloomberg/utils.test.js +129 -0
- package/dist/clis/boss/batchgreet.d.ts +1 -0
- package/dist/clis/boss/batchgreet.js +147 -0
- package/dist/clis/boss/chatlist.js +2 -2
- package/dist/clis/boss/detail.js +2 -2
- package/dist/clis/boss/exchange.d.ts +1 -0
- package/dist/clis/boss/exchange.js +111 -0
- package/dist/clis/boss/greet.d.ts +1 -0
- package/dist/clis/boss/greet.js +175 -0
- package/dist/clis/boss/invite.d.ts +1 -0
- package/dist/clis/boss/invite.js +158 -0
- package/dist/clis/boss/joblist.d.ts +1 -0
- package/dist/clis/boss/joblist.js +55 -0
- package/dist/clis/boss/mark.d.ts +1 -0
- package/dist/clis/boss/mark.js +141 -0
- package/dist/clis/boss/recommend.d.ts +1 -0
- package/dist/clis/boss/recommend.js +83 -0
- package/dist/clis/boss/search.js +1 -1
- package/dist/clis/boss/send.js +1 -1
- package/dist/clis/boss/stats.d.ts +1 -0
- package/dist/clis/boss/stats.js +116 -0
- package/dist/clis/chaoxing/assignments.js +1 -1
- package/dist/clis/chaoxing/exams.js +1 -1
- package/dist/{chaoxing.d.ts → clis/chaoxing/utils.d.ts} +1 -1
- package/dist/{chaoxing.js → clis/chaoxing/utils.js} +0 -2
- package/dist/clis/chaoxing/utils.test.d.ts +1 -0
- package/dist/{chaoxing.test.js → clis/chaoxing/utils.test.js} +1 -1
- package/dist/clis/chatgpt/read.js +1 -1
- package/dist/clis/chatwise/export.js +1 -1
- package/dist/clis/chatwise/model.js +2 -2
- package/dist/clis/chatwise/screenshot.js +1 -1
- package/dist/clis/codex/export.js +1 -1
- package/dist/clis/codex/model.js +2 -2
- package/dist/clis/codex/screenshot.js +1 -1
- package/dist/clis/coupang/add-to-cart.js +3 -4
- package/dist/clis/coupang/search.js +2 -4
- package/dist/clis/coupang/utils.test.d.ts +1 -0
- package/dist/{coupang.test.js → clis/coupang/utils.test.js} +1 -1
- package/dist/clis/ctrip/search.js +1 -1
- package/dist/clis/cursor/export.js +1 -1
- package/dist/clis/cursor/model.js +2 -2
- package/dist/clis/cursor/screenshot.js +1 -1
- package/dist/clis/jike/comment.js +2 -3
- package/dist/clis/jike/create.js +1 -2
- package/dist/clis/jike/feed.js +0 -1
- package/dist/clis/jike/like.js +1 -2
- package/dist/clis/jike/notifications.js +0 -1
- package/dist/clis/jike/post.yaml +1 -0
- package/dist/clis/jike/repost.js +1 -2
- package/dist/clis/jike/search.js +2 -3
- package/dist/clis/jike/topic.yaml +1 -0
- package/dist/clis/jike/user.yaml +1 -0
- package/dist/clis/jimeng/history.yaml +0 -1
- package/dist/clis/linkedin/search.js +7 -7
- package/dist/clis/linux-do/category.yaml +1 -0
- package/dist/clis/linux-do/search.yaml +4 -3
- package/dist/clis/linux-do/topic.yaml +1 -0
- package/dist/clis/notion/export.js +1 -1
- package/dist/clis/reddit/comment.js +3 -4
- package/dist/clis/reddit/read.js +4 -5
- package/dist/clis/reddit/save.js +2 -3
- package/dist/clis/reddit/saved.js +0 -1
- package/dist/clis/reddit/search.yaml +1 -0
- package/dist/clis/reddit/subscribe.js +0 -1
- package/dist/clis/reddit/upvote.js +2 -3
- package/dist/clis/reddit/upvoted.js +0 -1
- package/dist/clis/reddit/user-comments.yaml +1 -0
- package/dist/clis/reddit/user-posts.yaml +1 -0
- package/dist/clis/reddit/user.yaml +1 -0
- package/dist/clis/reuters/search.js +1 -1
- package/dist/clis/sinafinance/news.d.ts +7 -0
- package/dist/clis/sinafinance/news.js +61 -0
- package/dist/clis/smzdm/search.js +2 -3
- package/dist/clis/stackoverflow/search.yaml +1 -0
- package/dist/clis/steam/top-sellers.yaml +29 -0
- package/dist/clis/twitter/accept.js +2 -2
- package/dist/clis/twitter/article.js +2 -2
- package/dist/clis/twitter/block.d.ts +1 -0
- package/dist/clis/twitter/block.js +88 -0
- package/dist/clis/twitter/delete.js +1 -1
- package/dist/clis/twitter/hide-reply.d.ts +1 -0
- package/dist/clis/twitter/hide-reply.js +66 -0
- package/dist/clis/twitter/like.js +1 -1
- package/dist/clis/twitter/post.js +1 -1
- package/dist/clis/twitter/reply-dm.js +1 -1
- package/dist/clis/twitter/reply.js +2 -2
- package/dist/clis/twitter/search.js +1 -1
- package/dist/clis/twitter/thread.js +2 -2
- package/dist/clis/twitter/trending.d.ts +1 -0
- package/dist/clis/twitter/trending.js +91 -0
- package/dist/clis/twitter/unblock.d.ts +1 -0
- package/dist/clis/twitter/unblock.js +71 -0
- package/dist/clis/v2ex/topic.yaml +1 -0
- package/dist/clis/weibo/hot.js +0 -1
- package/dist/clis/weread/book.js +1 -1
- package/dist/clis/weread/highlights.js +1 -1
- package/dist/clis/weread/notes.js +1 -1
- package/dist/clis/weread/search.js +1 -1
- package/dist/clis/wikipedia/search.d.ts +1 -0
- package/dist/clis/wikipedia/search.js +30 -0
- package/dist/clis/wikipedia/summary.d.ts +1 -0
- package/dist/clis/wikipedia/summary.js +28 -0
- package/dist/clis/wikipedia/utils.d.ts +8 -0
- package/dist/clis/wikipedia/utils.js +18 -0
- package/dist/clis/xiaohongshu/creator-note-detail.d.ts +79 -5
- package/dist/clis/xiaohongshu/creator-note-detail.js +323 -70
- package/dist/clis/xiaohongshu/creator-note-detail.test.d.ts +1 -0
- package/dist/clis/xiaohongshu/creator-note-detail.test.js +258 -0
- package/dist/clis/xiaohongshu/creator-notes-summary.d.ts +28 -0
- package/dist/clis/xiaohongshu/creator-notes-summary.js +92 -0
- package/dist/clis/xiaohongshu/creator-notes-summary.test.d.ts +1 -0
- package/dist/clis/xiaohongshu/creator-notes-summary.test.js +49 -0
- package/dist/clis/xiaohongshu/creator-notes.d.ts +18 -5
- package/dist/clis/xiaohongshu/creator-notes.js +189 -71
- package/dist/clis/xiaohongshu/creator-notes.test.d.ts +1 -0
- package/dist/clis/xiaohongshu/creator-notes.test.js +191 -0
- package/dist/clis/xiaohongshu/creator-profile.js +0 -1
- package/dist/clis/xiaohongshu/creator-stats.js +0 -1
- package/dist/clis/xiaohongshu/download.js +2 -3
- package/dist/clis/xiaohongshu/feed.yaml +0 -1
- package/dist/clis/xiaohongshu/notifications.yaml +0 -1
- package/dist/clis/xiaohongshu/search.js +2 -2
- package/dist/clis/xiaohongshu/user.js +1 -2
- package/dist/clis/yahoo-finance/quote.js +0 -1
- package/dist/clis/youtube/search.js +1 -1
- package/dist/clis/youtube/transcript.js +1 -1
- package/dist/clis/youtube/video.js +1 -1
- package/dist/clis/zhihu/download.js +1 -2
- package/dist/clis/zhihu/question.js +1 -1
- package/dist/clis/zhihu/search.yaml +4 -3
- package/dist/commanderAdapter.d.ts +21 -0
- package/dist/commanderAdapter.js +111 -0
- package/dist/{engine.d.ts → discovery.d.ts} +0 -6
- package/dist/{engine.js → discovery.js} +1 -98
- package/dist/download/index.d.ts +2 -6
- package/dist/download/index.js +19 -46
- package/dist/engine.test.d.ts +1 -1
- package/dist/engine.test.js +8 -7
- package/dist/execution.d.ts +22 -0
- package/dist/execution.js +129 -0
- package/dist/explore.js +121 -107
- package/dist/external-clis.yaml +48 -0
- package/dist/external.d.ts +25 -0
- package/dist/external.js +156 -0
- package/dist/main.js +1 -1
- package/dist/pipeline/steps/browser.js +8 -2
- package/dist/registry.d.ts +2 -0
- package/dist/registry.js +2 -0
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +8 -0
- package/dist/serialization.d.ts +34 -0
- package/dist/serialization.js +63 -0
- package/dist/types.d.ts +4 -1
- package/docs/.vitepress/config.mts +14 -3
- package/docs/adapters/browser/arxiv.md +27 -0
- package/docs/adapters/browser/barchart.md +32 -0
- package/docs/adapters/browser/bloomberg.md +70 -0
- package/docs/adapters/browser/chaoxing.md +39 -0
- package/docs/adapters/browser/grok.md +35 -0
- package/docs/adapters/browser/hf.md +42 -0
- package/docs/adapters/browser/jike.md +45 -0
- package/docs/adapters/browser/jimeng.md +39 -0
- package/docs/adapters/browser/linux-do.md +45 -0
- package/docs/adapters/browser/sinafinance.md +35 -0
- package/docs/adapters/browser/stackoverflow.md +35 -0
- package/docs/adapters/browser/steam.md +26 -0
- package/docs/adapters/browser/twitter.md +3 -0
- package/docs/adapters/browser/weread.md +48 -0
- package/docs/adapters/browser/wikipedia.md +30 -0
- package/docs/adapters/browser/xiaohongshu.md +5 -1
- package/docs/adapters/desktop/chatgpt.md +3 -3
- package/docs/adapters/index.md +13 -0
- package/docs/advanced/download.md +4 -4
- package/docs/developer/architecture.md +17 -4
- package/package.json +1 -1
- package/scripts/check-doc-coverage.sh +69 -0
- package/scripts/copy-yaml.cjs +7 -0
- package/src/browser/cdp.ts +9 -4
- package/src/browser/page.ts +7 -1
- package/src/build-manifest.ts +25 -19
- package/src/cli.ts +253 -119
- package/src/clis/antigravity/serve.ts +323 -50
- package/src/clis/apple-podcasts/commands.test.ts +95 -0
- package/src/clis/apple-podcasts/search.ts +2 -2
- package/src/clis/apple-podcasts/top.ts +12 -2
- package/src/clis/arxiv/paper.ts +21 -0
- package/src/clis/arxiv/search.ts +24 -0
- package/src/clis/arxiv/utils.ts +63 -0
- package/src/clis/bilibili/dynamic.ts +1 -1
- package/src/clis/bilibili/favorite.ts +1 -1
- package/src/clis/bilibili/feed.ts +1 -1
- package/src/clis/bilibili/following.ts +1 -1
- package/src/clis/bilibili/history.ts +1 -1
- package/src/clis/bilibili/me.ts +1 -1
- package/src/clis/bilibili/ranking.ts +1 -1
- package/src/clis/bilibili/search.ts +3 -3
- package/src/clis/bilibili/subtitle.ts +1 -1
- package/src/clis/bilibili/user-videos.ts +1 -1
- package/src/{bilibili.ts → clis/bilibili/utils.ts} +1 -1
- package/src/clis/bloomberg/businessweek.ts +18 -0
- package/src/clis/bloomberg/economics.ts +18 -0
- package/src/clis/bloomberg/feeds.ts +16 -0
- package/src/clis/bloomberg/industries.ts +18 -0
- package/src/clis/bloomberg/main.ts +18 -0
- package/src/clis/bloomberg/markets.ts +18 -0
- package/src/clis/bloomberg/news.ts +136 -0
- package/src/clis/bloomberg/opinions.ts +18 -0
- package/src/clis/bloomberg/politics.ts +18 -0
- package/src/clis/bloomberg/tech.ts +18 -0
- package/src/clis/bloomberg/utils.test.ts +135 -0
- package/src/clis/bloomberg/utils.ts +429 -0
- package/src/clis/boss/batchgreet.ts +167 -0
- package/src/clis/boss/chatlist.ts +2 -2
- package/src/clis/boss/detail.ts +2 -2
- package/src/clis/boss/exchange.ts +126 -0
- package/src/clis/boss/greet.ts +198 -0
- package/src/clis/boss/invite.ts +177 -0
- package/src/clis/boss/joblist.ts +63 -0
- package/src/clis/boss/mark.ts +155 -0
- package/src/clis/boss/recommend.ts +94 -0
- package/src/clis/boss/search.ts +1 -1
- package/src/clis/boss/send.ts +1 -1
- package/src/clis/boss/stats.ts +130 -0
- package/src/clis/chaoxing/assignments.ts +1 -1
- package/src/clis/chaoxing/exams.ts +1 -1
- package/src/{chaoxing.test.ts → clis/chaoxing/utils.test.ts} +1 -1
- package/src/{chaoxing.ts → clis/chaoxing/utils.ts} +1 -3
- package/src/clis/chatgpt/README.zh-CN.md +3 -3
- package/src/clis/chatgpt/read.ts +1 -1
- package/src/clis/chatwise/export.ts +1 -1
- package/src/clis/chatwise/model.ts +2 -2
- package/src/clis/chatwise/screenshot.ts +1 -1
- package/src/clis/codex/export.ts +1 -1
- package/src/clis/codex/model.ts +2 -2
- package/src/clis/codex/screenshot.ts +1 -1
- package/src/clis/coupang/add-to-cart.ts +3 -4
- package/src/clis/coupang/search.ts +2 -4
- package/src/{coupang.test.ts → clis/coupang/utils.test.ts} +1 -1
- package/src/clis/ctrip/search.ts +1 -1
- package/src/clis/cursor/export.ts +1 -1
- package/src/clis/cursor/model.ts +2 -2
- package/src/clis/cursor/screenshot.ts +1 -1
- package/src/clis/jike/comment.ts +2 -3
- package/src/clis/jike/create.ts +1 -2
- package/src/clis/jike/feed.ts +0 -1
- package/src/clis/jike/like.ts +1 -2
- package/src/clis/jike/notifications.ts +0 -1
- package/src/clis/jike/post.yaml +1 -0
- package/src/clis/jike/repost.ts +1 -2
- package/src/clis/jike/search.ts +2 -3
- package/src/clis/jike/topic.yaml +1 -0
- package/src/clis/jike/user.yaml +1 -0
- package/src/clis/jimeng/history.yaml +0 -1
- package/src/clis/linkedin/search.ts +7 -7
- package/src/clis/linux-do/category.yaml +1 -0
- package/src/clis/linux-do/search.yaml +4 -3
- package/src/clis/linux-do/topic.yaml +1 -0
- package/src/clis/notion/export.ts +1 -1
- package/src/clis/reddit/comment.ts +3 -4
- package/src/clis/reddit/read.ts +4 -5
- package/src/clis/reddit/save.ts +2 -3
- package/src/clis/reddit/saved.ts +0 -1
- package/src/clis/reddit/search.yaml +1 -0
- package/src/clis/reddit/subscribe.ts +0 -1
- package/src/clis/reddit/upvote.ts +2 -3
- package/src/clis/reddit/upvoted.ts +0 -1
- package/src/clis/reddit/user-comments.yaml +1 -0
- package/src/clis/reddit/user-posts.yaml +1 -0
- package/src/clis/reddit/user.yaml +1 -0
- package/src/clis/reuters/search.ts +1 -1
- package/src/clis/sinafinance/news.ts +76 -0
- package/src/clis/smzdm/search.ts +2 -3
- package/src/clis/stackoverflow/search.yaml +1 -0
- package/src/clis/steam/top-sellers.yaml +29 -0
- package/src/clis/twitter/accept.ts +2 -2
- package/src/clis/twitter/article.ts +2 -2
- package/src/clis/twitter/block.ts +92 -0
- package/src/clis/twitter/delete.ts +1 -1
- package/src/clis/twitter/hide-reply.ts +70 -0
- package/src/clis/twitter/like.ts +1 -1
- package/src/clis/twitter/post.ts +1 -1
- package/src/clis/twitter/reply-dm.ts +1 -1
- package/src/clis/twitter/reply.ts +2 -2
- package/src/clis/twitter/search.ts +1 -1
- package/src/clis/twitter/thread.ts +2 -2
- package/src/clis/twitter/trending.ts +113 -0
- package/src/clis/twitter/unblock.ts +75 -0
- package/src/clis/v2ex/topic.yaml +1 -0
- package/src/clis/weibo/hot.ts +0 -1
- package/src/clis/weread/book.ts +1 -1
- package/src/clis/weread/highlights.ts +1 -1
- package/src/clis/weread/notes.ts +1 -1
- package/src/clis/weread/search.ts +1 -1
- package/src/clis/wikipedia/search.ts +32 -0
- package/src/clis/wikipedia/summary.ts +28 -0
- package/src/clis/wikipedia/utils.ts +20 -0
- package/src/clis/xiaohongshu/creator-note-detail.test.ts +272 -0
- package/src/clis/xiaohongshu/creator-note-detail.ts +425 -73
- package/src/clis/xiaohongshu/creator-notes-summary.test.ts +54 -0
- package/src/clis/xiaohongshu/creator-notes-summary.ts +120 -0
- package/src/clis/xiaohongshu/creator-notes.test.ts +211 -0
- package/src/clis/xiaohongshu/creator-notes.ts +254 -75
- package/src/clis/xiaohongshu/creator-profile.ts +0 -1
- package/src/clis/xiaohongshu/creator-stats.ts +0 -1
- package/src/clis/xiaohongshu/download.ts +2 -3
- package/src/clis/xiaohongshu/feed.yaml +0 -1
- package/src/clis/xiaohongshu/notifications.yaml +0 -1
- package/src/clis/xiaohongshu/search.ts +2 -2
- package/src/clis/xiaohongshu/user.ts +1 -2
- package/src/clis/yahoo-finance/quote.ts +0 -1
- package/src/clis/youtube/search.ts +1 -1
- package/src/clis/youtube/transcript.ts +1 -1
- package/src/clis/youtube/video.ts +1 -1
- package/src/clis/zhihu/download.ts +1 -2
- package/src/clis/zhihu/question.ts +1 -1
- package/src/clis/zhihu/search.yaml +4 -3
- package/src/commanderAdapter.ts +113 -0
- package/src/daemon.ts +3 -3
- package/src/{engine.ts → discovery.ts} +1 -108
- package/src/download/index.ts +21 -54
- package/src/engine.test.ts +8 -7
- package/src/execution.ts +138 -0
- package/src/explore.ts +135 -109
- package/src/external-clis.yaml +48 -0
- package/src/external.ts +185 -0
- package/src/main.ts +1 -1
- package/src/pipeline/steps/browser.ts +7 -2
- package/src/registry.ts +5 -0
- package/src/runtime.ts +9 -0
- package/src/serialization.ts +79 -0
- package/src/types.ts +1 -1
- package/tests/e2e/browser-public.test.ts +25 -0
- package/tests/e2e/public-commands.test.ts +55 -1
- package/dist/clis/twitter/trending.yaml +0 -46
- package/src/clis/twitter/trending.yaml +0 -46
- /package/dist/{chaoxing.test.d.ts → clis/arxiv/paper.d.ts} +0 -0
- /package/dist/{coupang.test.d.ts → clis/arxiv/search.d.ts} +0 -0
- /package/dist/{bilibili.js → clis/bilibili/utils.js} +0 -0
- /package/dist/{coupang.d.ts → clis/coupang/utils.d.ts} +0 -0
- /package/dist/{coupang.js → clis/coupang/utils.js} +0 -0
- /package/src/{coupang.ts → clis/coupang/utils.ts} +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* arXiv adapter utilities.
|
|
3
|
+
*
|
|
4
|
+
* arXiv exposes a public Atom/XML API — no key required.
|
|
5
|
+
* https://info.arxiv.org/help/api/index.html
|
|
6
|
+
*/
|
|
7
|
+
import { CliError } from '../../errors.js';
|
|
8
|
+
export const ARXIV_BASE = 'https://export.arxiv.org/api/query';
|
|
9
|
+
export async function arxivFetch(params) {
|
|
10
|
+
const resp = await fetch(`${ARXIV_BASE}?${params}`);
|
|
11
|
+
if (!resp.ok) {
|
|
12
|
+
throw new CliError('FETCH_ERROR', `arXiv API HTTP ${resp.status}`, 'Check your search term or paper ID');
|
|
13
|
+
}
|
|
14
|
+
return resp.text();
|
|
15
|
+
}
|
|
16
|
+
/** Extract the text content of the first matching XML tag. */
|
|
17
|
+
function extract(xml, tag) {
|
|
18
|
+
const m = xml.match(new RegExp(`<${tag}[^>]*>([\\s\\S]*?)<\\/${tag}>`));
|
|
19
|
+
return m ? m[1].trim() : '';
|
|
20
|
+
}
|
|
21
|
+
/** Extract all text contents of a repeated XML tag. */
|
|
22
|
+
function extractAll(xml, tag) {
|
|
23
|
+
const re = new RegExp(`<${tag}[^>]*>([\\s\\S]*?)<\\/${tag}>`, 'g');
|
|
24
|
+
const results = [];
|
|
25
|
+
let m;
|
|
26
|
+
while ((m = re.exec(xml)) !== null)
|
|
27
|
+
results.push(m[1].trim());
|
|
28
|
+
return results;
|
|
29
|
+
}
|
|
30
|
+
/** Parse Atom XML feed into structured entries. */
|
|
31
|
+
export function parseEntries(xml) {
|
|
32
|
+
const entryRe = /<entry>([\s\S]*?)<\/entry>/g;
|
|
33
|
+
const entries = [];
|
|
34
|
+
let m;
|
|
35
|
+
while ((m = entryRe.exec(xml)) !== null) {
|
|
36
|
+
const e = m[1];
|
|
37
|
+
const rawId = extract(e, 'id');
|
|
38
|
+
const arxivId = rawId.replace(/^https?:\/\/arxiv\.org\/abs\//, '').replace(/v\d+$/, '');
|
|
39
|
+
entries.push({
|
|
40
|
+
id: arxivId,
|
|
41
|
+
title: extract(e, 'title').replace(/\s+/g, ' '),
|
|
42
|
+
authors: extractAll(e, 'name').slice(0, 3).join(', '),
|
|
43
|
+
abstract: (() => { const s = extract(e, 'summary').replace(/\s+/g, ' '); return s.length > 200 ? s.slice(0, 200) + '...' : s; })(),
|
|
44
|
+
published: extract(e, 'published').slice(0, 10),
|
|
45
|
+
url: `https://arxiv.org/abs/${arxivId}`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return entries;
|
|
49
|
+
}
|
package/dist/clis/bilibili/me.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cli, Strategy } from '../../registry.js';
|
|
2
|
-
import { apiGet, getSelfUid } from '
|
|
2
|
+
import { apiGet, getSelfUid } from './utils.js';
|
|
3
3
|
cli({
|
|
4
4
|
site: 'bilibili', name: 'me', description: 'My Bilibili profile info', domain: 'www.bilibili.com', strategy: Strategy.COOKIE,
|
|
5
5
|
args: [],
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { cli, Strategy } from '../../registry.js';
|
|
2
|
-
import { apiGet, stripHtml } from '
|
|
2
|
+
import { apiGet, stripHtml } from './utils.js';
|
|
3
3
|
cli({
|
|
4
4
|
site: 'bilibili', name: 'search', description: 'Search Bilibili videos or users', domain: 'www.bilibili.com', strategy: Strategy.COOKIE,
|
|
5
5
|
args: [
|
|
6
|
-
{ name: '
|
|
6
|
+
{ name: 'query', required: true, positional: true, help: 'Search keyword' },
|
|
7
7
|
{ name: 'type', default: 'video', help: 'video or user' },
|
|
8
8
|
{ name: 'page', type: 'int', default: 1, help: 'Result page' },
|
|
9
9
|
{ name: 'limit', type: 'int', default: 20, help: 'Number of results' },
|
|
10
10
|
],
|
|
11
11
|
columns: ['rank', 'title', 'author', 'score', 'url'],
|
|
12
12
|
func: async (page, kwargs) => {
|
|
13
|
-
const { keyword, type = 'video', page: pageNum = 1, limit = 20 } = kwargs;
|
|
13
|
+
const { query: keyword, type = 'video', page: pageNum = 1, limit = 20 } = kwargs;
|
|
14
14
|
const searchType = type === 'user' ? 'bili_user' : 'video';
|
|
15
15
|
const payload = await apiGet(page, '/x/web-interface/wbi/search/type', { params: { search_type: searchType, keyword, page: pageNum }, signed: true });
|
|
16
16
|
const results = payload?.data?.result ?? [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bilibili shared helpers: WBI signing, authenticated fetch, nav data, UID resolution.
|
|
3
3
|
*/
|
|
4
|
-
import type { IPage } from '
|
|
4
|
+
import type { IPage } from '../../types.js';
|
|
5
5
|
export declare function stripHtml(s: string): string;
|
|
6
6
|
export declare function payloadData(payload: any): any;
|
|
7
7
|
export declare function wbiSign(page: IPage, params: Record<string, any>): Promise<Record<string, string>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'businessweek',
|
|
6
|
+
description: 'Bloomberg Businessweek top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('businessweek', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'economics',
|
|
6
|
+
description: 'Bloomberg Economics top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('economics', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { BLOOMBERG_FEEDS } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'feeds',
|
|
6
|
+
description: 'List the Bloomberg RSS feed aliases used by the adapter',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [],
|
|
11
|
+
columns: ['name', 'url'],
|
|
12
|
+
func: async () => {
|
|
13
|
+
return Object.entries(BLOOMBERG_FEEDS).map(([name, url]) => ({ name, url }));
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'industries',
|
|
6
|
+
description: 'Bloomberg Industries top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('industries', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'main',
|
|
6
|
+
description: 'Bloomberg homepage top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('main', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'markets',
|
|
6
|
+
description: 'Bloomberg Markets top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('markets', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { CliError } from '../../errors.js';
|
|
3
|
+
import { extractStoryMediaLinks, renderStoryBody, validateBloombergLink, } from './utils.js';
|
|
4
|
+
cli({
|
|
5
|
+
site: 'bloomberg',
|
|
6
|
+
name: 'news',
|
|
7
|
+
description: 'Read a Bloomberg story/article page and return title, full content, and media links',
|
|
8
|
+
domain: 'www.bloomberg.com',
|
|
9
|
+
strategy: Strategy.COOKIE,
|
|
10
|
+
browser: true,
|
|
11
|
+
args: [
|
|
12
|
+
{ name: 'link', positional: true, required: true, help: 'Bloomberg story/article URL or relative Bloomberg path' },
|
|
13
|
+
],
|
|
14
|
+
columns: ['title', 'summary', 'link', 'mediaLinks', 'content'],
|
|
15
|
+
func: async (page, kwargs) => {
|
|
16
|
+
const url = validateBloombergLink(kwargs.link);
|
|
17
|
+
// Navigate and wait for the page to hydrate before extracting story data.
|
|
18
|
+
await page.goto(url);
|
|
19
|
+
await page.wait(5);
|
|
20
|
+
const loadStory = async () => page.evaluate(`(() => {
|
|
21
|
+
const isRobot = /Are you a robot/i.test(document.title)
|
|
22
|
+
|| /unusual activity/i.test(document.body.innerText)
|
|
23
|
+
|| /click the box below to let us know you're not a robot/i.test(document.body.innerText);
|
|
24
|
+
|
|
25
|
+
if (isRobot) {
|
|
26
|
+
return {
|
|
27
|
+
errorCode: 'ROBOT_PAGE',
|
|
28
|
+
title: document.title,
|
|
29
|
+
preview: document.body.innerText.slice(0, 400),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const raw = document.querySelector('#__NEXT_DATA__')?.textContent;
|
|
34
|
+
if (!raw) {
|
|
35
|
+
return {
|
|
36
|
+
errorCode: 'NO_NEXT_DATA',
|
|
37
|
+
title: document.title,
|
|
38
|
+
preview: document.body.innerText.slice(0, 400),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let parsed;
|
|
43
|
+
try {
|
|
44
|
+
parsed = JSON.parse(raw);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
return {
|
|
47
|
+
errorCode: 'BAD_NEXT_DATA',
|
|
48
|
+
title: document.title,
|
|
49
|
+
preview: document.body.innerText.slice(0, 400),
|
|
50
|
+
message: String(err),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const story = parsed?.props?.pageProps?.story;
|
|
55
|
+
if (!story) {
|
|
56
|
+
return {
|
|
57
|
+
errorCode: 'NO_STORY',
|
|
58
|
+
title: document.title,
|
|
59
|
+
preview: document.body.innerText.slice(0, 400),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
story: {
|
|
65
|
+
headline: story.headline || story.seoHeadline || story.seoTitle || document.querySelector('h1')?.textContent?.trim() || document.title,
|
|
66
|
+
summary: story.summary || story.socialDescription || story.seoDescription || document.querySelector('meta[name="description"]')?.getAttribute('content') || '',
|
|
67
|
+
url: story.url || story.readingUrl || location.href,
|
|
68
|
+
body: story.body || null,
|
|
69
|
+
lede: story.lede || null,
|
|
70
|
+
ledeImageUrl: story.ledeImageUrl || null,
|
|
71
|
+
socialImageUrl: story.socialImageUrl || null,
|
|
72
|
+
imageAttachments: story.imageAttachments || {},
|
|
73
|
+
videoAttachments: story.videoAttachments || {},
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
})()`);
|
|
77
|
+
let result = await loadStory();
|
|
78
|
+
// Retry once — Bloomberg pages sometimes hydrate slowly.
|
|
79
|
+
if (result?.errorCode === 'NO_NEXT_DATA' || result?.errorCode === 'NO_STORY') {
|
|
80
|
+
await page.wait(4);
|
|
81
|
+
result = await loadStory();
|
|
82
|
+
}
|
|
83
|
+
if (result?.errorCode === 'ROBOT_PAGE') {
|
|
84
|
+
throw new CliError('FETCH_ERROR', 'Bloomberg served the bot-protection page instead of article content', 'Try again later or open the article in a regular Chrome session first, then rerun the command. This command uses your current Bloomberg access and does not bypass paywall or entitlement checks.');
|
|
85
|
+
}
|
|
86
|
+
if (result?.errorCode) {
|
|
87
|
+
throw new CliError('PARSE_ERROR', `Bloomberg page did not expose article story data (${result.errorCode})`, 'This command currently works on standard Bloomberg story/article pages that expose __NEXT_DATA__. Audio, video, newsletter, or other non-standard/blocked pages may not work. Access still depends on your current Bloomberg session.');
|
|
88
|
+
}
|
|
89
|
+
const story = result?.story;
|
|
90
|
+
if (!story) {
|
|
91
|
+
throw new CliError('PARSE_ERROR', 'Failed to extract Bloomberg story data', 'Bloomberg may have changed the page structure.');
|
|
92
|
+
}
|
|
93
|
+
const content = renderStoryBody(story.body);
|
|
94
|
+
if (!content) {
|
|
95
|
+
throw new CliError('PARSE_ERROR', 'Bloomberg article body was empty after parsing', 'Bloomberg may have changed the story-body format, the URL may not point to a standard article page, or the page may not be accessible in your current Bloomberg session.');
|
|
96
|
+
}
|
|
97
|
+
return [{
|
|
98
|
+
title: story.headline || '',
|
|
99
|
+
summary: story.summary || '',
|
|
100
|
+
link: story.url || url,
|
|
101
|
+
mediaLinks: extractStoryMediaLinks(story),
|
|
102
|
+
content,
|
|
103
|
+
}];
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'opinions',
|
|
6
|
+
description: 'Bloomberg Opinion top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('opinions', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'politics',
|
|
6
|
+
description: 'Bloomberg Politics top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('politics', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { fetchBloombergFeed } from './utils.js';
|
|
3
|
+
cli({
|
|
4
|
+
site: 'bloomberg',
|
|
5
|
+
name: 'tech',
|
|
6
|
+
description: 'Bloomberg Tech top stories (RSS)',
|
|
7
|
+
domain: 'feeds.bloomberg.com',
|
|
8
|
+
strategy: Strategy.PUBLIC,
|
|
9
|
+
browser: false,
|
|
10
|
+
args: [
|
|
11
|
+
{ name: 'limit', type: 'int', default: 1, help: 'Number of feed items to return (max 20)' },
|
|
12
|
+
],
|
|
13
|
+
columns: ['title', 'summary', 'link', 'mediaLinks'],
|
|
14
|
+
func: async (_page, kwargs) => {
|
|
15
|
+
return fetchBloombergFeed('tech', kwargs.limit ?? 1);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const BLOOMBERG_FEEDS: {
|
|
2
|
+
readonly main: "https://feeds.bloomberg.com/news.rss";
|
|
3
|
+
readonly markets: "https://feeds.bloomberg.com/markets/news.rss";
|
|
4
|
+
readonly economics: "https://feeds.bloomberg.com/economics/news.rss";
|
|
5
|
+
readonly industries: "https://feeds.bloomberg.com/industries/news.rss";
|
|
6
|
+
readonly tech: "https://feeds.bloomberg.com/technology/news.rss";
|
|
7
|
+
readonly politics: "https://feeds.bloomberg.com/politics/news.rss";
|
|
8
|
+
readonly businessweek: "https://feeds.bloomberg.com/businessweek/news.rss";
|
|
9
|
+
readonly opinions: "https://feeds.bloomberg.com/bview/news.rss";
|
|
10
|
+
};
|
|
11
|
+
export type BloombergFeedName = keyof typeof BLOOMBERG_FEEDS;
|
|
12
|
+
export interface BloombergFeedItem {
|
|
13
|
+
title: string;
|
|
14
|
+
summary: string;
|
|
15
|
+
link: string;
|
|
16
|
+
mediaLinks: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface BloombergStory {
|
|
19
|
+
headline?: string;
|
|
20
|
+
summary?: string;
|
|
21
|
+
url?: string;
|
|
22
|
+
body?: any;
|
|
23
|
+
lede?: any;
|
|
24
|
+
ledeImageUrl?: string;
|
|
25
|
+
socialImageUrl?: string;
|
|
26
|
+
imageAttachments?: Record<string, any>;
|
|
27
|
+
videoAttachments?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
export declare function fetchBloombergFeed(name: BloombergFeedName, limit?: number): Promise<BloombergFeedItem[]>;
|
|
30
|
+
export declare function parseBloombergRss(xml: string): BloombergFeedItem[];
|
|
31
|
+
export declare function normalizeBloombergLink(input: string): string;
|
|
32
|
+
export declare function validateBloombergLink(input: string): string;
|
|
33
|
+
export declare function renderStoryBody(body: any): string;
|
|
34
|
+
export declare function extractStoryMediaLinks(story: BloombergStory): string[];
|