@jackwener/opencli 1.6.9 → 1.7.0
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/README.md +128 -59
- package/README.zh-CN.md +134 -78
- package/dist/clis/_shared/common.d.ts +3 -0
- package/dist/clis/_shared/common.js +22 -0
- package/dist/clis/bilibili/hot.js +35 -0
- package/dist/clis/bluesky/feeds.d.ts +1 -0
- package/dist/clis/bluesky/feeds.js +27 -0
- package/dist/clis/bluesky/followers.d.ts +1 -0
- package/dist/clis/bluesky/followers.js +27 -0
- package/dist/clis/bluesky/following.d.ts +1 -0
- package/dist/clis/bluesky/following.js +27 -0
- package/dist/clis/bluesky/profile.d.ts +1 -0
- package/dist/clis/bluesky/profile.js +29 -0
- package/dist/clis/bluesky/search.d.ts +1 -0
- package/dist/clis/bluesky/search.js +28 -0
- package/dist/clis/bluesky/starter-packs.d.ts +1 -0
- package/dist/clis/bluesky/starter-packs.js +28 -0
- package/dist/clis/bluesky/thread.d.ts +1 -0
- package/dist/clis/bluesky/thread.js +30 -0
- package/dist/clis/bluesky/trending.d.ts +1 -0
- package/dist/clis/bluesky/trending.js +19 -0
- package/dist/clis/bluesky/user.d.ts +1 -0
- package/dist/clis/bluesky/user.js +33 -0
- package/dist/clis/cnki/search.d.ts +1 -0
- package/dist/clis/cnki/search.js +60 -0
- package/dist/clis/cnki/search.test.d.ts +1 -0
- package/dist/clis/cnki/search.test.js +18 -0
- package/dist/clis/devto/tag.d.ts +1 -0
- package/dist/clis/devto/tag.js +32 -0
- package/dist/clis/devto/top.d.ts +1 -0
- package/dist/clis/devto/top.js +26 -0
- package/dist/clis/devto/user.d.ts +1 -0
- package/dist/clis/devto/user.js +31 -0
- package/dist/clis/dictionary/examples.d.ts +1 -0
- package/dist/clis/dictionary/examples.js +27 -0
- package/dist/clis/dictionary/search.d.ts +1 -0
- package/dist/clis/dictionary/search.js +29 -0
- package/dist/clis/dictionary/synonyms.d.ts +1 -0
- package/dist/clis/dictionary/synonyms.js +27 -0
- package/dist/clis/douban/subject.d.ts +1 -0
- package/dist/clis/douban/subject.js +118 -0
- package/dist/clis/douban/top250.d.ts +1 -0
- package/dist/clis/douban/top250.js +67 -0
- package/dist/clis/facebook/add-friend.d.ts +1 -0
- package/dist/clis/facebook/add-friend.js +43 -0
- package/dist/clis/facebook/events.d.ts +1 -0
- package/dist/clis/facebook/events.js +40 -0
- package/dist/clis/facebook/feed.d.ts +1 -0
- package/dist/clis/facebook/feed.js +59 -0
- package/dist/clis/facebook/friends.d.ts +1 -0
- package/dist/clis/facebook/friends.js +38 -0
- package/dist/clis/facebook/groups.d.ts +1 -0
- package/dist/clis/facebook/groups.js +46 -0
- package/dist/clis/facebook/join-group.d.ts +1 -0
- package/dist/clis/facebook/join-group.js +44 -0
- package/dist/clis/facebook/memories.d.ts +1 -0
- package/dist/clis/facebook/memories.js +35 -0
- package/dist/clis/facebook/notifications.d.ts +1 -0
- package/dist/clis/facebook/notifications.js +36 -0
- package/dist/clis/facebook/profile.d.ts +1 -0
- package/dist/clis/facebook/profile.js +37 -0
- package/dist/clis/facebook/search.d.ts +1 -0
- package/dist/clis/facebook/search.js +38 -0
- package/dist/clis/facebook/search.test.d.ts +1 -1
- package/dist/clis/facebook/search.test.js +6 -9
- package/dist/clis/gitee/index.d.ts +3 -0
- package/dist/clis/gitee/index.js +3 -0
- package/dist/clis/gitee/search.d.ts +1 -0
- package/dist/clis/gitee/search.js +136 -0
- package/dist/clis/gitee/trending.d.ts +1 -0
- package/dist/clis/gitee/trending.js +567 -0
- package/dist/clis/gitee/user.d.ts +1 -0
- package/dist/clis/gitee/user.js +199 -0
- package/dist/clis/gitee/user.test.d.ts +1 -0
- package/dist/clis/gitee/user.test.js +63 -0
- package/dist/clis/hackernews/ask.d.ts +1 -0
- package/dist/clis/hackernews/ask.js +29 -0
- package/dist/clis/hackernews/best.d.ts +1 -0
- package/dist/clis/hackernews/best.js +29 -0
- package/dist/clis/hackernews/jobs.d.ts +1 -0
- package/dist/clis/hackernews/jobs.js +27 -0
- package/dist/clis/hackernews/new.d.ts +1 -0
- package/dist/clis/hackernews/new.js +29 -0
- package/dist/clis/hackernews/search.d.ts +1 -0
- package/dist/clis/hackernews/search.js +36 -0
- package/dist/clis/hackernews/show.d.ts +1 -0
- package/dist/clis/hackernews/show.js +29 -0
- package/dist/clis/hackernews/top.d.ts +1 -0
- package/dist/clis/hackernews/top.js +29 -0
- package/dist/clis/hackernews/user.d.ts +1 -0
- package/dist/clis/hackernews/user.js +22 -0
- package/dist/clis/hupu/hot.d.ts +1 -0
- package/dist/clis/hupu/hot.js +40 -0
- package/dist/clis/instagram/comment.d.ts +1 -0
- package/dist/clis/instagram/comment.js +47 -0
- package/dist/clis/instagram/explore.d.ts +1 -0
- package/dist/clis/instagram/explore.js +41 -0
- package/dist/clis/instagram/follow.d.ts +1 -0
- package/dist/clis/instagram/follow.js +43 -0
- package/dist/clis/instagram/followers.d.ts +1 -0
- package/dist/clis/instagram/followers.js +45 -0
- package/dist/clis/instagram/following.d.ts +1 -0
- package/dist/clis/instagram/following.js +45 -0
- package/dist/clis/instagram/like.d.ts +1 -0
- package/dist/clis/instagram/like.js +45 -0
- package/dist/clis/instagram/profile.d.ts +1 -0
- package/dist/clis/instagram/profile.js +39 -0
- package/dist/clis/instagram/save.d.ts +1 -0
- package/dist/clis/instagram/save.js +45 -0
- package/dist/clis/instagram/saved.d.ts +1 -0
- package/dist/clis/instagram/saved.js +38 -0
- package/dist/clis/instagram/search.d.ts +1 -0
- package/dist/clis/instagram/search.js +38 -0
- package/dist/clis/instagram/unfollow.d.ts +1 -0
- package/dist/clis/instagram/unfollow.js +40 -0
- package/dist/clis/instagram/unlike.d.ts +1 -0
- package/dist/clis/instagram/unlike.js +45 -0
- package/dist/clis/instagram/unsave.d.ts +1 -0
- package/dist/clis/instagram/unsave.js +45 -0
- package/dist/clis/instagram/user.d.ts +1 -0
- package/dist/clis/instagram/user.js +48 -0
- package/dist/clis/jd/add-cart.d.ts +1 -0
- package/dist/clis/jd/add-cart.js +71 -0
- package/dist/clis/jd/cart.d.ts +1 -0
- package/dist/clis/jd/cart.js +79 -0
- package/dist/clis/jd/commands.test.d.ts +5 -0
- package/dist/clis/jd/commands.test.js +64 -0
- package/dist/clis/jd/detail.d.ts +1 -0
- package/dist/clis/jd/detail.js +62 -0
- package/dist/clis/jd/reviews.d.ts +1 -0
- package/dist/clis/jd/reviews.js +54 -0
- package/dist/clis/jd/search.d.ts +1 -0
- package/dist/clis/jd/search.js +65 -0
- package/dist/clis/jianyu/detail.d.ts +1 -0
- package/dist/clis/jianyu/detail.js +20 -0
- package/dist/clis/jianyu/search.d.ts +41 -4
- package/dist/clis/jianyu/search.js +458 -96
- package/dist/clis/jianyu/search.test.js +105 -0
- package/dist/clis/jianyu/shared/china-bid-search.d.ts +12 -0
- package/dist/clis/jianyu/shared/china-bid-search.js +165 -0
- package/dist/clis/jianyu/shared/procurement-contract.d.ts +68 -0
- package/dist/clis/jianyu/shared/procurement-contract.js +324 -0
- package/dist/clis/jianyu/shared/procurement-contract.test.d.ts +1 -0
- package/dist/clis/jianyu/shared/procurement-contract.test.js +72 -0
- package/dist/clis/jianyu/shared/procurement-detail.d.ts +6 -0
- package/dist/clis/jianyu/shared/procurement-detail.js +92 -0
- package/dist/clis/jianyu/shared/procurement-detail.test.d.ts +1 -0
- package/dist/clis/jianyu/shared/procurement-detail.test.js +72 -0
- package/dist/clis/jike/post.d.ts +1 -0
- package/dist/clis/jike/post.js +61 -0
- package/dist/clis/jike/topic.d.ts +1 -0
- package/dist/clis/jike/topic.js +51 -0
- package/dist/clis/jike/user.d.ts +1 -0
- package/dist/clis/jike/user.js +50 -0
- package/dist/clis/jimeng/generate.d.ts +1 -0
- package/dist/clis/jimeng/generate.js +83 -0
- package/dist/clis/jimeng/history.d.ts +1 -0
- package/dist/clis/jimeng/history.js +47 -0
- package/dist/clis/jimeng/new.d.ts +1 -0
- package/dist/clis/jimeng/new.js +43 -0
- package/dist/clis/jimeng/workspaces.d.ts +1 -0
- package/dist/clis/jimeng/workspaces.js +41 -0
- package/dist/clis/linux-do/categories.d.ts +1 -0
- package/dist/clis/linux-do/categories.js +65 -0
- package/dist/clis/linux-do/search.d.ts +1 -0
- package/dist/clis/linux-do/search.js +41 -0
- package/dist/clis/linux-do/tags.d.ts +1 -0
- package/dist/clis/linux-do/tags.js +39 -0
- package/dist/clis/linux-do/topic-content.test.js +5 -5
- package/dist/clis/linux-do/topic.d.ts +1 -0
- package/dist/clis/linux-do/topic.js +56 -0
- package/dist/clis/linux-do/user-posts.d.ts +1 -0
- package/dist/clis/linux-do/user-posts.js +61 -0
- package/dist/clis/linux-do/user-topics.d.ts +1 -0
- package/dist/clis/linux-do/user-topics.js +48 -0
- package/dist/clis/lobsters/active.d.ts +1 -0
- package/dist/clis/lobsters/active.js +26 -0
- package/dist/clis/lobsters/hot.d.ts +1 -0
- package/dist/clis/lobsters/hot.js +26 -0
- package/dist/clis/lobsters/newest.d.ts +1 -0
- package/dist/clis/lobsters/newest.js +26 -0
- package/dist/clis/lobsters/tag.d.ts +1 -0
- package/dist/clis/lobsters/tag.js +32 -0
- package/dist/clis/pixiv/detail.d.ts +1 -0
- package/dist/clis/pixiv/detail.js +58 -0
- package/dist/clis/pixiv/ranking.d.ts +1 -0
- package/dist/clis/pixiv/ranking.js +59 -0
- package/dist/clis/pixiv/user.d.ts +1 -0
- package/dist/clis/pixiv/user.js +52 -0
- package/dist/clis/reddit/frontpage.d.ts +1 -0
- package/dist/clis/reddit/frontpage.js +31 -0
- package/dist/clis/reddit/hot.d.ts +1 -0
- package/dist/clis/reddit/hot.js +45 -0
- package/dist/clis/reddit/popular.d.ts +1 -0
- package/dist/clis/reddit/popular.js +41 -0
- package/dist/clis/reddit/search.d.ts +1 -0
- package/dist/clis/reddit/search.js +65 -0
- package/dist/clis/reddit/subreddit.d.ts +1 -0
- package/dist/clis/reddit/subreddit.js +52 -0
- package/dist/clis/reddit/user-comments.d.ts +1 -0
- package/dist/clis/reddit/user-comments.js +44 -0
- package/dist/clis/reddit/user-posts.d.ts +1 -0
- package/dist/clis/reddit/user-posts.js +42 -0
- package/dist/clis/reddit/user.d.ts +1 -0
- package/dist/clis/reddit/user.js +37 -0
- package/dist/clis/stackoverflow/bounties.d.ts +1 -0
- package/dist/clis/stackoverflow/bounties.js +27 -0
- package/dist/clis/stackoverflow/hot.d.ts +1 -0
- package/dist/clis/stackoverflow/hot.js +24 -0
- package/dist/clis/stackoverflow/search.d.ts +1 -0
- package/dist/clis/stackoverflow/search.js +27 -0
- package/dist/clis/stackoverflow/unanswered.d.ts +1 -0
- package/dist/clis/stackoverflow/unanswered.js +26 -0
- package/dist/clis/steam/top-sellers.d.ts +1 -0
- package/dist/clis/steam/top-sellers.js +25 -0
- package/dist/clis/taobao/add-cart.d.ts +1 -0
- package/dist/clis/taobao/add-cart.js +149 -0
- package/dist/clis/taobao/cart.d.ts +1 -0
- package/dist/clis/taobao/cart.js +95 -0
- package/dist/clis/taobao/commands.test.d.ts +5 -0
- package/dist/clis/taobao/commands.test.js +64 -0
- package/dist/clis/taobao/detail.d.ts +1 -0
- package/dist/clis/taobao/detail.js +70 -0
- package/dist/clis/taobao/reviews.d.ts +1 -0
- package/dist/clis/taobao/reviews.js +76 -0
- package/dist/clis/taobao/search.d.ts +1 -0
- package/dist/clis/taobao/search.js +96 -0
- package/dist/clis/tiktok/comment.d.ts +1 -0
- package/dist/clis/tiktok/comment.js +57 -0
- package/dist/clis/tiktok/explore.d.ts +1 -0
- package/dist/clis/tiktok/explore.js +35 -0
- package/dist/clis/tiktok/follow.d.ts +1 -0
- package/dist/clis/tiktok/follow.js +39 -0
- package/dist/clis/tiktok/following.d.ts +1 -0
- package/dist/clis/tiktok/following.js +42 -0
- package/dist/clis/tiktok/friends.d.ts +1 -0
- package/dist/clis/tiktok/friends.js +43 -0
- package/dist/clis/tiktok/like.d.ts +1 -0
- package/dist/clis/tiktok/like.js +33 -0
- package/dist/clis/tiktok/live.d.ts +1 -0
- package/dist/clis/tiktok/live.js +47 -0
- package/dist/clis/tiktok/notifications.d.ts +1 -0
- package/dist/clis/tiktok/notifications.js +49 -0
- package/dist/clis/tiktok/profile.d.ts +1 -0
- package/dist/clis/tiktok/profile.js +54 -0
- package/dist/clis/tiktok/save.d.ts +1 -0
- package/dist/clis/tiktok/save.js +29 -0
- package/dist/clis/tiktok/search.d.ts +1 -0
- package/dist/clis/tiktok/search.js +39 -0
- package/dist/clis/tiktok/unfollow.d.ts +1 -0
- package/dist/clis/tiktok/unfollow.js +44 -0
- package/dist/clis/tiktok/unlike.d.ts +1 -0
- package/dist/clis/tiktok/unlike.js +33 -0
- package/dist/clis/tiktok/unsave.d.ts +1 -0
- package/dist/clis/tiktok/unsave.js +31 -0
- package/dist/clis/tiktok/user.d.ts +1 -0
- package/dist/clis/tiktok/user.js +41 -0
- package/dist/clis/v2ex/hot.d.ts +1 -0
- package/dist/clis/v2ex/hot.js +25 -0
- package/dist/clis/v2ex/latest.d.ts +1 -0
- package/dist/clis/v2ex/latest.js +25 -0
- package/dist/clis/v2ex/member.d.ts +1 -0
- package/dist/clis/v2ex/member.js +27 -0
- package/dist/clis/v2ex/node.d.ts +1 -0
- package/dist/clis/v2ex/node.js +38 -0
- package/dist/clis/v2ex/nodes.d.ts +1 -0
- package/dist/clis/v2ex/nodes.js +25 -0
- package/dist/clis/v2ex/replies.d.ts +1 -0
- package/dist/clis/v2ex/replies.js +26 -0
- package/dist/clis/v2ex/topic.d.ts +1 -0
- package/dist/clis/v2ex/topic.js +30 -0
- package/dist/clis/v2ex/user.d.ts +1 -0
- package/dist/clis/v2ex/user.js +33 -0
- package/dist/clis/xiaoe/catalog.d.ts +1 -0
- package/dist/clis/xiaoe/catalog.js +161 -0
- package/dist/clis/xiaoe/content.d.ts +1 -0
- package/dist/clis/xiaoe/content.js +39 -0
- package/dist/clis/xiaoe/courses.d.ts +1 -0
- package/dist/clis/xiaoe/courses.js +69 -0
- package/dist/clis/xiaoe/detail.d.ts +1 -0
- package/dist/clis/xiaoe/detail.js +35 -0
- package/dist/clis/xiaoe/play-url.d.ts +1 -0
- package/dist/clis/xiaoe/play-url.js +120 -0
- package/dist/clis/xiaohongshu/feed.d.ts +1 -0
- package/dist/clis/xiaohongshu/feed.js +32 -0
- package/dist/clis/xiaohongshu/notifications.d.ts +1 -0
- package/dist/clis/xiaohongshu/notifications.js +38 -0
- package/dist/clis/xueqiu/earnings-date.d.ts +1 -0
- package/dist/clis/xueqiu/earnings-date.js +61 -0
- package/dist/clis/xueqiu/feed.d.ts +1 -0
- package/dist/clis/xueqiu/feed.js +48 -0
- package/dist/clis/xueqiu/groups.d.ts +1 -0
- package/dist/clis/xueqiu/groups.js +25 -0
- package/dist/clis/xueqiu/hot-stock.d.ts +1 -0
- package/dist/clis/xueqiu/hot-stock.js +44 -0
- package/dist/clis/xueqiu/hot.d.ts +1 -0
- package/dist/clis/xueqiu/hot.js +44 -0
- package/dist/clis/xueqiu/kline.d.ts +1 -0
- package/dist/clis/xueqiu/kline.js +64 -0
- package/dist/clis/xueqiu/search.d.ts +1 -0
- package/dist/clis/xueqiu/search.js +49 -0
- package/dist/clis/xueqiu/stock.d.ts +1 -0
- package/dist/clis/xueqiu/stock.js +72 -0
- package/dist/clis/xueqiu/watchlist.d.ts +1 -0
- package/dist/clis/xueqiu/watchlist.js +45 -0
- package/dist/clis/zhihu/hot.d.ts +1 -0
- package/dist/clis/zhihu/hot.js +43 -0
- package/dist/clis/zhihu/search.d.ts +1 -0
- package/dist/clis/zhihu/search.js +52 -0
- package/dist/src/browser/bridge.js +1 -1
- package/dist/src/browser/daemon-client.d.ts +16 -4
- package/dist/src/browser/daemon-client.js +33 -15
- package/dist/src/browser/daemon-client.test.js +0 -3
- package/dist/src/browser/dom-helpers.test.js +3 -2
- package/dist/src/browser/errors.d.ts +26 -1
- package/dist/src/browser/errors.js +40 -7
- package/dist/src/browser/errors.test.d.ts +1 -0
- package/dist/src/browser/errors.test.js +51 -0
- package/dist/src/browser/page.d.ts +9 -8
- package/dist/src/browser/page.js +33 -31
- package/dist/src/browser.test.js +25 -6
- package/dist/src/build-manifest.d.ts +5 -11
- package/dist/src/build-manifest.js +6 -75
- package/dist/src/build-manifest.test.js +1 -39
- package/dist/src/cascade.js +3 -2
- package/dist/src/cli.d.ts +3 -3
- package/dist/src/cli.js +71 -71
- package/dist/src/cli.test.js +20 -15
- package/dist/src/clis/binance/asks.d.ts +1 -0
- package/dist/src/clis/binance/asks.js +20 -0
- package/dist/src/clis/binance/commands.test.d.ts +3 -1
- package/dist/src/clis/binance/commands.test.js +10 -6
- package/dist/src/clis/binance/depth.d.ts +1 -0
- package/dist/src/clis/binance/depth.js +20 -0
- package/dist/src/clis/binance/gainers.d.ts +1 -0
- package/dist/src/clis/binance/gainers.js +21 -0
- package/dist/src/clis/binance/klines.d.ts +1 -0
- package/dist/src/clis/binance/klines.js +20 -0
- package/dist/src/clis/binance/losers.d.ts +1 -0
- package/dist/src/clis/binance/losers.js +21 -0
- package/dist/src/clis/binance/pairs.d.ts +1 -0
- package/dist/src/clis/binance/pairs.js +20 -0
- package/dist/src/clis/binance/price.d.ts +1 -0
- package/dist/src/clis/binance/price.js +17 -0
- package/dist/src/clis/binance/prices.d.ts +1 -0
- package/dist/src/clis/binance/prices.js +18 -0
- package/dist/src/clis/binance/ticker.d.ts +1 -0
- package/dist/src/clis/binance/ticker.js +20 -0
- package/dist/src/clis/binance/top.d.ts +1 -0
- package/dist/src/clis/binance/top.js +20 -0
- package/dist/src/clis/binance/trades.d.ts +1 -0
- package/dist/src/clis/binance/trades.js +19 -0
- package/dist/src/commands/daemon.d.ts +2 -6
- package/dist/src/commands/daemon.js +2 -58
- package/dist/src/commands/daemon.test.js +24 -120
- package/dist/src/completion-fast.d.ts +25 -0
- package/dist/src/completion-fast.js +140 -0
- package/dist/src/completion.d.ts +1 -0
- package/dist/src/completion.js +1 -0
- package/dist/src/constants.d.ts +0 -2
- package/dist/src/constants.js +0 -2
- package/dist/src/daemon.d.ts +1 -1
- package/dist/src/daemon.js +2 -15
- package/dist/src/diagnostic.test.js +2 -2
- package/dist/src/discovery.d.ts +3 -3
- package/dist/src/discovery.js +34 -97
- package/dist/src/download/index.d.ts +1 -1
- package/dist/src/engine.test.js +4 -19
- package/dist/src/execution.js +5 -1
- package/dist/src/generate-verified.d.ts +105 -0
- package/dist/src/generate-verified.js +696 -0
- package/dist/src/generate-verified.test.d.ts +1 -0
- package/dist/src/generate-verified.test.js +925 -0
- package/dist/src/generate.d.ts +9 -1
- package/dist/src/generate.js +2 -2
- package/dist/src/main.js +65 -12
- package/dist/src/pipeline/steps/download.d.ts +1 -17
- package/dist/src/pipeline/steps/download.js +20 -31
- package/dist/src/pipeline/steps/intercept.d.ts +1 -1
- package/dist/src/pipeline/steps/intercept.js +1 -1
- package/dist/src/pipeline/steps/tap.d.ts +1 -1
- package/dist/src/pipeline/steps/tap.js +1 -1
- package/dist/src/plugin-scaffold.d.ts +2 -2
- package/dist/src/plugin-scaffold.js +24 -21
- package/dist/src/plugin-scaffold.test.js +1 -1
- package/dist/src/plugin.d.ts +1 -1
- package/dist/src/plugin.js +4 -6
- package/dist/src/plugin.test.js +31 -31
- package/dist/src/record.js +26 -25
- package/dist/src/runtime-detect.js +3 -7
- package/dist/src/scripts/framework.d.ts +3 -0
- package/dist/src/scripts/framework.js +8 -4
- package/dist/src/scripts/store.d.ts +5 -1
- package/dist/src/scripts/store.js +5 -1
- package/dist/src/skill-generate.d.ts +30 -0
- package/dist/src/skill-generate.js +75 -0
- package/dist/src/skill-generate.test.d.ts +1 -0
- package/dist/src/skill-generate.test.js +173 -0
- package/dist/src/synthesize.d.ts +1 -1
- package/dist/src/synthesize.js +7 -8
- package/dist/src/types.d.ts +3 -1
- package/package.json +4 -3
- package/dist/clis/bilibili/hot.yaml +0 -38
- package/dist/clis/bluesky/feeds.yaml +0 -29
- package/dist/clis/bluesky/followers.yaml +0 -33
- package/dist/clis/bluesky/following.yaml +0 -33
- package/dist/clis/bluesky/profile.yaml +0 -27
- package/dist/clis/bluesky/search.yaml +0 -34
- package/dist/clis/bluesky/starter-packs.yaml +0 -34
- package/dist/clis/bluesky/thread.yaml +0 -32
- package/dist/clis/bluesky/trending.yaml +0 -27
- package/dist/clis/bluesky/user.yaml +0 -34
- package/dist/clis/devto/tag.yaml +0 -34
- package/dist/clis/devto/top.yaml +0 -29
- package/dist/clis/devto/user.yaml +0 -33
- package/dist/clis/dictionary/examples.yaml +0 -25
- package/dist/clis/dictionary/search.yaml +0 -27
- package/dist/clis/dictionary/synonyms.yaml +0 -25
- package/dist/clis/douban/subject.yaml +0 -107
- package/dist/clis/douban/top250.yaml +0 -70
- package/dist/clis/facebook/add-friend.yaml +0 -43
- package/dist/clis/facebook/events.yaml +0 -44
- package/dist/clis/facebook/feed.yaml +0 -63
- package/dist/clis/facebook/friends.yaml +0 -42
- package/dist/clis/facebook/groups.yaml +0 -50
- package/dist/clis/facebook/join-group.yaml +0 -44
- package/dist/clis/facebook/memories.yaml +0 -39
- package/dist/clis/facebook/notifications.yaml +0 -40
- package/dist/clis/facebook/profile.yaml +0 -37
- package/dist/clis/facebook/search.yaml +0 -47
- package/dist/clis/hackernews/ask.yaml +0 -38
- package/dist/clis/hackernews/best.yaml +0 -38
- package/dist/clis/hackernews/jobs.yaml +0 -36
- package/dist/clis/hackernews/new.yaml +0 -38
- package/dist/clis/hackernews/search.yaml +0 -44
- package/dist/clis/hackernews/show.yaml +0 -38
- package/dist/clis/hackernews/top.yaml +0 -38
- package/dist/clis/hackernews/user.yaml +0 -25
- package/dist/clis/hupu/hot.yaml +0 -43
- package/dist/clis/instagram/comment.yaml +0 -52
- package/dist/clis/instagram/explore.yaml +0 -43
- package/dist/clis/instagram/follow.yaml +0 -41
- package/dist/clis/instagram/followers.yaml +0 -51
- package/dist/clis/instagram/following.yaml +0 -51
- package/dist/clis/instagram/like.yaml +0 -46
- package/dist/clis/instagram/profile.yaml +0 -42
- package/dist/clis/instagram/save.yaml +0 -46
- package/dist/clis/instagram/saved.yaml +0 -40
- package/dist/clis/instagram/search.yaml +0 -44
- package/dist/clis/instagram/unfollow.yaml +0 -38
- package/dist/clis/instagram/unlike.yaml +0 -46
- package/dist/clis/instagram/unsave.yaml +0 -46
- package/dist/clis/instagram/user.yaml +0 -54
- package/dist/clis/jike/post.yaml +0 -59
- package/dist/clis/jike/topic.yaml +0 -53
- package/dist/clis/jike/user.yaml +0 -52
- package/dist/clis/jimeng/generate.yaml +0 -85
- package/dist/clis/jimeng/history.yaml +0 -46
- package/dist/clis/linux-do/categories.yaml +0 -70
- package/dist/clis/linux-do/search.yaml +0 -48
- package/dist/clis/linux-do/tags.yaml +0 -41
- package/dist/clis/linux-do/topic.yaml +0 -62
- package/dist/clis/linux-do/user-posts.yaml +0 -67
- package/dist/clis/linux-do/user-topics.yaml +0 -54
- package/dist/clis/lobsters/active.yaml +0 -29
- package/dist/clis/lobsters/hot.yaml +0 -29
- package/dist/clis/lobsters/newest.yaml +0 -29
- package/dist/clis/lobsters/tag.yaml +0 -34
- package/dist/clis/pixiv/detail.yaml +0 -49
- package/dist/clis/pixiv/ranking.yaml +0 -53
- package/dist/clis/pixiv/user.yaml +0 -46
- package/dist/clis/reddit/frontpage.yaml +0 -30
- package/dist/clis/reddit/hot.yaml +0 -47
- package/dist/clis/reddit/popular.yaml +0 -40
- package/dist/clis/reddit/search.yaml +0 -61
- package/dist/clis/reddit/subreddit.yaml +0 -50
- package/dist/clis/reddit/user-comments.yaml +0 -46
- package/dist/clis/reddit/user-posts.yaml +0 -44
- package/dist/clis/reddit/user.yaml +0 -40
- package/dist/clis/stackoverflow/bounties.yaml +0 -29
- package/dist/clis/stackoverflow/hot.yaml +0 -28
- package/dist/clis/stackoverflow/search.yaml +0 -33
- package/dist/clis/stackoverflow/unanswered.yaml +0 -28
- package/dist/clis/steam/top-sellers.yaml +0 -29
- package/dist/clis/tiktok/comment.yaml +0 -66
- package/dist/clis/tiktok/explore.yaml +0 -39
- package/dist/clis/tiktok/follow.yaml +0 -39
- package/dist/clis/tiktok/following.yaml +0 -46
- package/dist/clis/tiktok/friends.yaml +0 -47
- package/dist/clis/tiktok/like.yaml +0 -38
- package/dist/clis/tiktok/live.yaml +0 -51
- package/dist/clis/tiktok/notifications.yaml +0 -52
- package/dist/clis/tiktok/profile.yaml +0 -45
- package/dist/clis/tiktok/save.yaml +0 -34
- package/dist/clis/tiktok/search.yaml +0 -47
- package/dist/clis/tiktok/unfollow.yaml +0 -44
- package/dist/clis/tiktok/unlike.yaml +0 -38
- package/dist/clis/tiktok/unsave.yaml +0 -36
- package/dist/clis/tiktok/user.yaml +0 -44
- package/dist/clis/v2ex/hot.yaml +0 -28
- package/dist/clis/v2ex/latest.yaml +0 -28
- package/dist/clis/v2ex/member.yaml +0 -29
- package/dist/clis/v2ex/node.yaml +0 -34
- package/dist/clis/v2ex/nodes.yaml +0 -31
- package/dist/clis/v2ex/replies.yaml +0 -32
- package/dist/clis/v2ex/topic.yaml +0 -33
- package/dist/clis/v2ex/user.yaml +0 -34
- package/dist/clis/xiaoe/catalog.yaml +0 -129
- package/dist/clis/xiaoe/content.yaml +0 -43
- package/dist/clis/xiaoe/courses.yaml +0 -73
- package/dist/clis/xiaoe/detail.yaml +0 -39
- package/dist/clis/xiaoe/play-url.yaml +0 -124
- package/dist/clis/xiaohongshu/feed.yaml +0 -31
- package/dist/clis/xiaohongshu/notifications.yaml +0 -37
- package/dist/clis/xueqiu/earnings-date.yaml +0 -69
- package/dist/clis/xueqiu/feed.yaml +0 -53
- package/dist/clis/xueqiu/groups.yaml +0 -23
- package/dist/clis/xueqiu/hot-stock.yaml +0 -49
- package/dist/clis/xueqiu/hot.yaml +0 -46
- package/dist/clis/xueqiu/kline.yaml +0 -65
- package/dist/clis/xueqiu/search.yaml +0 -55
- package/dist/clis/xueqiu/stock.yaml +0 -69
- package/dist/clis/xueqiu/watchlist.yaml +0 -46
- package/dist/clis/zhihu/hot.yaml +0 -46
- package/dist/clis/zhihu/search.yaml +0 -59
- package/dist/src/daemon.test.js +0 -65
- package/dist/src/idle-manager.d.ts +0 -19
- package/dist/src/idle-manager.js +0 -54
- package/dist/src/yaml-schema.d.ts +0 -29
- package/dist/src/yaml-schema.js +0 -22
- /package/dist/{src/daemon.test.d.ts → clis/bilibili/hot.d.ts} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { CliError } from '@jackwener/opencli/errors';
|
|
2
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
3
|
+
const GITEE_BASE_URL = 'https://gitee.com';
|
|
4
|
+
const GITEE_USER_API = 'https://gitee.com/api/v5/users';
|
|
5
|
+
function normalizeText(value) {
|
|
6
|
+
return value.replace(/\s+/g, ' ').trim();
|
|
7
|
+
}
|
|
8
|
+
function sanitizeUsername(value) {
|
|
9
|
+
return value.trim().replace(/^@+/, '').replace(/^\/+|\/+$/g, '');
|
|
10
|
+
}
|
|
11
|
+
function asRecord(value) {
|
|
12
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
13
|
+
return null;
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function firstText(value) {
|
|
17
|
+
if (typeof value === 'string')
|
|
18
|
+
return normalizeText(value);
|
|
19
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
20
|
+
return String(value);
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
for (const item of value) {
|
|
23
|
+
const text = firstText(item);
|
|
24
|
+
if (text)
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
function normalizeCount(value) {
|
|
31
|
+
const raw = firstText(value);
|
|
32
|
+
if (!raw)
|
|
33
|
+
return '';
|
|
34
|
+
const compact = raw.replace(/,/g, '');
|
|
35
|
+
const match = compact.match(/\d+(?:[.]\d+)?(?:[kKmMwW]|\u4E07)?/);
|
|
36
|
+
if (match)
|
|
37
|
+
return match[0];
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
function pickFirst(...values) {
|
|
41
|
+
for (const value of values) {
|
|
42
|
+
if (typeof value === 'string' && value.trim())
|
|
43
|
+
return value.trim();
|
|
44
|
+
}
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
function apiGiteeIndex(user) {
|
|
48
|
+
if (!user)
|
|
49
|
+
return '';
|
|
50
|
+
const keys = [
|
|
51
|
+
'gitee_index',
|
|
52
|
+
'giteeIndex',
|
|
53
|
+
'index',
|
|
54
|
+
'score',
|
|
55
|
+
'contribution_score',
|
|
56
|
+
'contributionScore',
|
|
57
|
+
'contribution_index',
|
|
58
|
+
'contributionIndex',
|
|
59
|
+
];
|
|
60
|
+
for (const key of keys) {
|
|
61
|
+
const value = normalizeCount(user[key]);
|
|
62
|
+
if (value)
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
cli({
|
|
68
|
+
site: 'gitee',
|
|
69
|
+
name: 'user',
|
|
70
|
+
description: 'Show a Gitee user profile panel',
|
|
71
|
+
domain: 'gitee.com',
|
|
72
|
+
strategy: Strategy.PUBLIC,
|
|
73
|
+
browser: true,
|
|
74
|
+
args: [
|
|
75
|
+
{ name: 'username', positional: true, required: true, help: 'Gitee username' },
|
|
76
|
+
],
|
|
77
|
+
columns: ['field', 'value'],
|
|
78
|
+
func: async (page, args) => {
|
|
79
|
+
const username = sanitizeUsername(String(args.username ?? ''));
|
|
80
|
+
if (!username) {
|
|
81
|
+
throw new CliError('INVALID_ARGUMENT', 'Username is required', 'Use: opencli gitee user <username>');
|
|
82
|
+
}
|
|
83
|
+
const profileUrl = `${GITEE_BASE_URL}/${encodeURIComponent(username)}`;
|
|
84
|
+
await page.goto(profileUrl);
|
|
85
|
+
await page.wait(2);
|
|
86
|
+
const rawDomSnapshot = await page.evaluate(`
|
|
87
|
+
(() => {
|
|
88
|
+
const normalize = (value) => (value || '').replace(/\\s+/g, ' ').trim();
|
|
89
|
+
const extractCount = (value) => {
|
|
90
|
+
const text = normalize(value).replace(/,/g, '');
|
|
91
|
+
if (!text) return '';
|
|
92
|
+
const match = text.match(/\\d+(?:[.]\\d+)?(?:\\s*[kKmMwW\\u4E07])?/);
|
|
93
|
+
return match ? match[0].replace(/\\s+/g, '') : '';
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const title = normalize(document.title || '');
|
|
97
|
+
const bodyText = normalize(document.body?.innerText || '');
|
|
98
|
+
const notFound = /404|页面不存在|资源不存在|page not found/i.test(title + ' ' + bodyText);
|
|
99
|
+
const blocked = /访问受限|没有访问权限|forbidden|denied/i.test(bodyText);
|
|
100
|
+
|
|
101
|
+
const nicknameCandidates = Array.from(
|
|
102
|
+
document.querySelectorAll('.users__personal-name h2 span[title], .users__personal-name h2 [title], .users__personal-name h2 span, .users__personal-name h2, h1'),
|
|
103
|
+
);
|
|
104
|
+
const nicknameNode = nicknameCandidates.find((node) => {
|
|
105
|
+
const titleAttr = node && node.getAttribute ? node.getAttribute('title') : '';
|
|
106
|
+
const text = normalize((titleAttr || node.textContent || '').replace(/\\(\\s*备注名\\s*\\)/g, ''));
|
|
107
|
+
return !!text && !/备注名/.test(text);
|
|
108
|
+
}) || null;
|
|
109
|
+
const nicknameFromAttr = nicknameNode && nicknameNode.getAttribute ? nicknameNode.getAttribute('title') : '';
|
|
110
|
+
const nickname = normalize((nicknameFromAttr || nicknameNode?.textContent || '').replace(/\\(\\s*备注名\\s*\\)/g, ''));
|
|
111
|
+
|
|
112
|
+
let followers = extractCount(document.querySelector('#followers-number .social-count, #followers-number .follow-num')?.textContent || '');
|
|
113
|
+
if (!followers) {
|
|
114
|
+
const card = Array.from(document.querySelectorAll('.users__personal-socials .four.wide.column, .users__personal-socials [class*="column"]'))
|
|
115
|
+
.find((el) => /followers/i.test(normalize(el.textContent || '')));
|
|
116
|
+
if (card) followers = extractCount(card.textContent || '');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let publicRepos = '';
|
|
120
|
+
const projectLink = Array.from(document.querySelectorAll('a[href]'))
|
|
121
|
+
.find((el) => /\\/[^/?#]+\\/projects(?:$|[/?#])/i.test(el.getAttribute('href') || ''));
|
|
122
|
+
if (projectLink) publicRepos = extractCount(projectLink.textContent || '');
|
|
123
|
+
|
|
124
|
+
let giteeIndex = '';
|
|
125
|
+
const indexNodes = Array.from(
|
|
126
|
+
document.querySelectorAll('.users__personal-info *, .users__personal-container *, [class*="index" i], [id*="index" i], [class*="score" i], [id*="score" i]'),
|
|
127
|
+
);
|
|
128
|
+
for (const node of indexNodes) {
|
|
129
|
+
const text = normalize(node.textContent || '');
|
|
130
|
+
if (!/(码云指数|gitee\\s*index|gitee\\s*指数)/i.test(text)) continue;
|
|
131
|
+
|
|
132
|
+
const direct = text.match(/(?:码云指数|gitee\\s*index|gitee\\s*指数)[::]?\\s*(\\d+(?:[.]\\d+)?(?:\\s*[kKmMwW\\u4E07])?)/i);
|
|
133
|
+
if (direct?.[1]) {
|
|
134
|
+
giteeIndex = direct[1].replace(/\\s+/g, '');
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const siblingText = normalize(node.nextElementSibling?.textContent || '');
|
|
139
|
+
const parentText = normalize(node.parentElement?.textContent || '');
|
|
140
|
+
const around = extractCount(siblingText + ' ' + parentText);
|
|
141
|
+
if (around) {
|
|
142
|
+
giteeIndex = around;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
notFound,
|
|
149
|
+
blocked,
|
|
150
|
+
nickname,
|
|
151
|
+
followers,
|
|
152
|
+
publicRepos,
|
|
153
|
+
giteeIndex,
|
|
154
|
+
};
|
|
155
|
+
})()
|
|
156
|
+
`);
|
|
157
|
+
const domSnapshotRecord = asRecord(rawDomSnapshot);
|
|
158
|
+
const domSnapshot = {
|
|
159
|
+
notFound: domSnapshotRecord?.notFound === true,
|
|
160
|
+
blocked: domSnapshotRecord?.blocked === true,
|
|
161
|
+
nickname: firstText(domSnapshotRecord?.nickname),
|
|
162
|
+
followers: normalizeCount(domSnapshotRecord?.followers),
|
|
163
|
+
publicRepos: normalizeCount(domSnapshotRecord?.publicRepos),
|
|
164
|
+
giteeIndex: normalizeCount(domSnapshotRecord?.giteeIndex),
|
|
165
|
+
};
|
|
166
|
+
if (domSnapshot.notFound) {
|
|
167
|
+
throw new CliError('NOT_FOUND', `Gitee user "${username}" does not exist`, 'Check the username and retry: opencli gitee user <username>');
|
|
168
|
+
}
|
|
169
|
+
if (domSnapshot.blocked) {
|
|
170
|
+
throw new CliError('FORBIDDEN', `Gitee user page "${username}" is not accessible`, 'The profile may be private/restricted, or the account may be unavailable');
|
|
171
|
+
}
|
|
172
|
+
const apiUrl = `${GITEE_USER_API}/${encodeURIComponent(username)}`;
|
|
173
|
+
const apiResponse = await fetch(apiUrl, {
|
|
174
|
+
headers: {
|
|
175
|
+
Accept: 'application/json',
|
|
176
|
+
'User-Agent': 'Mozilla/5.0',
|
|
177
|
+
Referer: profileUrl,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
if (apiResponse.status === 404) {
|
|
181
|
+
throw new CliError('NOT_FOUND', `Gitee user "${username}" does not exist`, 'Check the username and retry: opencli gitee user <username>');
|
|
182
|
+
}
|
|
183
|
+
if (!apiResponse.ok) {
|
|
184
|
+
throw new CliError('REQUEST_FAILED', `Failed to read Gitee user profile API: ${apiResponse.status}`, 'Try again later or verify network access to gitee.com');
|
|
185
|
+
}
|
|
186
|
+
const apiUser = asRecord(await apiResponse.json());
|
|
187
|
+
const nickname = pickFirst(domSnapshot.nickname, firstText(apiUser?.name), firstText(apiUser?.login), username);
|
|
188
|
+
const followers = pickFirst(domSnapshot.followers, normalizeCount(apiUser?.followers), '-');
|
|
189
|
+
const publicRepos = pickFirst(domSnapshot.publicRepos, normalizeCount(apiUser?.public_repos), '-');
|
|
190
|
+
const giteeIndex = pickFirst(domSnapshot.giteeIndex, apiGiteeIndex(apiUser), '-');
|
|
191
|
+
return [
|
|
192
|
+
{ field: 'Nickname', value: nickname },
|
|
193
|
+
{ field: 'Followers', value: followers },
|
|
194
|
+
{ field: 'Public Repositories', value: publicRepos },
|
|
195
|
+
{ field: 'Gitee Index', value: giteeIndex },
|
|
196
|
+
{ field: 'URL', value: profileUrl },
|
|
197
|
+
];
|
|
198
|
+
},
|
|
199
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './user.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { getRegistry } from '@jackwener/opencli/registry';
|
|
3
|
+
import './user.js';
|
|
4
|
+
const command = getRegistry().get('gitee/user');
|
|
5
|
+
function createPage(snapshot) {
|
|
6
|
+
return {
|
|
7
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
8
|
+
wait: vi.fn().mockResolvedValue(undefined),
|
|
9
|
+
evaluate: vi.fn().mockResolvedValue(snapshot),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
describe('gitee user', () => {
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
vi.stubGlobal('fetch', vi.fn());
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
vi.unstubAllGlobals();
|
|
18
|
+
vi.restoreAllMocks();
|
|
19
|
+
});
|
|
20
|
+
it('registers the gitee user command', () => {
|
|
21
|
+
expect(command).toMatchObject({
|
|
22
|
+
site: 'gitee',
|
|
23
|
+
name: 'user',
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
it('does not mislabel contribution totals as Gitee Index when the real index is unavailable', async () => {
|
|
27
|
+
const page = createPage({
|
|
28
|
+
notFound: false,
|
|
29
|
+
blocked: false,
|
|
30
|
+
nickname: 'Alice',
|
|
31
|
+
followers: '12',
|
|
32
|
+
publicRepos: '7',
|
|
33
|
+
giteeIndex: '',
|
|
34
|
+
contributionTotal: 321,
|
|
35
|
+
});
|
|
36
|
+
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response(JSON.stringify({
|
|
37
|
+
login: 'alice',
|
|
38
|
+
name: 'Alice',
|
|
39
|
+
followers: 12,
|
|
40
|
+
public_repos: 7,
|
|
41
|
+
}), { status: 200 })));
|
|
42
|
+
const rows = await command.func(page, { username: 'alice' });
|
|
43
|
+
expect(rows).toContainEqual({ field: 'Gitee Index', value: '-' });
|
|
44
|
+
});
|
|
45
|
+
it('uses an API-provided Gitee Index when available', async () => {
|
|
46
|
+
const page = createPage({
|
|
47
|
+
notFound: false,
|
|
48
|
+
blocked: false,
|
|
49
|
+
nickname: '',
|
|
50
|
+
followers: '',
|
|
51
|
+
publicRepos: '',
|
|
52
|
+
giteeIndex: '',
|
|
53
|
+
});
|
|
54
|
+
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response(JSON.stringify({
|
|
55
|
+
login: 'alice',
|
|
56
|
+
followers: 9,
|
|
57
|
+
public_repos: 3,
|
|
58
|
+
gitee_index: 88,
|
|
59
|
+
}), { status: 200 })));
|
|
60
|
+
const rows = await command.func(page, { username: 'alice' });
|
|
61
|
+
expect(rows).toContainEqual({ field: 'Gitee Index', value: '88' });
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'ask',
|
|
5
|
+
description: 'Hacker News Ask HN posts',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of stories' },
|
|
11
|
+
],
|
|
12
|
+
columns: ['rank', 'title', 'score', 'author', 'comments'],
|
|
13
|
+
pipeline: [
|
|
14
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/askstories.json' } },
|
|
15
|
+
{ limit: '${{ Math.min((args.limit ? args.limit : 20) + 10, 50) }}' },
|
|
16
|
+
{ map: { id: '${{ item }}' } },
|
|
17
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/item/${{ item.id }}.json' } },
|
|
18
|
+
{ filter: 'item.title && !item.deleted && !item.dead' },
|
|
19
|
+
{ map: {
|
|
20
|
+
rank: '${{ index + 1 }}',
|
|
21
|
+
title: '${{ item.title }}',
|
|
22
|
+
score: '${{ item.score }}',
|
|
23
|
+
author: '${{ item.by }}',
|
|
24
|
+
comments: '${{ item.descendants }}',
|
|
25
|
+
url: '${{ item.url }}',
|
|
26
|
+
} },
|
|
27
|
+
{ limit: '${{ args.limit }}' },
|
|
28
|
+
],
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'best',
|
|
5
|
+
description: 'Hacker News best stories',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of stories' },
|
|
11
|
+
],
|
|
12
|
+
columns: ['rank', 'title', 'score', 'author', 'comments'],
|
|
13
|
+
pipeline: [
|
|
14
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/beststories.json' } },
|
|
15
|
+
{ limit: '${{ Math.min((args.limit ? args.limit : 20) + 10, 50) }}' },
|
|
16
|
+
{ map: { id: '${{ item }}' } },
|
|
17
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/item/${{ item.id }}.json' } },
|
|
18
|
+
{ filter: 'item.title && !item.deleted && !item.dead' },
|
|
19
|
+
{ map: {
|
|
20
|
+
rank: '${{ index + 1 }}',
|
|
21
|
+
title: '${{ item.title }}',
|
|
22
|
+
score: '${{ item.score }}',
|
|
23
|
+
author: '${{ item.by }}',
|
|
24
|
+
comments: '${{ item.descendants }}',
|
|
25
|
+
url: '${{ item.url }}',
|
|
26
|
+
} },
|
|
27
|
+
{ limit: '${{ args.limit }}' },
|
|
28
|
+
],
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'jobs',
|
|
5
|
+
description: 'Hacker News job postings',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of job postings' },
|
|
11
|
+
],
|
|
12
|
+
columns: ['rank', 'title', 'author', 'url'],
|
|
13
|
+
pipeline: [
|
|
14
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/jobstories.json' } },
|
|
15
|
+
{ limit: '${{ Math.min((args.limit ? args.limit : 20) + 10, 50) }}' },
|
|
16
|
+
{ map: { id: '${{ item }}' } },
|
|
17
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/item/${{ item.id }}.json' } },
|
|
18
|
+
{ filter: 'item.title && !item.deleted && !item.dead' },
|
|
19
|
+
{ map: {
|
|
20
|
+
rank: '${{ index + 1 }}',
|
|
21
|
+
title: '${{ item.title }}',
|
|
22
|
+
author: '${{ item.by }}',
|
|
23
|
+
url: '${{ item.url }}',
|
|
24
|
+
} },
|
|
25
|
+
{ limit: '${{ args.limit }}' },
|
|
26
|
+
],
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'new',
|
|
5
|
+
description: 'Hacker News newest stories',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of stories' },
|
|
11
|
+
],
|
|
12
|
+
columns: ['rank', 'title', 'score', 'author', 'comments'],
|
|
13
|
+
pipeline: [
|
|
14
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/newstories.json' } },
|
|
15
|
+
{ limit: '${{ Math.min((args.limit ? args.limit : 20) + 10, 50) }}' },
|
|
16
|
+
{ map: { id: '${{ item }}' } },
|
|
17
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/item/${{ item.id }}.json' } },
|
|
18
|
+
{ filter: 'item.title && !item.deleted && !item.dead' },
|
|
19
|
+
{ map: {
|
|
20
|
+
rank: '${{ index + 1 }}',
|
|
21
|
+
title: '${{ item.title }}',
|
|
22
|
+
score: '${{ item.score }}',
|
|
23
|
+
author: '${{ item.by }}',
|
|
24
|
+
comments: '${{ item.descendants }}',
|
|
25
|
+
url: '${{ item.url }}',
|
|
26
|
+
} },
|
|
27
|
+
{ limit: '${{ args.limit }}' },
|
|
28
|
+
],
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'search',
|
|
5
|
+
description: 'Search Hacker News stories',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'query', required: true, positional: true, help: 'Search query' },
|
|
11
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of results' },
|
|
12
|
+
{
|
|
13
|
+
name: 'sort',
|
|
14
|
+
default: 'relevance',
|
|
15
|
+
help: 'Sort by relevance or date',
|
|
16
|
+
choices: ['relevance', 'date'],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
columns: ['rank', 'title', 'score', 'author', 'comments', 'url'],
|
|
20
|
+
pipeline: [
|
|
21
|
+
{ fetch: {
|
|
22
|
+
url: `https://hn.algolia.com/api/v1/\${{ args.sort === 'date' ? 'search_by_date' : 'search' }}`,
|
|
23
|
+
params: { query: '${{ args.query }}', tags: 'story', hitsPerPage: '${{ args.limit }}' },
|
|
24
|
+
} },
|
|
25
|
+
{ select: 'hits' },
|
|
26
|
+
{ map: {
|
|
27
|
+
rank: '${{ index + 1 }}',
|
|
28
|
+
title: '${{ item.title }}',
|
|
29
|
+
score: '${{ item.points }}',
|
|
30
|
+
author: '${{ item.author }}',
|
|
31
|
+
comments: '${{ item.num_comments }}',
|
|
32
|
+
url: '${{ item.url }}',
|
|
33
|
+
} },
|
|
34
|
+
{ limit: '${{ args.limit }}' },
|
|
35
|
+
],
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'show',
|
|
5
|
+
description: 'Hacker News Show HN posts',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of stories' },
|
|
11
|
+
],
|
|
12
|
+
columns: ['rank', 'title', 'score', 'author', 'comments'],
|
|
13
|
+
pipeline: [
|
|
14
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/showstories.json' } },
|
|
15
|
+
{ limit: '${{ Math.min((args.limit ? args.limit : 20) + 10, 50) }}' },
|
|
16
|
+
{ map: { id: '${{ item }}' } },
|
|
17
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/item/${{ item.id }}.json' } },
|
|
18
|
+
{ filter: 'item.title && !item.deleted && !item.dead' },
|
|
19
|
+
{ map: {
|
|
20
|
+
rank: '${{ index + 1 }}',
|
|
21
|
+
title: '${{ item.title }}',
|
|
22
|
+
score: '${{ item.score }}',
|
|
23
|
+
author: '${{ item.by }}',
|
|
24
|
+
comments: '${{ item.descendants }}',
|
|
25
|
+
url: '${{ item.url }}',
|
|
26
|
+
} },
|
|
27
|
+
{ limit: '${{ args.limit }}' },
|
|
28
|
+
],
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'top',
|
|
5
|
+
description: 'Hacker News top stories',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of stories' },
|
|
11
|
+
],
|
|
12
|
+
columns: ['rank', 'title', 'score', 'author', 'comments'],
|
|
13
|
+
pipeline: [
|
|
14
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/topstories.json' } },
|
|
15
|
+
{ limit: '${{ Math.min((args.limit ? args.limit : 20) + 10, 50) }}' },
|
|
16
|
+
{ map: { id: '${{ item }}' } },
|
|
17
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/item/${{ item.id }}.json' } },
|
|
18
|
+
{ filter: 'item.title && !item.deleted && !item.dead' },
|
|
19
|
+
{ map: {
|
|
20
|
+
rank: '${{ index + 1 }}',
|
|
21
|
+
title: '${{ item.title }}',
|
|
22
|
+
score: '${{ item.score }}',
|
|
23
|
+
author: '${{ item.by }}',
|
|
24
|
+
comments: '${{ item.descendants }}',
|
|
25
|
+
url: '${{ item.url }}',
|
|
26
|
+
} },
|
|
27
|
+
{ limit: '${{ args.limit }}' },
|
|
28
|
+
],
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hackernews',
|
|
4
|
+
name: 'user',
|
|
5
|
+
description: 'Hacker News user profile',
|
|
6
|
+
domain: 'news.ycombinator.com',
|
|
7
|
+
strategy: Strategy.PUBLIC,
|
|
8
|
+
browser: false,
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'username', required: true, positional: true, help: 'HN username' },
|
|
11
|
+
],
|
|
12
|
+
columns: ['username', 'karma', 'created', 'about'],
|
|
13
|
+
pipeline: [
|
|
14
|
+
{ fetch: { url: 'https://hacker-news.firebaseio.com/v0/user/${{ args.username }}.json' } },
|
|
15
|
+
{ map: {
|
|
16
|
+
username: '${{ item.id }}',
|
|
17
|
+
karma: '${{ item.karma }}',
|
|
18
|
+
created: `\${{ item.created ? new Date(item.created * 1000).toISOString().slice(0, 10) : '' }}`,
|
|
19
|
+
about: '${{ item.about }}',
|
|
20
|
+
} },
|
|
21
|
+
],
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cli } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'hupu',
|
|
4
|
+
name: 'hot',
|
|
5
|
+
description: '虎扑热门帖子',
|
|
6
|
+
domain: 'bbs.hupu.com',
|
|
7
|
+
args: [
|
|
8
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of hot posts' },
|
|
9
|
+
],
|
|
10
|
+
columns: ['rank', 'title', 'url'],
|
|
11
|
+
pipeline: [
|
|
12
|
+
{ navigate: 'https://bbs.hupu.com/' },
|
|
13
|
+
{ evaluate: `(async () => {
|
|
14
|
+
// 从HTML中提取帖子信息(适配新的HTML结构)
|
|
15
|
+
const html = document.documentElement.outerHTML;
|
|
16
|
+
const posts = [];
|
|
17
|
+
|
|
18
|
+
// 匹配当前虎扑页面结构的正则表达式
|
|
19
|
+
// 结构: <a href="/638249612.html"...><span class="t-title">标题</span></a>
|
|
20
|
+
const regex = /<a[^>]*href="\\/(\\d{9})\\.html"[^>]*><span[^>]*class="t-title"[^>]*>([^<]+)<\\/span><\\/a>/g;
|
|
21
|
+
let match;
|
|
22
|
+
|
|
23
|
+
while ((match = regex.exec(html)) !== null && posts.length < \${{ args.limit }}) {
|
|
24
|
+
posts.push({
|
|
25
|
+
tid: match[1],
|
|
26
|
+
title: match[2].trim()
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return posts;
|
|
31
|
+
})()
|
|
32
|
+
` },
|
|
33
|
+
{ map: {
|
|
34
|
+
rank: '${{ index + 1 }}',
|
|
35
|
+
title: '${{ item.title }}',
|
|
36
|
+
url: 'https://bbs.hupu.com/${{ item.tid }}.html',
|
|
37
|
+
} },
|
|
38
|
+
{ limit: '${{ args.limit }}' },
|
|
39
|
+
],
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cli } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'instagram',
|
|
4
|
+
name: 'comment',
|
|
5
|
+
description: 'Comment on an Instagram post',
|
|
6
|
+
domain: 'www.instagram.com',
|
|
7
|
+
args: [
|
|
8
|
+
{
|
|
9
|
+
name: 'username',
|
|
10
|
+
required: true,
|
|
11
|
+
positional: true,
|
|
12
|
+
help: 'Username of the post author',
|
|
13
|
+
},
|
|
14
|
+
{ name: 'text', required: true, positional: true, help: 'Comment text' },
|
|
15
|
+
{ name: 'index', type: 'int', default: 1, help: 'Post index (1 = most recent)' },
|
|
16
|
+
],
|
|
17
|
+
columns: ['status', 'user', 'text'],
|
|
18
|
+
pipeline: [
|
|
19
|
+
{ navigate: 'https://www.instagram.com' },
|
|
20
|
+
{ evaluate: `(async () => {
|
|
21
|
+
const username = \${{ args.username | json }};
|
|
22
|
+
const commentText = \${{ args.text | json }};
|
|
23
|
+
const idx = \${{ args.index }} - 1;
|
|
24
|
+
const headers = { 'X-IG-App-ID': '936619743392459' };
|
|
25
|
+
const opts = { credentials: 'include', headers };
|
|
26
|
+
|
|
27
|
+
const r1 = await fetch('https://www.instagram.com/api/v1/users/web_profile_info/?username=' + encodeURIComponent(username), opts);
|
|
28
|
+
if (!r1.ok) throw new Error('User not found: ' + username);
|
|
29
|
+
const userId = (await r1.json())?.data?.user?.id;
|
|
30
|
+
|
|
31
|
+
const r2 = await fetch('https://www.instagram.com/api/v1/feed/user/' + userId + '/?count=' + (idx + 1), opts);
|
|
32
|
+
const posts = (await r2.json())?.items || [];
|
|
33
|
+
if (idx >= posts.length) throw new Error('Post index ' + (idx + 1) + ' not found');
|
|
34
|
+
const pk = posts[idx].pk;
|
|
35
|
+
|
|
36
|
+
const csrf = document.cookie.match(/csrftoken=([^;]+)/)?.[1] || '';
|
|
37
|
+
const r3 = await fetch('https://www.instagram.com/api/v1/web/comments/' + pk + '/add/', {
|
|
38
|
+
method: 'POST', credentials: 'include',
|
|
39
|
+
headers: { ...headers, 'X-CSRFToken': csrf, 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
40
|
+
body: 'comment_text=' + encodeURIComponent(commentText),
|
|
41
|
+
});
|
|
42
|
+
if (!r3.ok) throw new Error('Failed to comment: HTTP ' + r3.status);
|
|
43
|
+
return [{ status: 'Commented', user: username, text: commentText }];
|
|
44
|
+
})()
|
|
45
|
+
` },
|
|
46
|
+
],
|
|
47
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|