publishport-opencli 1.0.20 → 1.0.21
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/clis/12306/me.js +2 -2
- package/clis/12306/orders.js +3 -3
- package/clis/12306/passengers.js +3 -3
- package/clis/12306/price.js +1 -1
- package/clis/12306/stations.js +1 -1
- package/clis/12306/train.js +1 -1
- package/clis/12306/trains.js +1 -1
- package/clis/12306/utils.js +1 -1
- package/clis/1688/download.js +1 -1
- package/clis/1688/item.js +4 -4
- package/clis/1688/search.js +4 -4
- package/clis/1688/store.js +4 -4
- package/clis/1point3acres/forum.js +1 -1
- package/clis/1point3acres/forums.js +1 -1
- package/clis/1point3acres/notifications.js +1 -1
- package/clis/1point3acres/search.js +1 -1
- package/clis/1point3acres/thread.js +2 -2
- package/clis/1point3acres/user.js +1 -1
- package/clis/1point3acres/utils.js +2 -2
- package/clis/36kr/article.js +2 -2
- package/clis/36kr/hot.js +2 -2
- package/clis/36kr/news.js +1 -1
- package/clis/36kr/search.js +2 -2
- package/clis/51job/company.js +2 -2
- package/clis/51job/detail.js +2 -2
- package/clis/51job/hot.js +1 -1
- package/clis/51job/search.js +1 -1
- package/clis/51job/utils.js +7 -7
- package/clis/_atlassian/shared.js +9 -9
- package/clis/_shared/article/auth.js +4 -4
- package/clis/_shared/article/douban-md2draft.js +4 -4
- package/clis/_shared/article/format.js +1 -1
- package/clis/_shared/article/images.js +7 -7
- package/clis/_shared/article/login.js +1 -1
- package/clis/_shared/article/publish.js +11 -11
- package/clis/_shared/common.js +1 -1
- package/clis/_shared/content-guard.js +1 -1
- package/clis/_shared/desktop-commands.js +1 -1
- package/clis/_shared/file-inject.js +12 -12
- package/clis/_shared/self-hosted-sites.js +2 -2
- package/clis/_shared/site-auth.js +1 -1
- package/clis/_shared/token-auth.js +2 -2
- package/clis/_shared/video-publish.js +9 -9
- package/clis/amazon/offer.js +3 -3
- package/clis/amazon/product.js +5 -5
- package/clis/amazon/shared.js +6 -6
- package/clis/antigravity/_actions.js +13 -13
- package/clis/antigravity/audit-extras.js +10 -10
- package/clis/antigravity/delete.js +1 -1
- package/clis/antigravity/model.js +6 -6
- package/clis/antigravity/new.js +2 -2
- package/clis/antigravity/read.js +2 -2
- package/clis/antigravity/rename.js +1 -1
- package/clis/antigravity/send.js +3 -3
- package/clis/antigravity/serve.js +17 -17
- package/clis/antigravity/storage.js +6 -6
- package/clis/antigravity/watch.js +2 -2
- package/clis/apple-podcasts/episodes.js +1 -1
- package/clis/apple-podcasts/top.js +1 -1
- package/clis/apple-podcasts/utils.js +1 -1
- package/clis/archive/item.js +1 -1
- package/clis/archive/search.js +1 -1
- package/clis/archive/snapshots.js +1 -1
- package/clis/archive/wayback.js +1 -1
- package/clis/arxiv/author.js +1 -1
- package/clis/arxiv/utils.js +1 -1
- package/clis/autohome/brand.js +1 -1
- package/clis/autohome/score.js +1 -1
- package/clis/autohome/utils.js +1 -1
- package/clis/baijiahao/article.js +1 -1
- package/clis/baijiahao/lists.js +1 -1
- package/clis/baijiahao/login.js +1 -1
- package/clis/baijiahao/publish.js +9 -9
- package/clis/baijiahao/stats.js +1 -1
- package/clis/baijiahao/whoami.js +1 -1
- package/clis/band/bands.js +2 -2
- package/clis/band/mentions.js +2 -2
- package/clis/band/post.js +4 -4
- package/clis/band/posts.js +3 -3
- package/clis/barchart/flow.js +3 -3
- package/clis/barchart/greeks.js +2 -2
- package/clis/barchart/quote.js +3 -3
- package/clis/bbc/news.js +1 -1
- package/clis/bbc/topic.js +1 -1
- package/clis/bbc/utils.js +1 -1
- package/clis/bilibili/article.js +1 -1
- package/clis/bilibili/categories.js +1 -1
- package/clis/bilibili/coin.js +1 -1
- package/clis/bilibili/comment-del.js +1 -1
- package/clis/bilibili/comment-like.js +1 -1
- package/clis/bilibili/comment.js +1 -1
- package/clis/bilibili/comments.js +1 -1
- package/clis/bilibili/dm-list.js +1 -1
- package/clis/bilibili/dm-read.js +1 -1
- package/clis/bilibili/dm-send.js +1 -1
- package/clis/bilibili/download.js +2 -2
- package/clis/bilibili/drafts.js +1 -1
- package/clis/bilibili/dynamic-post.js +3 -3
- package/clis/bilibili/favorite-add.js +1 -1
- package/clis/bilibili/favorite.js +1 -1
- package/clis/bilibili/feed.js +2 -2
- package/clis/bilibili/follow.js +1 -1
- package/clis/bilibili/following.js +1 -1
- package/clis/bilibili/like.js +1 -1
- package/clis/bilibili/partitions.js +1 -1
- package/clis/bilibili/stats.js +1 -1
- package/clis/bilibili/subtitle.js +3 -3
- package/clis/bilibili/summary.js +1 -1
- package/clis/bilibili/topics.js +1 -1
- package/clis/bilibili/unfollow.js +1 -1
- package/clis/bilibili/upload.js +1 -1
- package/clis/bilibili/utils.js +10 -10
- package/clis/bilibili/video-drafts.js +1 -1
- package/clis/bilibili/video.js +1 -1
- package/clis/bloomberg/businessweek.js +4 -4
- package/clis/bloomberg/news.js +2 -2
- package/clis/bloomberg/utils.js +13 -13
- package/clis/bluesky/post.js +1 -1
- package/clis/bluesky/shared.js +11 -11
- package/clis/bluesky/whoami.js +1 -1
- package/clis/booking/search.js +2 -2
- package/clis/boss/accept.js +1 -1
- package/clis/boss/applied.js +1 -1
- package/clis/boss/auth.js +1 -1
- package/clis/boss/batchgreet.js +1 -1
- package/clis/boss/bossinfo.js +1 -1
- package/clis/boss/chatlist.js +1 -1
- package/clis/boss/chatmsg.js +1 -1
- package/clis/boss/cities.js +1 -1
- package/clis/boss/detail.js +1 -1
- package/clis/boss/exchange.js +1 -1
- package/clis/boss/greet.js +1 -1
- package/clis/boss/interviews.js +1 -1
- package/clis/boss/invite.js +1 -1
- package/clis/boss/joblist.js +1 -1
- package/clis/boss/mark.js +1 -1
- package/clis/boss/me.js +2 -2
- package/clis/boss/recommend.js +1 -1
- package/clis/boss/resumedelete.js +1 -1
- package/clis/boss/resumelist.js +1 -1
- package/clis/boss/resumeupload.js +11 -11
- package/clis/boss/search.js +1 -1
- package/clis/boss/send.js +1 -1
- package/clis/boss/sendresume.js +1 -1
- package/clis/boss/stats.js +1 -1
- package/clis/boss/unread.js +1 -1
- package/clis/boss/utils.js +13 -13
- package/clis/chaoxing/assignments.js +1 -1
- package/clis/chaoxing/exams.js +1 -1
- package/clis/chaoxing/utils.js +9 -9
- package/clis/chatgpt/ask.js +1 -1
- package/clis/chatgpt/auth.js +2 -2
- package/clis/chatgpt/detail.js +1 -1
- package/clis/chatgpt/image.js +1 -1
- package/clis/chatgpt/read.js +1 -1
- package/clis/chatgpt/send.js +1 -1
- package/clis/chatgpt/utils.js +59 -59
- package/clis/chatgpt-app/ask.js +1 -1
- package/clis/chatgpt-app/send.js +1 -1
- package/clis/chatwise/model.js +6 -6
- package/clis/chess/analyze.js +1 -1
- package/clis/chess/game.js +1 -1
- package/clis/chess/games.js +1 -1
- package/clis/chess/stats.js +1 -1
- package/clis/chess/utils.js +1 -1
- package/clis/claude/ask.js +2 -2
- package/clis/claude/detail.js +1 -1
- package/clis/claude/new.js +1 -1
- package/clis/claude/read.js +1 -1
- package/clis/claude/send.js +1 -1
- package/clis/claude/utils.js +23 -23
- package/clis/cnblogs/article.js +1 -1
- package/clis/cnblogs/login.js +1 -1
- package/clis/cnblogs/stats.js +7 -7
- package/clis/cnblogs/whoami.js +1 -1
- package/clis/codex/_actions.js +3 -3
- package/clis/codex/archive.js +1 -1
- package/clis/codex/ask.js +6 -6
- package/clis/codex/model.js +8 -8
- package/clis/codex/pin.js +1 -1
- package/clis/codex/rename.js +4 -4
- package/clis/codex/send.js +3 -3
- package/clis/codex/sidebar.js +1 -1
- package/clis/coingecko/categories.js +1 -1
- package/clis/coingecko/coin.js +1 -1
- package/clis/coingecko/derivatives.js +1 -1
- package/clis/coingecko/exchanges.js +1 -1
- package/clis/coingecko/global.js +1 -1
- package/clis/coingecko/trending.js +1 -1
- package/clis/confluence/search.js +1 -1
- package/clis/coupang/product.js +3 -3
- package/clis/coupang/utils.js +1 -1
- package/clis/crates/crate.js +1 -1
- package/clis/crates/search.js +1 -1
- package/clis/crates/utils.js +1 -1
- package/clis/csdn/article.js +13 -13
- package/clis/csdn/columns.js +1 -1
- package/clis/csdn/login.js +1 -1
- package/clis/csdn/stats.js +4 -4
- package/clis/csdn/whoami.js +1 -1
- package/clis/cto51/article.js +1 -1
- package/clis/cto51/whoami.js +1 -1
- package/clis/ctrip/flight.js +2 -2
- package/clis/ctrip/hotel-search.js +3 -3
- package/clis/ctrip/hotel-suggest.js +1 -1
- package/clis/ctrip/search.js +1 -1
- package/clis/ctrip/utils.js +6 -6
- package/clis/cursor/ask.js +5 -5
- package/clis/cursor/composer.js +2 -2
- package/clis/cursor/model.js +4 -4
- package/clis/cursor/send.js +2 -2
- package/clis/dblp/author.js +1 -1
- package/clis/dblp/paper.js +1 -1
- package/clis/dblp/search.js +1 -1
- package/clis/dblp/utils.js +1 -1
- package/clis/dblp/venue.js +1 -1
- package/clis/deepseek/ask.js +1 -1
- package/clis/deepseek/auth.js +2 -2
- package/clis/deepseek/detail.js +1 -1
- package/clis/deepseek/new.js +1 -1
- package/clis/deepseek/read.js +1 -1
- package/clis/deepseek/send.js +7 -7
- package/clis/deepseek/utils.js +25 -25
- package/clis/defillama/protocol.js +1 -1
- package/clis/defillama/protocols.js +1 -1
- package/clis/defillama/utils.js +1 -1
- package/clis/devto/auth.js +2 -2
- package/clis/devto/latest.js +1 -1
- package/clis/devto/publish.js +5 -5
- package/clis/devto/read.js +2 -2
- package/clis/devto/stats.js +3 -3
- package/clis/dianping/auth.js +2 -2
- package/clis/dianping/cityResolver.js +2 -2
- package/clis/dianping/search.js +1 -1
- package/clis/dianping/shop.js +1 -1
- package/clis/dianping/utils.js +1 -1
- package/clis/discord-app/delete.js +3 -3
- package/clis/discord-app/read.js +1 -1
- package/clis/discord-app/thread-read.js +1 -1
- package/clis/discord-web/auth.js +2 -2
- package/clis/discord-web/send.js +5 -5
- package/clis/dockerhub/image.js +1 -1
- package/clis/dockerhub/search.js +1 -1
- package/clis/dockerhub/utils.js +1 -1
- package/clis/dongchedi/koubei.js +1 -1
- package/clis/dongchedi/models.js +1 -1
- package/clis/dongchedi/score.js +1 -1
- package/clis/dongchedi/search.js +1 -1
- package/clis/dongchedi/series.js +1 -1
- package/clis/dongchedi/specs.js +1 -1
- package/clis/dongchedi/utils.js +1 -1
- package/clis/douban/article.js +3 -3
- package/clis/douban/auth.js +2 -2
- package/clis/douban/download.js +1 -1
- package/clis/douban/utils.js +23 -23
- package/clis/doubao/auth.js +3 -3
- package/clis/doubao/utils.js +39 -39
- package/clis/doubao-app/ask.js +1 -1
- package/clis/doubao-app/utils.js +4 -4
- package/clis/douyin/_shared/browser-fetch.js +7 -7
- package/clis/douyin/_shared/draft-cache.js +1 -1
- package/clis/douyin/_shared/imagex-upload.js +1 -1
- package/clis/douyin/_shared/sts2.js +1 -1
- package/clis/douyin/_shared/text-extra.js +1 -1
- package/clis/douyin/_shared/tos-upload.js +4 -4
- package/clis/douyin/_shared/transcode.js +1 -1
- package/clis/douyin/_shared/vod-upload.js +4 -4
- package/clis/douyin/draft.js +18 -18
- package/clis/douyin/drafts.js +1 -1
- package/clis/douyin/publish-image.js +12 -12
- package/clis/douyin/publish.js +9 -9
- package/clis/douyin/search.js +3 -3
- package/clis/douyin/videos.js +1 -1
- package/clis/eastmoney/_secid.js +1 -1
- package/clis/eastmoney/announcement.js +1 -1
- package/clis/eastmoney/article.js +1 -1
- package/clis/eastmoney/convertible.js +1 -1
- package/clis/eastmoney/etf.js +1 -1
- package/clis/eastmoney/holders.js +1 -1
- package/clis/eastmoney/index-board.js +1 -1
- package/clis/eastmoney/kline.js +1 -1
- package/clis/eastmoney/kuaixun.js +1 -1
- package/clis/eastmoney/longhu.js +1 -1
- package/clis/eastmoney/money-flow.js +1 -1
- package/clis/eastmoney/northbound.js +1 -1
- package/clis/eastmoney/quote.js +1 -1
- package/clis/eastmoney/rank.js +1 -1
- package/clis/eastmoney/sectors.js +1 -1
- package/clis/endoflife/product.js +1 -1
- package/clis/endoflife/utils.js +1 -1
- package/clis/facebook/comment.js +8 -8
- package/clis/facebook/feed.js +4 -4
- package/clis/facebook/like.js +5 -5
- package/clis/facebook/notifications.js +3 -3
- package/clis/facebook/post.js +11 -11
- package/clis/facebook/search.js +3 -3
- package/clis/flathub/app.js +1 -1
- package/clis/flathub/search.js +1 -1
- package/clis/flathub/utils.js +1 -1
- package/clis/flomo/memos.js +1 -1
- package/clis/gemini/deep-research-result.js +4 -4
- package/clis/gemini/deep-research.js +1 -1
- package/clis/gemini/detail.js +1 -1
- package/clis/gemini/history.js +1 -1
- package/clis/gemini/image.js +2 -2
- package/clis/gemini/status.js +1 -1
- package/clis/gemini/utils.js +43 -43
- package/clis/geogebra/hexagon.js +1 -1
- package/clis/geogebra/info.js +3 -3
- package/clis/geogebra/triangle.js +1 -1
- package/clis/geogebra/utils.js +11 -11
- package/clis/ghost/login.js +1 -1
- package/clis/ghost/shared.js +2 -2
- package/clis/gitee/auth.js +2 -2
- package/clis/github-trending/repos.js +1 -1
- package/clis/google/news.js +1 -1
- package/clis/google/search.js +2 -2
- package/clis/google/suggest.js +1 -1
- package/clis/google/trends.js +1 -1
- package/clis/google/utils.js +1 -1
- package/clis/goproxy/module.js +1 -1
- package/clis/goproxy/utils.js +1 -1
- package/clis/goproxy/versions.js +1 -1
- package/clis/gov-policy/recent.js +2 -2
- package/clis/gov-policy/search.js +2 -2
- package/clis/grok/ask.js +1 -1
- package/clis/grok/detail.js +1 -1
- package/clis/grok/image.js +8 -8
- package/clis/grok/pin.js +1 -1
- package/clis/grok/send.js +1 -1
- package/clis/grok/status.js +1 -1
- package/clis/grok/utils.js +21 -21
- package/clis/guazi/browse.js +1 -1
- package/clis/guazi/car.js +1 -1
- package/clis/guazi/utils.js +1 -1
- package/clis/hackernews/auth.js +2 -2
- package/clis/hackernews/comment.js +8 -8
- package/clis/hackernews/read.js +7 -7
- package/clis/hackernews/submit.js +7 -7
- package/clis/hashnode/auth.js +3 -3
- package/clis/hashnode/publish.js +14 -14
- package/clis/hf/auth.js +2 -2
- package/clis/hf/models.js +1 -1
- package/clis/hf/paper.js +1 -1
- package/clis/hf/spaces.js +1 -1
- package/clis/hf/top.js +1 -1
- package/clis/homebrew/cask.js +1 -1
- package/clis/homebrew/formula.js +1 -1
- package/clis/homebrew/popular.js +1 -1
- package/clis/homebrew/utils.js +1 -1
- package/clis/huodongxing/events.js +1 -1
- package/clis/hupu/detail.js +4 -4
- package/clis/hupu/hot.js +3 -3
- package/clis/hupu/reply.js +1 -1
- package/clis/hupu/search.js +1 -1
- package/clis/hupu/unlike.js +1 -1
- package/clis/hupu/utils.js +10 -10
- package/clis/imdb/person.js +2 -2
- package/clis/imdb/reviews.js +3 -3
- package/clis/imdb/search.js +2 -2
- package/clis/imdb/title.js +1 -1
- package/clis/imdb/top.js +1 -1
- package/clis/imdb/trending.js +1 -1
- package/clis/imdb/utils.js +13 -13
- package/clis/imooc/article.js +6 -6
- package/clis/imooc/login.js +1 -1
- package/clis/imooc/whoami.js +1 -1
- package/clis/indeed/job.js +2 -2
- package/clis/indeed/search.js +2 -2
- package/clis/indeed/utils.js +1 -1
- package/clis/infoq/article.js +2 -2
- package/clis/infoq/login.js +1 -1
- package/clis/infoq/whoami.js +1 -1
- package/clis/instagram/_shared/private-publish.js +4 -4
- package/clis/instagram/_shared/protocol-capture.js +9 -9
- package/clis/instagram/detail.js +3 -3
- package/clis/instagram/post.js +25 -25
- package/clis/instagram/reel.js +18 -18
- package/clis/instagram/story.js +4 -4
- package/clis/instagram/user.js +2 -2
- package/clis/jd/item.js +65 -65
- package/clis/jianshu/article.js +1 -1
- package/clis/jianshu/login.js +1 -1
- package/clis/jianshu/notebooks.js +1 -1
- package/clis/jianshu/whoami.js +1 -1
- package/clis/jianyu/search.js +6 -6
- package/clis/jianyu/shared/procurement-contract.js +1 -1
- package/clis/jike/api.js +6 -6
- package/clis/jike/auth.js +3 -3
- package/clis/jike/comment.js +1 -1
- package/clis/jike/create.js +6 -6
- package/clis/jike/feed.js +3 -3
- package/clis/jike/like.js +1 -1
- package/clis/jike/notifications.js +3 -3
- package/clis/jike/repost.js +13 -13
- package/clis/jike/search.js +3 -3
- package/clis/jimeng/auth.js +2 -2
- package/clis/jimeng/generate.js +10 -10
- package/clis/jira/shared.js +1 -1
- package/clis/juejin/article.js +4 -4
- package/clis/juejin/categories.js +1 -1
- package/clis/juejin/hot.js +1 -1
- package/clis/juejin/login.js +1 -1
- package/clis/juejin/recommend.js +1 -1
- package/clis/juejin/stats.js +3 -3
- package/clis/juejin/tags.js +1 -1
- package/clis/juejin/utils.js +1 -1
- package/clis/juejin/whoami.js +1 -1
- package/clis/ke/utils.js +4 -4
- package/clis/kimi/_utils.js +7 -7
- package/clis/kimi/audit-extras.js +14 -14
- package/clis/kimi/auth.js +3 -3
- package/clis/kimi/chat.js +15 -15
- package/clis/kimi/storage.js +5 -5
- package/clis/kimi/ui.js +13 -13
- package/clis/kimi/usage.js +3 -3
- package/clis/kuaishou/auth.js +1 -1
- package/clis/kuaishou/publish.js +6 -6
- package/clis/lesswrong/_helpers.js +5 -5
- package/clis/lesswrong/comments.js +5 -5
- package/clis/lichess/top.js +1 -1
- package/clis/lichess/user.js +1 -1
- package/clis/lichess/utils.js +1 -1
- package/clis/linkedin/comment.js +1 -1
- package/clis/linkedin/connect.js +11 -11
- package/clis/linkedin/create.js +5 -5
- package/clis/linkedin/follow.js +1 -1
- package/clis/linkedin/inbox.js +1 -1
- package/clis/linkedin/job-detail.js +3 -3
- package/clis/linkedin/like.js +1 -1
- package/clis/linkedin/notifications.js +1 -1
- package/clis/linkedin/people-search.js +1 -1
- package/clis/linkedin/post-comments.js +1 -1
- package/clis/linkedin/post-detail.js +1 -1
- package/clis/linkedin/profile-analytics.js +1 -1
- package/clis/linkedin/profile-api.js +13 -13
- package/clis/linkedin/profile-experience.js +1 -1
- package/clis/linkedin/profile-projects.js +1 -1
- package/clis/linkedin/profile-read.js +3 -3
- package/clis/linkedin/reply.js +1 -1
- package/clis/linkedin/repost.js +1 -1
- package/clis/linkedin/safe-send.js +8 -8
- package/clis/linkedin/salesnav-inbox.js +5 -5
- package/clis/linkedin/salesnav-message.js +3 -3
- package/clis/linkedin/salesnav-search.js +4 -4
- package/clis/linkedin/salesnav-thread.js +1 -1
- package/clis/linkedin/search-api.js +3 -3
- package/clis/linkedin/search.js +8 -8
- package/clis/linkedin/social-api.js +31 -31
- package/clis/linkedin/timeline.js +3 -3
- package/clis/linkedin-learning/search.js +2 -2
- package/clis/linkedin-learning/trending.js +2 -2
- package/clis/linux-do/feed.js +4 -4
- package/clis/linux-do/topic-content.js +8 -8
- package/clis/lobsters/domain.js +1 -1
- package/clis/lobsters/read.js +7 -7
- package/clis/maimai/auth.js +2 -2
- package/clis/maimai/search-talents.js +4 -4
- package/clis/manus/_utils.js +1 -1
- package/clis/mastodon/login.js +1 -1
- package/clis/mastodon/post.js +1 -1
- package/clis/mastodon/shared.js +12 -12
- package/clis/mastodon/whoami.js +1 -1
- package/clis/maven/artifact.js +1 -1
- package/clis/maven/search.js +1 -1
- package/clis/maven/utils.js +1 -1
- package/clis/mdn/search.js +1 -1
- package/clis/medium/article.js +5 -5
- package/clis/medium/login.js +1 -1
- package/clis/medium/stats.js +3 -3
- package/clis/medium/tag.js +1 -1
- package/clis/medium/whoami.js +1 -1
- package/clis/mubu/notes.js +1 -1
- package/clis/mubu/utils.js +15 -15
- package/clis/note/auth.js +2 -2
- package/clis/note/note-utils.js +2 -2
- package/clis/note/publish.js +8 -8
- package/clis/notebooklm/add-source.js +8 -8
- package/clis/notebooklm/create.js +1 -1
- package/clis/notebooklm/generate-slides.js +1 -1
- package/clis/notebooklm/notes-get.js +1 -1
- package/clis/notebooklm/rpc.js +8 -8
- package/clis/notebooklm/source-fulltext.js +1 -1
- package/clis/notebooklm/utils.js +10 -10
- package/clis/nowcoder/auth.js +2 -2
- package/clis/nowcoder/comment.js +1 -1
- package/clis/nowcoder/comments.js +1 -1
- package/clis/nowcoder/dm-list.js +1 -1
- package/clis/nowcoder/dm-read.js +1 -1
- package/clis/nowcoder/dm-send.js +1 -1
- package/clis/nowcoder/drafts.js +1 -1
- package/clis/nowcoder/inbox.js +1 -1
- package/clis/nowcoder/like.js +1 -1
- package/clis/nowcoder/my.js +1 -1
- package/clis/nowcoder/post.js +1 -1
- package/clis/nowcoder/utils.js +13 -13
- package/clis/npm/downloads.js +1 -1
- package/clis/npm/package.js +1 -1
- package/clis/npm/search.js +1 -1
- package/clis/npm/utils.js +1 -1
- package/clis/nuget/package.js +1 -1
- package/clis/nuget/search.js +1 -1
- package/clis/nuget/utils.js +1 -1
- package/clis/nvd/cve.js +1 -1
- package/clis/oeis/search.js +1 -1
- package/clis/oeis/sequence.js +1 -1
- package/clis/oeis/utils.js +1 -1
- package/clis/ones/common.js +6 -6
- package/clis/ones/enrich-tasks.js +1 -1
- package/clis/ones/my-tasks.js +1 -1
- package/clis/ones/resolve-labels.js +1 -1
- package/clis/ones/task-helpers.js +1 -1
- package/clis/ones/task.js +1 -1
- package/clis/ones/worklog.js +7 -7
- package/clis/openalex/search.js +1 -1
- package/clis/openalex/utils.js +1 -1
- package/clis/openalex/work.js +1 -1
- package/clis/openfda/drug-label.js +1 -1
- package/clis/openfda/food-recall.js +1 -1
- package/clis/openfda/utils.js +1 -1
- package/clis/openreview/author.js +1 -1
- package/clis/openreview/paper.js +1 -1
- package/clis/openreview/reviews.js +3 -3
- package/clis/openreview/search.js +1 -1
- package/clis/openreview/utils.js +1 -1
- package/clis/openreview/venue.js +1 -1
- package/clis/oschina/article.js +1 -1
- package/clis/oschina/catalogs.js +1 -1
- package/clis/oschina/login.js +1 -1
- package/clis/oschina/stats.js +6 -6
- package/clis/oschina/whoami.js +1 -1
- package/clis/osv/query.js +1 -1
- package/clis/osv/utils.js +1 -1
- package/clis/osv/vulnerability.js +1 -1
- package/clis/packagist/package.js +1 -1
- package/clis/packagist/search.js +1 -1
- package/clis/packagist/utils.js +1 -1
- package/clis/pinterest/api.js +1 -1
- package/clis/pinterest/auth.js +1 -1
- package/clis/pinterest/boards.js +1 -1
- package/clis/pinterest/client.js +6 -6
- package/clis/pinterest/publish.js +5 -5
- package/clis/pixiv/auth.js +2 -2
- package/clis/pixiv/download.js +1 -1
- package/clis/pixiv/illusts.js +1 -1
- package/clis/pixiv/search.js +1 -1
- package/clis/pixiv/utils.js +3 -3
- package/clis/powerchina/auth.js +2 -2
- package/clis/powerchina/search.js +1 -1
- package/clis/producthunt/browse.js +2 -2
- package/clis/producthunt/hot.js +2 -2
- package/clis/producthunt/posts.js +1 -1
- package/clis/producthunt/today.js +1 -1
- package/clis/producthunt/utils.js +1 -1
- package/clis/pypi/downloads.js +1 -1
- package/clis/pypi/package.js +1 -1
- package/clis/pypi/utils.js +1 -1
- package/clis/qiita/auth.js +1 -1
- package/clis/qiita/gql.js +6 -6
- package/clis/qiita/publish.js +4 -4
- package/clis/qiita/stats.js +4 -4
- package/clis/qoder/_utils.js +16 -16
- package/clis/qoder/composer.js +1 -1
- package/clis/qoder/quest.js +1 -1
- package/clis/qoder/ui.js +14 -14
- package/clis/quark/auth.js +2 -2
- package/clis/quark/utils.js +2 -2
- package/clis/quora/answer-comments.js +3 -3
- package/clis/quora/create-answer.js +4 -4
- package/clis/quora/create-question.js +3 -3
- package/clis/quora/shared.js +17 -17
- package/clis/quora/whoami.js +1 -1
- package/clis/qwen/ask.js +1 -1
- package/clis/qwen/auth.js +3 -3
- package/clis/qwen/detail.js +1 -1
- package/clis/qwen/image.js +5 -5
- package/clis/qwen/status.js +1 -1
- package/clis/qwen/utils.js +16 -16
- package/clis/reddit/home.js +3 -3
- package/clis/reddit/read.js +10 -10
- package/clis/reddit/reply.js +4 -4
- package/clis/reddit/submit.js +11 -11
- package/clis/reddit/subreddit-info.js +3 -3
- package/clis/reddit/subscribed.js +4 -4
- package/clis/reddit/whoami.js +2 -2
- package/clis/rednote/comments.js +1 -1
- package/clis/rednote/download.js +1 -1
- package/clis/rednote/feed.js +1 -1
- package/clis/rednote/note.js +1 -1
- package/clis/rednote/notifications.js +2 -2
- package/clis/rednote/search.js +2 -2
- package/clis/rest-countries/country.js +1 -1
- package/clis/rest-countries/region.js +1 -1
- package/clis/rest-countries/utils.js +1 -1
- package/clis/reuters/article-detail.js +1 -1
- package/clis/reuters/auth.js +3 -3
- package/clis/reuters/search.js +1 -1
- package/clis/reuters/utils.js +4 -4
- package/clis/rfc/rfc.js +1 -1
- package/clis/rfc/utils.js +1 -1
- package/clis/rubygems/gem.js +1 -1
- package/clis/rubygems/search.js +1 -1
- package/clis/rubygems/utils.js +1 -1
- package/clis/segmentfault/article.js +3 -3
- package/clis/segmentfault/channels.js +1 -1
- package/clis/segmentfault/login.js +1 -1
- package/clis/segmentfault/stats.js +4 -4
- package/clis/segmentfault/tags.js +1 -1
- package/clis/segmentfault/whoami.js +1 -1
- package/clis/semanticscholar/citations.js +1 -1
- package/clis/semanticscholar/paper.js +1 -1
- package/clis/semanticscholar/recommendations.js +1 -1
- package/clis/semanticscholar/search.js +1 -1
- package/clis/semanticscholar/utils.js +1 -1
- package/clis/sinafinance/news.js +1 -1
- package/clis/sinafinance/stock-rank.js +1 -1
- package/clis/sinafinance/stock.js +1 -1
- package/clis/slock/attachment-download.js +1 -1
- package/clis/slock/attachment-upload.js +7 -7
- package/clis/slock/attachment-url.js +1 -1
- package/clis/slock/auth-verify.js +1 -1
- package/clis/slock/bookmark-add.js +1 -1
- package/clis/slock/bookmark-remove.js +1 -1
- package/clis/slock/channel-action.js +1 -1
- package/clis/slock/channel-create.js +1 -1
- package/clis/slock/channel-files.js +1 -1
- package/clis/slock/channel-list.js +1 -1
- package/clis/slock/channel-mark.js +1 -1
- package/clis/slock/channel-members.js +1 -1
- package/clis/slock/channel-unarchive.js +1 -1
- package/clis/slock/dm-list.js +1 -1
- package/clis/slock/errors.js +1 -1
- package/clis/slock/in-page.js +28 -28
- package/clis/slock/inbox-done.js +5 -5
- package/clis/slock/inbox.js +1 -1
- package/clis/slock/message-read.js +22 -22
- package/clis/slock/message-search.js +10 -10
- package/clis/slock/message-send.js +25 -25
- package/clis/slock/reaction-add.js +1 -1
- package/clis/slock/reaction-remove.js +1 -1
- package/clis/slock/resolve.js +1 -1
- package/clis/slock/server-list.js +2 -2
- package/clis/slock/task-claim.js +4 -4
- package/clis/slock/task-convert.js +13 -13
- package/clis/slock/task-create.js +1 -1
- package/clis/slock/task-delete.js +5 -5
- package/clis/slock/task-get.js +5 -5
- package/clis/slock/task-list-server.js +4 -4
- package/clis/slock/task-list.js +5 -5
- package/clis/slock/task-status.js +3 -3
- package/clis/slock/task-unclaim.js +3 -3
- package/clis/slock/thread-follow.js +1 -1
- package/clis/slock/thread-state.js +1 -1
- package/clis/slock/unread-summary.js +5 -5
- package/clis/slock/whoami.js +1 -1
- package/clis/smzdm/search.js +3 -3
- package/clis/sohu/article.js +1 -1
- package/clis/sohu/attributes.js +1 -1
- package/clis/sohu/categories.js +1 -1
- package/clis/sohu/channels.js +1 -1
- package/clis/sohu/columns.js +1 -1
- package/clis/sohu/login.js +1 -1
- package/clis/sohu/stats.js +3 -3
- package/clis/sohu/topics.js +1 -1
- package/clis/sohu/whoami.js +1 -1
- package/clis/spotify/spotify.js +1 -1
- package/clis/stackoverflow/read.js +6 -6
- package/clis/stackoverflow/related.js +1 -1
- package/clis/stackoverflow/tag.js +1 -1
- package/clis/stackoverflow/user.js +1 -1
- package/clis/stackoverflow/utils.js +1 -1
- package/clis/steam/app.js +1 -1
- package/clis/steam/search.js +1 -1
- package/clis/steam/utils.js +1 -1
- package/clis/substack/auth.js +2 -2
- package/clis/substack/post-utils.js +2 -2
- package/clis/substack/publish.js +5 -5
- package/clis/suno/auth.js +2 -2
- package/clis/suno/download.js +5 -5
- package/clis/suno/generate.js +3 -3
- package/clis/suno/list.js +1 -1
- package/clis/suno/status.js +1 -1
- package/clis/suno/utils.js +29 -29
- package/clis/telegram/send.js +7 -7
- package/clis/telegram/shared.js +2 -2
- package/clis/telegram/whoami.js +1 -1
- package/clis/test-utils.js +1 -1
- package/clis/threads/post.js +23 -23
- package/clis/threads/shared.js +3 -3
- package/clis/threads/whoami.js +1 -1
- package/clis/tieba/hot.js +3 -3
- package/clis/tieba/posts.js +1 -1
- package/clis/tieba/read.js +2 -2
- package/clis/tieba/search.js +3 -3
- package/clis/tieba/utils.js +1 -1
- package/clis/tiktok/comment.js +2 -2
- package/clis/tiktok/creator-videos.js +3 -3
- package/clis/tiktok/explore.js +3 -3
- package/clis/tiktok/follow.js +8 -8
- package/clis/tiktok/following.js +4 -4
- package/clis/tiktok/friends.js +7 -7
- package/clis/tiktok/live.js +3 -3
- package/clis/tiktok/notifications.js +6 -6
- package/clis/tiktok/publish.js +17 -17
- package/clis/tiktok/unfollow.js +4 -4
- package/clis/tiktok/user.js +2 -2
- package/clis/tiktok/utils.js +1 -1
- package/clis/toutiao/article.js +1 -1
- package/clis/toutiao/articles.js +2 -2
- package/clis/toutiao/auth.js +2 -2
- package/clis/toutiao/hot.js +1 -1
- package/clis/toutiao/recommend.js +1 -1
- package/clis/toutiao/utils.js +2 -2
- package/clis/trae-solo/_actions.js +4 -4
- package/clis/trae-solo/_fs.js +5 -5
- package/clis/trae-solo/_state.js +2 -2
- package/clis/trae-solo/automation.js +4 -4
- package/clis/trae-solo/mode.js +4 -4
- package/clis/trae-solo/model.js +4 -4
- package/clis/trae-solo/renderer-storage.js +4 -4
- package/clis/trae-solo/settings.js +1 -1
- package/clis/trae-solo/skill-fs.js +1 -1
- package/clis/trae-solo/skill.js +12 -12
- package/clis/trae-solo/state-fs.js +2 -2
- package/clis/trae-solo/task-fs.js +5 -5
- package/clis/trae-solo/workspaces-fs.js +1 -1
- package/clis/tumblr/auth.js +2 -2
- package/clis/tumblr/publish.js +3 -3
- package/clis/tvmaze/search.js +1 -1
- package/clis/tvmaze/show.js +1 -1
- package/clis/tvmaze/utils.js +1 -1
- package/clis/twitter/accept.js +7 -7
- package/clis/twitter/article.js +7 -7
- package/clis/twitter/bookmark-folder.js +3 -3
- package/clis/twitter/bookmark-folders.js +3 -3
- package/clis/twitter/bookmarks.js +4 -4
- package/clis/twitter/delete.js +5 -5
- package/clis/twitter/device-follow.js +3 -3
- package/clis/twitter/dm-list.js +1 -1
- package/clis/twitter/dm-read.js +1 -1
- package/clis/twitter/dm-send.js +5 -5
- package/clis/twitter/dm-shared.js +3 -3
- package/clis/twitter/download.js +6 -6
- package/clis/twitter/followers.js +5 -5
- package/clis/twitter/following.js +2 -2
- package/clis/twitter/like.js +3 -3
- package/clis/twitter/likes.js +8 -8
- package/clis/twitter/list-add-core.js +9 -9
- package/clis/twitter/list-create.js +5 -5
- package/clis/twitter/list-remove-core.js +9 -9
- package/clis/twitter/list-tweets.js +7 -7
- package/clis/twitter/lists.js +6 -6
- package/clis/twitter/notifications.js +2 -2
- package/clis/twitter/post.js +24 -24
- package/clis/twitter/profile.js +7 -7
- package/clis/twitter/quote.js +7 -7
- package/clis/twitter/reply-dm.js +7 -7
- package/clis/twitter/reply.js +12 -12
- package/clis/twitter/retweet.js +3 -3
- package/clis/twitter/scheduled-delete.js +3 -3
- package/clis/twitter/scheduled-list.js +2 -2
- package/clis/twitter/scheduled-utils.js +3 -3
- package/clis/twitter/search.js +5 -5
- package/clis/twitter/shared.js +6 -6
- package/clis/twitter/thread.js +4 -4
- package/clis/twitter/timeline.js +3 -3
- package/clis/twitter/trending.js +2 -2
- package/clis/twitter/tweets.js +11 -11
- package/clis/twitter/unlike.js +3 -3
- package/clis/twitter/unretweet.js +3 -3
- package/clis/twitter/utils.js +6 -6
- package/clis/upwork/detail.js +2 -2
- package/clis/upwork/feed.js +2 -2
- package/clis/upwork/search.js +2 -2
- package/clis/upwork/utils.js +1 -1
- package/clis/v2ex/auth.js +2 -2
- package/clis/v2ex/daily.js +3 -3
- package/clis/v2ex/me.js +2 -2
- package/clis/v2ex/notifications.js +2 -2
- package/clis/vk/post.js +1 -1
- package/clis/vk/shared.js +2 -2
- package/clis/vk/whoami.js +1 -1
- package/clis/web/read.js +8 -8
- package/clis/wechat-channels/auth.js +2 -2
- package/clis/wechat-channels/publish.js +30 -30
- package/clis/weibo/article.js +1 -1
- package/clis/weibo/auth.js +3 -3
- package/clis/weibo/comments.js +1 -1
- package/clis/weibo/delete.js +2 -2
- package/clis/weibo/feed.js +3 -3
- package/clis/weibo/hot.js +1 -1
- package/clis/weibo/publish.js +10 -10
- package/clis/weibo/search.js +2 -2
- package/clis/weibo/user-posts.js +3 -3
- package/clis/weibo/user.js +2 -2
- package/clis/weibo/utils.js +3 -3
- package/clis/weixin/article.js +1 -1
- package/clis/weixin/create-draft.js +26 -26
- package/clis/weixin/download.js +2 -2
- package/clis/weixin/login.js +1 -1
- package/clis/weixin/search.js +2 -2
- package/clis/weixin/stats.js +3 -3
- package/clis/weixin/whoami.js +1 -1
- package/clis/weread/ai-outline.js +2 -2
- package/clis/weread/book-search.js +2 -2
- package/clis/weread/book.js +2 -2
- package/clis/weread/notebooks.js +1 -1
- package/clis/weread/search.js +1 -1
- package/clis/weread/shelf.js +1 -1
- package/clis/weread/utils.js +6 -6
- package/clis/weread-official/book.js +1 -1
- package/clis/weread-official/discover.js +1 -1
- package/clis/weread-official/list-apis.js +1 -1
- package/clis/weread-official/notes.js +1 -1
- package/clis/weread-official/readdata.js +1 -1
- package/clis/weread-official/review.js +1 -1
- package/clis/weread-official/search.js +1 -1
- package/clis/weread-official/shelf.js +1 -1
- package/clis/weread-official/utils.js +1 -1
- package/clis/wikidata/entity.js +1 -1
- package/clis/wikidata/search.js +1 -1
- package/clis/wikidata/utils.js +1 -1
- package/clis/wikipedia/page.js +1 -1
- package/clis/wikipedia/trending.js +1 -1
- package/clis/wikipedia/utils.js +1 -1
- package/clis/wordpress/login.js +1 -1
- package/clis/wordpress/publish.js +1 -1
- package/clis/wordpress/shared.js +3 -3
- package/clis/wordpress/whoami.js +1 -1
- package/clis/woshipm/article.js +1 -1
- package/clis/woshipm/login.js +1 -1
- package/clis/woshipm/stats.js +4 -4
- package/clis/woshipm/whoami.js +1 -1
- package/clis/wttr/current.js +1 -1
- package/clis/wttr/forecast.js +1 -1
- package/clis/wttr/utils.js +1 -1
- package/clis/xianyu/collect.js +1 -1
- package/clis/xianyu/inbox.js +1 -1
- package/clis/xianyu/item-stats.js +2 -2
- package/clis/xianyu/location.js +1 -1
- package/clis/xianyu/manage.js +1 -1
- package/clis/xianyu/messages.js +1 -1
- package/clis/xianyu/mtop.js +5 -5
- package/clis/xianyu/order.js +1 -1
- package/clis/xianyu/promote-stats.js +2 -2
- package/clis/xianyu/publish.js +17 -17
- package/clis/xianyu/rate.js +1 -1
- package/clis/xianyu/reply.js +1 -1
- package/clis/xianyu/search.js +8 -8
- package/clis/xianyu/seller-data.js +1 -1
- package/clis/xianyu/seller-list.js +1 -1
- package/clis/xianyu/user.js +1 -1
- package/clis/xiaoe/catalog.js +2 -2
- package/clis/xiaoe/content.js +2 -2
- package/clis/xiaoe/courses.js +2 -2
- package/clis/xiaohongshu/ask.js +6 -6
- package/clis/xiaohongshu/comments.js +6 -6
- package/clis/xiaohongshu/creator-note-detail.js +7 -7
- package/clis/xiaohongshu/creator-notes-summary.js +1 -1
- package/clis/xiaohongshu/creator-notes.js +13 -13
- package/clis/xiaohongshu/creator-profile.js +2 -2
- package/clis/xiaohongshu/creator-stats.js +2 -2
- package/clis/xiaohongshu/delete-note.js +7 -7
- package/clis/xiaohongshu/download.js +4 -4
- package/clis/xiaohongshu/feed.js +2 -2
- package/clis/xiaohongshu/follow.js +3 -3
- package/clis/xiaohongshu/human.js +3 -3
- package/clis/xiaohongshu/note-helpers.js +1 -1
- package/clis/xiaohongshu/note.js +2 -2
- package/clis/xiaohongshu/notifications.js +1 -1
- package/clis/xiaohongshu/publish-video.js +8 -8
- package/clis/xiaohongshu/publish.js +59 -59
- package/clis/xiaohongshu/search.js +8 -8
- package/clis/xiaohongshu/unfollow.js +4 -4
- package/clis/xiaohongshu/user-helpers.js +1 -1
- package/clis/xiaohongshu/user.js +2 -2
- package/clis/xiaoyuzhou/auth.js +3 -3
- package/clis/xiaoyuzhou/download.js +1 -1
- package/clis/xiaoyuzhou/utils.js +1 -1
- package/clis/xueqiu/article.js +4 -4
- package/clis/xueqiu/comments.js +4 -4
- package/clis/xueqiu/danjuan-utils.js +4 -4
- package/clis/xueqiu/earnings-date.js +1 -1
- package/clis/xueqiu/events.js +3 -3
- package/clis/xueqiu/hashtags.js +3 -3
- package/clis/xueqiu/stocks.js +3 -3
- package/clis/xueqiu/users.js +3 -3
- package/clis/xueqiu/utils.js +3 -3
- package/clis/yahoo-finance/quote.js +1 -1
- package/clis/yollomi/background.js +1 -1
- package/clis/yollomi/edit.js +1 -1
- package/clis/yollomi/face-swap.js +1 -1
- package/clis/yollomi/generate.js +1 -1
- package/clis/yollomi/object-remover.js +1 -1
- package/clis/yollomi/remove-bg.js +1 -1
- package/clis/yollomi/restore.js +1 -1
- package/clis/yollomi/try-on.js +1 -1
- package/clis/yollomi/upload.js +4 -4
- package/clis/yollomi/upscale.js +1 -1
- package/clis/yollomi/utils.js +4 -4
- package/clis/yollomi/video.js +1 -1
- package/clis/youtube/channel.js +4 -4
- package/clis/youtube/feed.js +2 -2
- package/clis/youtube/like.js +5 -5
- package/clis/youtube/playlist.js +7 -7
- package/clis/youtube/publish.js +11 -11
- package/clis/youtube/search.js +3 -3
- package/clis/youtube/subscribe.js +7 -7
- package/clis/youtube/subscriptions.js +1 -1
- package/clis/youtube/transcript-group.js +2 -2
- package/clis/youtube/transcript.js +13 -13
- package/clis/youtube/unlike.js +5 -5
- package/clis/youtube/unsubscribe.js +7 -7
- package/clis/youtube/utils.js +3 -3
- package/clis/youtube/video.js +4 -4
- package/clis/youtube/watch-later.js +2 -2
- package/clis/yuanbao/ask.js +18 -18
- package/clis/yuanbao/detail.js +1 -1
- package/clis/yuanbao/read.js +1 -1
- package/clis/yuanbao/shared.js +9 -9
- package/clis/yuanbao/status.js +1 -1
- package/clis/yuque/article.js +1 -1
- package/clis/yuque/whoami.js +1 -1
- package/clis/zhihu/answer-comments.js +2 -2
- package/clis/zhihu/answer-detail.js +3 -3
- package/clis/zhihu/answer.js +1 -1
- package/clis/zhihu/article-transform.js +1 -1
- package/clis/zhihu/article.js +1 -1
- package/clis/zhihu/auth.js +2 -2
- package/clis/zhihu/collection.js +3 -3
- package/clis/zhihu/collections.js +3 -3
- package/clis/zhihu/download.js +2 -2
- package/clis/zhihu/image-profile.js +6 -6
- package/clis/zhihu/paginate.js +3 -3
- package/clis/zhihu/pin.js +4 -4
- package/clis/zhihu/question.js +3 -3
- package/clis/zhihu/recommend.js +3 -3
- package/clis/zhihu/search.js +3 -3
- package/clis/zhihu/stats.js +3 -3
- package/clis/zhihu/user-arg.js +1 -1
- package/clis/zhihu/write-shared.js +7 -7
- package/clis/zlibrary/utils.js +6 -6
- package/clis/zsxq/auth.js +3 -3
- package/clis/zsxq/search.js +1 -1
- package/clis/zsxq/topic.js +1 -1
- package/clis/zsxq/utils.js +5 -5
- package/dist/src/adapter-source.js +1 -1
- package/dist/src/browser/analyze.js +1 -1
- package/dist/src/browser/article-extract.js +2 -2
- package/dist/src/browser/ax-snapshot.js +2 -2
- package/dist/src/browser/base-page.js +25 -25
- package/dist/src/browser/bridge.js +1 -1
- package/dist/src/browser/cdp.js +1 -1
- package/dist/src/browser/daemon-client.js +1 -1
- package/dist/src/browser/daemon-lifecycle.js +7 -7
- package/dist/src/browser/dom-helpers.js +35 -35
- package/dist/src/browser/dom-snapshot.js +19 -19
- package/dist/src/browser/errors.js +3 -3
- package/dist/src/browser/extract.js +5 -5
- package/dist/src/browser/find.js +13 -13
- package/dist/src/browser/fingerprint.js +2 -2
- package/dist/src/browser/html-tree.js +6 -6
- package/dist/src/browser/managed-chrome.js +1 -1
- package/dist/src/browser/network-cache.js +1 -1
- package/dist/src/browser/network-key.js +1 -1
- package/dist/src/browser/page.js +7 -7
- package/dist/src/browser/profile.js +2 -2
- package/dist/src/browser/proxy-test.js +8 -8
- package/dist/src/browser/shape-filter.js +1 -1
- package/dist/src/browser/shape.js +1 -1
- package/dist/src/browser/stealth.js +3 -3
- package/dist/src/browser/tabs.js +2 -2
- package/dist/src/browser/target-errors.js +1 -1
- package/dist/src/browser/target-resolver.js +23 -23
- package/dist/src/browser/trace.js +2 -2
- package/dist/src/browser/utils.js +1 -1
- package/dist/src/browser/verify-fixture.js +2 -2
- package/dist/src/browser-session-lock.js +1 -1
- package/dist/src/build-manifest.js +11 -11
- package/dist/src/capabilityRouting.js +1 -1
- package/dist/src/cli-argv-preprocess.js +1 -1
- package/dist/src/cli.js +32 -32
- package/dist/src/commanderAdapter.js +3 -3
- package/dist/src/commands/auth.js +3 -3
- package/dist/src/commands/daemon.js +1 -1
- package/dist/src/completion-fast.js +1 -1
- package/dist/src/completion.js +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/convention-audit.js +2 -2
- package/dist/src/daemon-utils.js +1 -1
- package/dist/src/daemon.js +1 -1
- package/dist/src/discovery.js +2 -2
- package/dist/src/doctor.js +9 -9
- package/dist/src/download/article-download.js +15 -15
- package/dist/src/download/index.js +4 -4
- package/dist/src/download/media-download.js +1 -1
- package/dist/src/download/progress.js +3 -3
- package/dist/src/electron-apps.js +1 -1
- package/dist/src/errors.js +2 -2
- package/dist/src/execution.js +2 -2
- package/dist/src/external.js +1 -1
- package/dist/src/help.js +8 -8
- package/dist/src/hooks.js +1 -1
- package/dist/src/interceptor.js +21 -21
- package/dist/src/launcher.js +7 -7
- package/dist/src/logger.js +8 -8
- package/dist/src/main.js +7 -7
- package/dist/src/observation/artifact.js +5 -5
- package/dist/src/observation/retention.js +1 -1
- package/dist/src/output.js +2 -2
- package/dist/src/package-paths.js +1 -1
- package/dist/src/pipeline/executor.js +1 -1
- package/dist/src/pipeline/registry.js +1 -1
- package/dist/src/pipeline/steps/browser.js +1 -1
- package/dist/src/pipeline/steps/download.js +1 -1
- package/dist/src/pipeline/steps/fetch.js +6 -6
- package/dist/src/pipeline/steps/intercept.js +1 -1
- package/dist/src/pipeline/steps/tap.js +17 -17
- package/dist/src/pipeline/steps/transform.js +1 -1
- package/dist/src/pipeline/template.js +1 -1
- package/dist/src/plugin-manifest.js +1 -1
- package/dist/src/plugin-scaffold.js +19 -19
- package/dist/src/plugin.js +12 -12
- package/dist/src/rate-limit.js +1 -1
- package/dist/src/registry.js +1 -1
- package/dist/src/runtime-detect.js +1 -1
- package/dist/src/runtime.js +1 -1
- package/dist/src/scripts/framework.js +1 -1
- package/dist/src/scripts/interact.js +1 -1
- package/dist/src/scripts/store.js +1 -1
- package/dist/src/serialization.js +2 -2
- package/dist/src/session-lease.js +1 -1
- package/dist/src/snapshotFormatter.js +2 -2
- package/dist/src/tui.js +12 -12
- package/dist/src/user-runtime.js +1 -1
- package/dist/src/utils.d.ts +12 -0
- package/dist/src/utils.js +4 -4
- package/dist/src/validate.js +2 -2
- package/dist/src/verify.js +2 -2
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/clis/infoq/article.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{CliError as
|
|
1
|
+
import{CliError as b,CommandExecutionError as x}from"@jackwener/opencli/errors";import{cli as E,Strategy as S}from"@jackwener/opencli/registry";import{readFile as v,stat as A}from"node:fs/promises";import{publishArticle as N,gotoWritePage as q}from"../_shared/article/publish.js";export const infoqProfile={home:"https://xie.infoq.cn",outputFormat:"html",checkAuth:async(n)=>{try{const o={};document.cookie.split("; ").forEach((a)=>{const e=a.indexOf("=");if(e>0)o[a.slice(0,e)]=a.slice(e+1)});if(o.GCID)return{isAuthenticated:!0,userId:"",username:""};return{isAuthenticated:!1}}catch(o){return{isAuthenticated:!1,error:String(o&&o.message||o)}}},publish:async(n,o)=>{const a=n.params||{};function e(t){return new Promise((i)=>setTimeout(i,t))}await e(1000);for(let t=0;t<3;t++){const i=[...document.querySelectorAll("button, [gk-button], [role='button'], span")].find((s)=>/^知道了$/.test((s.textContent||"").trim()));if(!i)break;i.click();await e(500)}let r=null;{const t=Date.now();while(Date.now()-t<1e4&&!r){r=document.querySelector(".draft-title");if(!r)await e(300)}}if(!r)return{ok:!1,stage:"editor",message:"未找到标题输入框 .draft-title(草稿编辑器未加载)"};if(r.tagName==="INPUT"||r.tagName==="TEXTAREA"){const t=r.tagName==="INPUT"?HTMLInputElement.prototype:HTMLTextAreaElement.prototype;Object.getOwnPropertyDescriptor(t,"value").set.call(r,n.title);r.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText"}));r.dispatchEvent(new Event("change",{bubbles:!0}))}else if(r.getAttribute("contenteditable")==="true"){r.focus();r.textContent=n.title;r.dispatchEvent(new Event("input",{bubbles:!0}));r.dispatchEvent(new Event("change",{bubbles:!0}))}else{const t=r.querySelector("input")||r.querySelector("textarea");if(t){const i=t.tagName==="INPUT"?HTMLInputElement.prototype:HTMLTextAreaElement.prototype;Object.getOwnPropertyDescriptor(i,"value").set.call(t,n.title);t.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText"}));t.dispatchEvent(new Event("change",{bubbles:!0}))}else{r.textContent=n.title;r.dispatchEvent(new Event("input",{bubbles:!0}))}}await e(500);const c=document.querySelector(".DraftEditor-root")||document.querySelector(".ProseMirror")||document.querySelector("[contenteditable=true]"),l=c?c.getAttribute&&c.getAttribute("contenteditable")==="true"?c:c.querySelector("[contenteditable=true]")||c:null;if(!l)return{ok:!1,stage:"editor",message:"未找到正文编辑区(.DraftEditor-root / contenteditable)"};const h=l.innerText||"";let f=!1;try{l.focus();l.innerHTML=n.content;l.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0}));l.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}));await e(300);const t=l.innerText||"";if(t!==h&&t.trim())f=!0}catch(t){}if(!f)try{l.focus();const t=window.getSelection(),i=document.createRange();i.selectNodeContents(l);t.removeAllRanges();t.addRange(i);const s=new DataTransfer;s.setData("text/plain",l.innerText||"");s.setData("text/html",n.content);l.dispatchEvent(new ClipboardEvent("paste",{bubbles:!0,cancelable:!0,clipboardData:s}));await e(500);const k=l.innerText||"";if(k!==h&&k.trim())f=!0}catch(t){}if(!f)try{l.focus();document.execCommand("selectAll",!1,null);const t=document.execCommand("insertHTML",!1,n.content);await e(300);const i=l.innerText||"";if(t&&i!==h&&i.trim())f=!0}catch(t){}if(!f)return{ok:!1,stage:"editor",message:"正文填充失败:innerHTML / 剪贴板粘贴 / execCommand 三种策略均未生效"};await e(800);const w=a.tags||[];if(w.length){const t=document.querySelector('input[placeholder*="标签"], input[placeholder*="tag"], .tag-input input, [class*="tag"] input');if(t)for(const i of w.slice(0,5)){t.focus();Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value").set.call(t,i);t.dispatchEvent(new Event("input",{bubbles:!0}));await e(800);const s=document.querySelector('[class*="suggest"] li, [class*="dropdown"] li, [class*="option"]');if(s&&s.textContent.includes(i))s.click();else t.dispatchEvent(new KeyboardEvent("keydown",{key:"Enter",bubbles:!0}));await e(400)}}const y="https://xie.infoq.cn/draft/"+a.draftId;if(n.draftOnly){await e(1500);return{ok:!0,draft:!0,id:String(a.draftId),url:y}}const m=["[gk-button][gkbtn-color=blue]","[gk-button][gkbtn-color=green]","[gk-button][gkbtn-color=orange]",'[class*="Button_button_"]',".submit-btn",".draft-submit-btn"];let g=null;{const t=Date.now();while(Date.now()-t<1e4&&!g){g=[...document.querySelectorAll('[gk-button], [class*="Button_button_"], button, [role="button"]')].find((i)=>/^(发布|发布文章)$/.test(i.textContent.trim())&&!i.disabled)||null;if(!g)for(const i of m){const s=document.querySelector(i);if(s&&!s.disabled&&/发布/.test(s.textContent)){g=s;break}}if(!g)await e(300)}}if(!g)return{ok:!1,stage:"publish",message:"未找到发布按钮"};g.click();const T=[".dialog-footer-buttons [gkbtn-color=green]",".dialog-footer-buttons [gk-button]","[gk-modal-footer] [gk-button]","[gkmodal-color=confirm] [gk-button]","[gkmodal-color=editor-action] [gk-button]","[gkmodal-color=common] [gk-button]","[gkmodal-color=base] [gk-button]",'[gk-modal-footer] [class*="Button_button_"]',".gkui-modal-layer [gk-button]","#gkui-modal-controller [gk-button]"];let d=null;{const t=Date.now();while(Date.now()-t<15000&&!d){const i=document.querySelectorAll(".dialog-setting");let s=null;for(const u of i)if(u.innerHTML.length>50){s=u;break}if(s){const u=s.querySelector('[gkbtn-color="green"]');if(u&&!u.disabled){d=u;break}const p=s.querySelectorAll(".dialog-footer-buttons [gk-button]");for(const I of p)if(/确定|确认/.test(I.textContent)&&!I.disabled){d=I;break}if(d)break}for(const u of T){const p=document.querySelector(u);if(p&&!p.disabled&&/发布|确认|确定/.test(p.textContent)){d=p;break}}if(d)break;d=[...document.querySelectorAll('[gk-button], [class*="Button_button_"], button')].find((u)=>{if(u.disabled)return!1;const p=u.textContent.trim();if(!/^(发布|确认发布|确认|确定)$/.test(p))return!1;return!!u.closest('[gkmodal-color], .gkui-modal-layer, #gkui-modal-controller, .dialog-setting, [class*="modal"], [class*="dialog"]')})||null;if(!d)await e(300)}}if(!d)return{ok:!1,stage:"publish",message:"确认弹窗未出现,文章可能未发布(仅保存为草稿)",detail:{draftUrl:y}};d.click();await e(500);return{ok:!0,draft:!1,id:String(a.draftId),url:"https://xie.infoq.cn/article/"+a.draftId}}};function D(n){if(!n.execute)throw new b("INVALID_INPUT","此命令需要 --execute 参数才能执行写操作。注意:本报错仅表示缺少 --execute,并未校验其余参数,不能当 dry-run 预览用")}async function P(n){const o=typeof n.text==="string"?n.text:void 0,a=typeof n.file==="string"?n.file:void 0;if(o&&a)throw new b("INVALID_INPUT","不能同时指定正文参数和 --file,请二选一");let e=o??"";if(a){let r;try{r=await A(a)}catch{throw new b("INVALID_INPUT","文件不存在: "+a)}if(!r.isFile())throw new b("INVALID_INPUT","必须是可读的文本文件: "+a);let c;try{c=await v(a)}catch{throw new b("INVALID_INPUT","无法读取文件: "+a)}try{e=new TextDecoder("utf-8",{fatal:!0}).decode(c)}catch{throw new b("INVALID_INPUT","文件必须是 UTF-8 编码: "+a)}}if(!e.trim())throw new b("INVALID_INPUT","正文不能为空");return e}function _(n,o,a,e,r={}){return[{status:"success",outcome:e,message:n,target_type:o,target:a,...r}]}function L(n){const o=[],a=/!\[[^\]]*\]\(([^)\s]+)[^)]*\)/g;let e;while((e=a.exec(n))!==null)o.push(e[1]);const r=/<img[^>]+src=["']([^"']+)["']/gi;while((e=r.exec(n))!==null)o.push(e[1]);const c=o.filter((l)=>!/^(https?:)?\/\//i.test(l)&&!l.startsWith("data:"));if(c.length)throw new b("INVALID_INPUT","InfoQ 写作社区暂不支持本机图片自动转存(无可靠上传通道),请先把图片发布到可公网访问的 URL 再引用:"+c.slice(0,3).join(", "))}async function C(n){await q(n,"https://xie.infoq.cn");const o=await n.evaluate(`(async () => {
|
|
2
2
|
try {
|
|
3
3
|
const resp = await fetch('https://xie.infoq.cn/api/v1/draft/create', {
|
|
4
4
|
method: 'POST',
|
|
@@ -16,4 +16,4 @@ import{CliError as N,CommandExecutionError as j}from"@jackwener/opencli/errors";
|
|
|
16
16
|
} catch (e) {
|
|
17
17
|
return { ok: false, message: String((e && e.message) || e) };
|
|
18
18
|
}
|
|
19
|
-
})()`);if(!
|
|
19
|
+
})()`);if(!o||o.ok===!1)throw new x("[draft] "+(o&&o.message||"InfoQ 建草稿失败"));return o.draftId}E({site:"infoq",name:"article",access:"write",description:"发布文章到 InfoQ 写作社区(xie.infoq.cn)。默认正式发布;加 --draft 仅存草稿。正文 Markdown(编辑器吃转换后的富文本)。",domain:"infoq.cn",strategy:S.COOKIE,browser:!0,args:[{name:"title",positional:!0,required:!0,help:"文章标题"},{name:"text",positional:!0,help:"文章正文(默认 Markdown;传 --html 则视为 HTML)"},{name:"file",help:"正文文件路径(UTF-8 编码,默认 Markdown)"},{name:"html",type:"boolean",help:"将正文视为原始 HTML 而非 Markdown"},{name:"tags",help:"文章标签,逗号分隔(可选;按平台联想下拉选择,选不中则回车创建)"},{name:"draft",type:"boolean",help:"仅保存草稿,不发布"},{name:"execute",type:"boolean",help:"确认执行写操作。不加此参数则拒绝写入。"}],columns:["status","outcome","message","target_type","target","created_target","created_url"],func:async(n,o)=>{if(!n)throw new x("InfoQ 文章发布需要浏览器会话");D(o);const a=String(o.title??"").trim();if(!a)throw new b("INVALID_INPUT","文章标题不能为空");const e=await P(o);L(e);const r=Boolean(o.draft),c=String(o.tags??"").split(",").map((m)=>m.trim()).filter(Boolean),l=await C(n),h={...infoqProfile,home:"https://xie.infoq.cn/draft/"+l},f=await N(n,{title:a,body:e,format:o.html?"html":"markdown",draftOnly:r,profile:h,publishParams:{draftId:l,tags:c}});let w=f.url;if(!r)try{await n.wait({time:3});const m=await n.evaluate("location.href");if(typeof m==="string"&&/\/article\/[a-zA-Z0-9]+/.test(m))w=m.split("?")[0].split("#")[0]}catch(m){}const y=f.draft?"草稿已保存至 InfoQ 写作社区(编辑器自动保存,需在编辑器内手动发布)":"文章已发布至 InfoQ 写作社区";return _(y,"article","",f.draft?"draft":"publish",{created_target:"article:"+f.id,created_url:w})}});
|
package/clis/infoq/login.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{registerArticleLogin as
|
|
1
|
+
import{registerArticleLogin as o}from"../_shared/article/login.js";import{infoqProfile as i}from"./article.js";o({site:"infoq",domain:"infoq.cn",profile:{home:i.home,checkAuth:i.checkAuth},loginUrl:"https://xie.infoq.cn",loginDescription:"打开 InfoQ 写作社区并等待浏览器完成登录(供桌面客户端引导登录)。"});
|
package/clis/infoq/whoami.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cli as
|
|
1
|
+
import{cli as n,Strategy as t}from"@jackwener/opencli/registry";import{checkLogin as c,cookieQuickCheck as r}from"../_shared/article/auth.js";import{infoqProfile as i}from"./article.js";const s={home:i.home,checkAuth:i.checkAuth};n({site:"infoq",name:"whoami",access:"read",description:"检测 InfoQ 写作社区(xie.infoq.cn)当前登录状态。",domain:"infoq.cn",strategy:t.COOKIE,browser:!0,columns:["logged_in","user_id","username"],authStatus:{quickCheck:r("https://xie.infoq.cn",["GCID"])},func:async(o)=>{const e=await c(o,s);return[{logged_in:e.isAuthenticated,user_id:e.userId||"",username:e.username||""}]}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as L from"node:crypto";import*as U from"node:fs";import*as R from"node:os";import*as V from"node:path";import{spawnSync as z}from"node:child_process";import{CommandExecutionError as K}from"@jackwener/opencli/errors";import{instagramPrivateApiFetch as S}from"./protocol-capture.js";import{buildReadInstagramRuntimeInfoJs as h}from"./runtime-info.js";export{buildReadInstagramRuntimeInfoJs,extractInstagramRuntimeInfo,resolveInstagramRuntimeInfo}from"./runtime-info.js";const C=0.8,M=1.91,D=0.5625,T=0.75,j="FFFFFF",l="https://www.instagram.com/",u="/api/v1/|/graphql/",k=2,v=2,w=20,d=2000,I=15000,n="19ce5f445dbfd9d29c59dc2a78c616a7fc090a8e018b9267bc4240a30244c53b",o="4",p={manufacturer:"samsung",model:"SM-G930F",android_version:24,android_release:"7.0"};export function markPublishOutcomeUncertain(Q){if(Q&&typeof Q==="object")Q.instagramPublishUncertain=!0;return Q}export function isPublishOutcomeUncertain(Q){return Boolean(Q&&typeof Q==="object"&&Q.instagramPublishUncertain)}export function derivePrivateApiContextFromCapture(Q){for(let X=Q.length-1;X>=0;X-=1){const Z=Q[X]?.requestHeaders??{},$={asbdId:String(Z["X-ASBD-ID"]||""),csrfToken:String(Z["X-CSRFToken"]||""),igAppId:String(Z["X-IG-App-ID"]||""),igWwwClaim:String(Z["X-IG-WWW-Claim"]||""),instagramAjax:String(Z["X-Instagram-AJAX"]||""),webSessionId:String(Z["X-Web-Session-ID"]||"")};if($.asbdId&&$.csrfToken&&$.igAppId&&$.igWwwClaim&&$.instagramAjax&&$.webSessionId)return $}return null}function i(Q){const X={};for(let Z=Q.length-1;Z>=0;Z-=1){const $=Q[Z]?.requestHeaders??{};if(!X.asbdId&&$["X-ASBD-ID"])X.asbdId=String($["X-ASBD-ID"]);if(!X.csrfToken&&$["X-CSRFToken"])X.csrfToken=String($["X-CSRFToken"]);if(!X.igAppId&&$["X-IG-App-ID"])X.igAppId=String($["X-IG-App-ID"]);if(!X.igWwwClaim&&$["X-IG-WWW-Claim"])X.igWwwClaim=String($["X-IG-WWW-Claim"]);if(!X.instagramAjax&&$["X-Instagram-AJAX"])X.instagramAjax=String($["X-Instagram-AJAX"]);if(!X.webSessionId&&$["X-Web-Session-ID"])X.webSessionId=String($["X-Web-Session-ID"])}return X}export function deriveInstagramJazoest(Q){if(!Q)return"";return`2${Array.from(Q).reduce((Z,$)=>Z+$.charCodeAt(0),0)}`}function r(Q){return new Promise((X)=>setTimeout(X,Q))}function g(Q){const X=Q instanceof Error?Q.message:String(Q);return/fetch failed|network|socket hang up|econnreset|etimedout/i.test(X)}export function explainPrivateNetworkError(Q,X){const Z=Q instanceof Error?Q.message:String(Q);if(!/certificate verification|fetch failed|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|socket hang up/i.test(Z))return null;let q="i.instagram.com";try{q=new URL(X).host}catch{}const F=Boolean(process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ALL_PROXY||process.env.all_proxy);return`Could not reach ${q} from the CLI process (${Z}).`+(F?" A proxy is configured via environment variables — check that it is running and allows this host.":" Note: uploads are sent from the CLI process, which uses only HTTP_PROXY / HTTPS_PROXY and ignores the OS proxy settings, so browser commands can succeed while publishing fails. If this network needs a proxy to reach Instagram, set HTTPS_PROXY (e.g. http://127.0.0.1:1082) and retry.")+" This is a connectivity problem, not a certificate, account, or image problem."}function s(Q,X){return Q.find((Z)=>Z.name===X)?.value||""}export async function resolveInstagramPrivatePublishConfig(Q){let X;for(let Z=0;Z<k;Z+=1)try{if(typeof Q.startNetworkCapture==="function")await Q.startNetworkCapture(u);await Q.goto(`${l}?__opencli_private_probe=${Date.now()}`);await Q.wait({time:2});const[$,q,F]=await Promise.all([Q.getCookies({domain:"instagram.com"}),Q.evaluate(h()),typeof Q.readNetworkCapture==="function"?Q.readNetworkCapture():Promise.resolve([])]),N=Array.isArray(F)?F:[],W=derivePrivateApiContextFromCapture(N)??i(N),O=q?.csrfToken||s($,"csrftoken")||W.csrfToken||"",J=q?.appId||W.igAppId||"",G=q?.instagramAjax||W.instagramAjax||"";if(!O)throw new K("Instagram private route could not derive CSRF token from browser session");if(!J)throw new K("Instagram private route could not derive X-IG-App-ID from instagram runtime");if(!G)throw new K("Instagram private route could not derive X-Instagram-AJAX from instagram runtime");const H=W.asbdId||"",Y=W.igWwwClaim||"",y=W.webSessionId||"";return{apiContext:{asbdId:H,csrfToken:O,igAppId:J,igWwwClaim:Y,instagramAjax:G,webSessionId:y},jazoest:deriveInstagramJazoest(O)}}catch($){X=$;if(!g($)||Z>=k-1)throw $}throw X instanceof Error?X:Error(String(X))}export function buildConfigureBody(Q){const X=new URLSearchParams;X.set("archive_only","false");X.set("caption",Q.caption);X.set("clips_share_preview_to_feed","1");X.set("disable_comments","0");X.set("disable_oa_reuse","false");X.set("igtv_share_preview_to_feed","1");X.set("is_meta_only_post","0");X.set("is_unified_video","1");X.set("like_and_view_counts_disabled","0");X.set("media_share_flow","creation_flow");X.set("share_to_facebook","");X.set("share_to_fb_destination_type","USER");X.set("source_type","library");X.set("upload_id",Q.uploadId);X.set("video_subtitles_enabled","0");X.set("jazoest",Q.jazoest);return X.toString()}export function buildConfigureSidecarPayload(Q){return{archive_only:!1,caption:Q.caption,children_metadata:Q.uploadIds.map((X)=>({upload_id:X})),client_sidecar_id:Q.clientSidecarId,disable_comments:"0",is_meta_only_post:!1,is_open_to_public_submission:!1,like_and_view_counts_disabled:0,media_share_flow:"creation_flow",share_to_facebook:"",share_to_fb_destination_type:"USER",source_type:"library",jazoest:Q.jazoest}}function a(Q){switch(V.extname(Q).toLowerCase()){case".png":return"image/png";case".webp":return"image/webp";case".jpg":case".jpeg":default:return"image/jpeg"}}function t(Q){if(Q.length<24)return null;if(Q.subarray(0,8).toString("hex").toUpperCase()!=="89504E470D0A1A0A")return null;if(Q.subarray(12,16).toString("ascii")!=="IHDR")return null;return{width:Q.readUInt32BE(16),height:Q.readUInt32BE(20)}}function e(Q){if(Q.length<4||Q[0]!==255||Q[1]!==216)return null;let X=2;while(X+9<Q.length){if(Q[X]!==255){X+=1;continue}const Z=Q[X+1];X+=2;if(Z===216||Z===217)continue;if(X+2>Q.length)break;const $=Q.readUInt16BE(X);if($<2||X+$>Q.length)break;if(Z>=192&&Z<=207&&![196,200,204].includes(Z)&&$>=7)return{height:Q.readUInt16BE(X+3),width:Q.readUInt16BE(X+5)};X+=$}return null}function QQ(Q){if(Q.length<30)return null;if(Q.subarray(0,4).toString("ascii")!=="RIFF"||Q.subarray(8,12).toString("ascii")!=="WEBP")return null;const X=Q.subarray(12,16).toString("ascii");if(X==="VP8X"&&Q.length>=30)return{width:1+Q.readUIntLE(24,3),height:1+Q.readUIntLE(27,3)};if(X==="VP8 "&&Q.length>=30)return{width:Q.readUInt16LE(26)&16383,height:Q.readUInt16LE(28)&16383};if(X==="VP8L"&&Q.length>=25){const Z=Q.readUInt32LE(21);return{width:(Z&16383)+1,height:(Z>>14&16383)+1}}return null}function XQ(Q,X){const Z=V.extname(Q).toLowerCase(),$=Z===".png"?t(X):Z===".webp"?QQ(X):e(X);if(!$)throw new K(`Failed to read image dimensions for ${Q}`);return $}export function readImageAsset(Q){const X=U.readFileSync(Q),{width:Z,height:$}=XQ(Q,X);return{filePath:Q,fileName:V.basename(Q),mimeType:a(Q),width:Z,height:$,byteLength:X.length,bytes:X}}export function isInstagramFeedAspectRatioAllowed(Q,X){const Z=Q/Math.max(X,1);return Z>=C-0.001&&Z<=M+0.001}export function getInstagramFeedNormalizedDimensions(Q,X){const Z=Q/Math.max(X,1);if(Z<C)return{width:Math.ceil(X*C),height:X};if(Z>M)return{width:Q,height:Math.ceil(Q/M)};return null}export function isInstagramStoryAspectRatioAllowed(Q,X){const Z=Q/Math.max(X,1);return Z>=D-0.001&&Z<=T+0.001}export function getInstagramStoryNormalizedDimensions(Q,X){const Z=Q/Math.max(X,1);if(Z<D)return{width:Math.ceil(X*D),height:X};if(Z>T)return{width:Q,height:Math.ceil(Q/T)};return null}function x(Q){const X=V.parse(Q);return V.join(R.tmpdir(),`opencli-instagram-private-${X.name}-${L.randomUUID()}${X.ext||".png"}`)}export function prepareImageAssetForPrivateUpload(Q){const X=readImageAsset(Q),Z=getInstagramFeedNormalizedDimensions(X.width,X.height);if(!Z)return X;if(process.platform!=="darwin")throw new K(`Instagram private publish does not support auto-normalizing ${X.fileName} on ${process.platform}`,`Use images within ${C.toFixed(2)}-${M.toFixed(2)} aspect ratio, or use the UI route`);const $=x(Q),q=z("sips",["--padToHeightWidth",String(Z.height),String(Z.width),"--padColor",j,Q,"--out",$],{encoding:"utf8"});if(q.error||q.status!==0||!U.existsSync($)){const F=[q.error?.message,q.stderr,q.stdout].map((N)=>String(N||"").trim()).filter(Boolean).join(" ");throw new K(`Instagram private publish failed to normalize ${X.fileName}`,F||"sips padToHeightWidth failed")}return{...readImageAsset($),cleanupPath:$}}export function prepareImageAssetForPrivateStoryUpload(Q){const X=readImageAsset(Q),Z=getInstagramStoryNormalizedDimensions(X.width,X.height);if(!Z)return X;if(process.platform!=="darwin")throw new K(`Instagram private story publish does not support auto-normalizing ${X.fileName} on ${process.platform}`,`Use images within ${D.toFixed(2)}-${T.toFixed(2)} aspect ratio, or use the UI route`);const $=x(Q),q=z("sips",["--padToHeightWidth",String(Z.height),String(Z.width),"--padColor",j,Q,"--out",$],{encoding:"utf8"});if(q.error||q.status!==0||!U.existsSync($)){const F=[q.error?.message,q.stderr,q.stdout].map((N)=>String(N||"").trim()).filter(Boolean).join(" ");throw new K(`Instagram private story publish failed to normalize ${X.fileName}`,F||"sips padToHeightWidth failed")}return{...readImageAsset($),cleanupPath:$}}function A(Q,X,Z){const $=V.join(R.tmpdir(),`opencli-instagram-${L.randomUUID()}.swift`);U.writeFileSync($,Q);try{const q=z("swift",[$,...X],{encoding:"utf8"});if(q.error||q.status!==0){const F=[q.error?.message,q.stderr,q.stdout].map((N)=>String(N||"").trim()).filter(Boolean).join(" ");throw new K(`Instagram private publish failed to ${Z}`,F||"swift helper failed")}return JSON.parse(String(q.stdout||"{}"))}catch(q){if(q instanceof K)throw q;throw new K(`Instagram private publish failed to ${Z}`,q instanceof Error?q.message:String(q))}finally{U.rmSync($,{force:!0})}}function ZQ(Q){if(process.platform!=="darwin")throw new K(`Instagram private mixed-media publish does not support reading video metadata on ${process.platform}`,"Use macOS for private mixed-media publishing, or rely on the UI fallback");const X=A(`
|
|
1
|
+
import*as w from"node:crypto";import*as h from"node:fs";import*as S from"node:os";import*as u from"node:path";import{spawnSync as b}from"node:child_process";import{CommandExecutionError as n}from"@jackwener/opencli/errors";import{instagramPrivateApiFetch as P}from"./protocol-capture.js";import{buildReadInstagramRuntimeInfoJs as z}from"./runtime-info.js";export{buildReadInstagramRuntimeInfoJs,extractInstagramRuntimeInfo,resolveInstagramRuntimeInfo}from"./runtime-info.js";const I=0.8,y=1.91,v=0.5625,A=0.75,R="FFFFFF",V="https://www.instagram.com/",W="/api/v1/|/graphql/",C=2,E=2,M=20,G=2000,O=15000,J="19ce5f445dbfd9d29c59dc2a78c616a7fc090a8e018b9267bc4240a30244c53b",B="4",H={manufacturer:"samsung",model:"SM-G930F",android_version:24,android_release:"7.0"};export function markPublishOutcomeUncertain(e){if(e&&typeof e==="object")e.instagramPublishUncertain=!0;return e}export function isPublishOutcomeUncertain(e){return Boolean(e&&typeof e==="object"&&e.instagramPublishUncertain)}export function derivePrivateApiContextFromCapture(e){for(let t=e.length-1;t>=0;t-=1){const a=e[t]?.requestHeaders??{},r={asbdId:String(a["X-ASBD-ID"]||""),csrfToken:String(a["X-CSRFToken"]||""),igAppId:String(a["X-IG-App-ID"]||""),igWwwClaim:String(a["X-IG-WWW-Claim"]||""),instagramAjax:String(a["X-Instagram-AJAX"]||""),webSessionId:String(a["X-Web-Session-ID"]||"")};if(r.asbdId&&r.csrfToken&&r.igAppId&&r.igWwwClaim&&r.instagramAjax&&r.webSessionId)return r}return null}function Y(e){const t={};for(let a=e.length-1;a>=0;a-=1){const r=e[a]?.requestHeaders??{};if(!t.asbdId&&r["X-ASBD-ID"])t.asbdId=String(r["X-ASBD-ID"]);if(!t.csrfToken&&r["X-CSRFToken"])t.csrfToken=String(r["X-CSRFToken"]);if(!t.igAppId&&r["X-IG-App-ID"])t.igAppId=String(r["X-IG-App-ID"]);if(!t.igWwwClaim&&r["X-IG-WWW-Claim"])t.igWwwClaim=String(r["X-IG-WWW-Claim"]);if(!t.instagramAjax&&r["X-Instagram-AJAX"])t.instagramAjax=String(r["X-Instagram-AJAX"]);if(!t.webSessionId&&r["X-Web-Session-ID"])t.webSessionId=String(r["X-Web-Session-ID"])}return t}export function deriveInstagramJazoest(e){if(!e)return"";return`2${Array.from(e).reduce((a,r)=>a+r.charCodeAt(0),0)}`}function q(e){return new Promise((t)=>setTimeout(t,e))}function U(e){const t=e instanceof Error?e.message:String(e);return/fetch failed|network|socket hang up|econnreset|etimedout/i.test(t)}export function explainPrivateNetworkError(e,t){const a=e instanceof Error?e.message:String(e);if(!/certificate verification|fetch failed|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|socket hang up/i.test(a))return null;let i="i.instagram.com";try{i=new URL(t).host}catch{}const o=Boolean(process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ALL_PROXY||process.env.all_proxy);return`Could not reach ${i} from the CLI process (${a}).`+(o?" A proxy is configured via environment variables — check that it is running and allows this host.":" Note: uploads are sent from the CLI process, which uses only HTTP_PROXY / HTTPS_PROXY and ignores the OS proxy settings, so browser commands can succeed while publishing fails. If this network needs a proxy to reach Instagram, set HTTPS_PROXY (e.g. http://127.0.0.1:1082) and retry.")+" This is a connectivity problem, not a certificate, account, or image problem."}function K(e,t){return e.find((a)=>a.name===t)?.value||""}export async function resolveInstagramPrivatePublishConfig(e){let t;for(let a=0;a<C;a+=1)try{if(typeof e.startNetworkCapture==="function")await e.startNetworkCapture(W);await e.goto(`${V}?__opencli_private_probe=${Date.now()}`);await e.wait({time:2});const[r,i,o]=await Promise.all([e.getCookies({domain:"instagram.com"}),e.evaluate(z()),typeof e.readNetworkCapture==="function"?e.readNetworkCapture():Promise.resolve([])]),s=Array.isArray(o)?o:[],c=derivePrivateApiContextFromCapture(s)??Y(s),d=i?.csrfToken||K(r,"csrftoken")||c.csrfToken||"",l=i?.appId||c.igAppId||"",p=i?.instagramAjax||c.instagramAjax||"";if(!d)throw new n("Instagram private route could not derive CSRF token from browser session");if(!l)throw new n("Instagram private route could not derive X-IG-App-ID from instagram runtime");if(!p)throw new n("Instagram private route could not derive X-Instagram-AJAX from instagram runtime");const m=c.asbdId||"",f=c.igWwwClaim||"",L=c.webSessionId||"";return{apiContext:{asbdId:m,csrfToken:d,igAppId:l,igWwwClaim:f,instagramAjax:p,webSessionId:L},jazoest:deriveInstagramJazoest(d)}}catch(r){t=r;if(!U(r)||a>=C-1)throw r}throw t instanceof Error?t:Error(String(t))}export function buildConfigureBody(e){const t=new URLSearchParams;t.set("archive_only","false");t.set("caption",e.caption);t.set("clips_share_preview_to_feed","1");t.set("disable_comments","0");t.set("disable_oa_reuse","false");t.set("igtv_share_preview_to_feed","1");t.set("is_meta_only_post","0");t.set("is_unified_video","1");t.set("like_and_view_counts_disabled","0");t.set("media_share_flow","creation_flow");t.set("share_to_facebook","");t.set("share_to_fb_destination_type","USER");t.set("source_type","library");t.set("upload_id",e.uploadId);t.set("video_subtitles_enabled","0");t.set("jazoest",e.jazoest);return t.toString()}export function buildConfigureSidecarPayload(e){return{archive_only:!1,caption:e.caption,children_metadata:e.uploadIds.map((t)=>({upload_id:t})),client_sidecar_id:e.clientSidecarId,disable_comments:"0",is_meta_only_post:!1,is_open_to_public_submission:!1,like_and_view_counts_disabled:0,media_share_flow:"creation_flow",share_to_facebook:"",share_to_fb_destination_type:"USER",source_type:"library",jazoest:e.jazoest}}function Q(e){switch(u.extname(e).toLowerCase()){case".png":return"image/png";case".webp":return"image/webp";case".jpg":case".jpeg":default:return"image/jpeg"}}function Z(e){if(e.length<24)return null;if(e.subarray(0,8).toString("hex").toUpperCase()!=="89504E470D0A1A0A")return null;if(e.subarray(12,16).toString("ascii")!=="IHDR")return null;return{width:e.readUInt32BE(16),height:e.readUInt32BE(20)}}function ee(e){if(e.length<4||e[0]!==255||e[1]!==216)return null;let t=2;while(t+9<e.length){if(e[t]!==255){t+=1;continue}const a=e[t+1];t+=2;if(a===216||a===217)continue;if(t+2>e.length)break;const r=e.readUInt16BE(t);if(r<2||t+r>e.length)break;if(a>=192&&a<=207&&![196,200,204].includes(a)&&r>=7)return{height:e.readUInt16BE(t+3),width:e.readUInt16BE(t+5)};t+=r}return null}function te(e){if(e.length<30)return null;if(e.subarray(0,4).toString("ascii")!=="RIFF"||e.subarray(8,12).toString("ascii")!=="WEBP")return null;const t=e.subarray(12,16).toString("ascii");if(t==="VP8X"&&e.length>=30)return{width:1+e.readUIntLE(24,3),height:1+e.readUIntLE(27,3)};if(t==="VP8 "&&e.length>=30)return{width:e.readUInt16LE(26)&16383,height:e.readUInt16LE(28)&16383};if(t==="VP8L"&&e.length>=25){const a=e.readUInt32LE(21);return{width:(a&16383)+1,height:(a>>14&16383)+1}}return null}function ae(e,t){const a=u.extname(e).toLowerCase(),r=a===".png"?Z(t):a===".webp"?te(t):ee(t);if(!r)throw new n(`Failed to read image dimensions for ${e}`);return r}export function readImageAsset(e){const t=h.readFileSync(e),{width:a,height:r}=ae(e,t);return{filePath:e,fileName:u.basename(e),mimeType:Q(e),width:a,height:r,byteLength:t.length,bytes:t}}export function isInstagramFeedAspectRatioAllowed(e,t){const a=e/Math.max(t,1);return a>=I-0.001&&a<=y+0.001}export function getInstagramFeedNormalizedDimensions(e,t){const a=e/Math.max(t,1);if(a<I)return{width:Math.ceil(t*I),height:t};if(a>y)return{width:e,height:Math.ceil(e/y)};return null}export function isInstagramStoryAspectRatioAllowed(e,t){const a=e/Math.max(t,1);return a>=v-0.001&&a<=A+0.001}export function getInstagramStoryNormalizedDimensions(e,t){const a=e/Math.max(t,1);if(a<v)return{width:Math.ceil(t*v),height:t};if(a>A)return{width:e,height:Math.ceil(e/A)};return null}function N(e){const t=u.parse(e);return u.join(S.tmpdir(),`opencli-instagram-private-${t.name}-${w.randomUUID()}${t.ext||".png"}`)}export function prepareImageAssetForPrivateUpload(e){const t=readImageAsset(e),a=getInstagramFeedNormalizedDimensions(t.width,t.height);if(!a)return t;if(process.platform!=="darwin")throw new n(`Instagram private publish does not support auto-normalizing ${t.fileName} on ${process.platform}`,`Use images within ${I.toFixed(2)}-${y.toFixed(2)} aspect ratio, or use the UI route`);const r=N(e),i=b("sips",["--padToHeightWidth",String(a.height),String(a.width),"--padColor",R,e,"--out",r],{encoding:"utf8"});if(i.error||i.status!==0||!h.existsSync(r)){const o=[i.error?.message,i.stderr,i.stdout].map((s)=>String(s||"").trim()).filter(Boolean).join(" ");throw new n(`Instagram private publish failed to normalize ${t.fileName}`,o||"sips padToHeightWidth failed")}return{...readImageAsset(r),cleanupPath:r}}export function prepareImageAssetForPrivateStoryUpload(e){const t=readImageAsset(e),a=getInstagramStoryNormalizedDimensions(t.width,t.height);if(!a)return t;if(process.platform!=="darwin")throw new n(`Instagram private story publish does not support auto-normalizing ${t.fileName} on ${process.platform}`,`Use images within ${v.toFixed(2)}-${A.toFixed(2)} aspect ratio, or use the UI route`);const r=N(e),i=b("sips",["--padToHeightWidth",String(a.height),String(a.width),"--padColor",R,e,"--out",r],{encoding:"utf8"});if(i.error||i.status!==0||!h.existsSync(r)){const o=[i.error?.message,i.stderr,i.stdout].map((s)=>String(s||"").trim()).filter(Boolean).join(" ");throw new n(`Instagram private story publish failed to normalize ${t.fileName}`,o||"sips padToHeightWidth failed")}return{...readImageAsset(r),cleanupPath:r}}function x(e,t,a){const r=u.join(S.tmpdir(),`opencli-instagram-${w.randomUUID()}.swift`);h.writeFileSync(r,e);try{const i=b("swift",[r,...t],{encoding:"utf8"});if(i.error||i.status!==0){const o=[i.error?.message,i.stderr,i.stdout].map((s)=>String(s||"").trim()).filter(Boolean).join(" ");throw new n(`Instagram private publish failed to ${a}`,o||"swift helper failed")}return JSON.parse(String(i.stdout||"{}"))}catch(i){if(i instanceof n)throw i;throw new n(`Instagram private publish failed to ${a}`,i instanceof Error?i.message:String(i))}finally{h.rmSync(r,{force:!0})}}function re(e){if(process.platform!=="darwin")throw new n(`Instagram private mixed-media publish does not support reading video metadata on ${process.platform}`,"Use macOS for private mixed-media publishing, or rely on the UI fallback");const t=x(`
|
|
2
2
|
import AVFoundation
|
|
3
3
|
import Foundation
|
|
4
4
|
|
|
@@ -20,7 +20,7 @@ let payload: [String: Int] = [
|
|
|
20
20
|
]
|
|
21
21
|
let data = try JSONSerialization.data(withJSONObject: payload, options: [])
|
|
22
22
|
FileHandle.standardOutput.write(data)
|
|
23
|
-
`,[
|
|
23
|
+
`,[e],"read video metadata");if(!t.width||!t.height||!t.durationMs)throw new n(`Instagram private publish failed to read video metadata for ${e}`);return{width:t.width,height:t.height,durationMs:t.durationMs}}function ie(e){const t=u.parse(e);return u.join(S.tmpdir(),`opencli-instagram-private-video-cover-${t.name}-${w.randomUUID()}.jpg`)}function oe(e){const t=u.parse(e);return u.join(S.tmpdir(),`opencli-instagram-story-video-${t.name}-${w.randomUUID()}${t.ext||".mp4"}`)}function ne(e){if(process.platform!=="darwin")throw new n(`Instagram private mixed-media publish does not support generating video covers on ${process.platform}`,"Use macOS for private mixed-media publishing, or rely on the UI fallback");const t=ie(e);x(`
|
|
24
24
|
import AVFoundation
|
|
25
25
|
import AppKit
|
|
26
26
|
import Foundation
|
|
@@ -40,7 +40,7 @@ try data.write(to: URL(fileURLWithPath: outputPath))
|
|
|
40
40
|
let payload = ["ok": true]
|
|
41
41
|
let json = try JSONSerialization.data(withJSONObject: payload, options: [])
|
|
42
42
|
FileHandle.standardOutput.write(json)
|
|
43
|
-
`,[
|
|
43
|
+
`,[e,t],"generate video cover");return{...readImageAsset(t),cleanupPath:t}}export function readVideoAsset(e){const t=h.readFileSync(e),a=re(e),r=ne(e);return{filePath:e,fileName:u.basename(e),mimeType:"video/mp4",width:a.width,height:a.height,durationMs:a.durationMs,byteLength:t.length,bytes:t,coverImage:r,cleanupPaths:r.cleanupPath?[r.cleanupPath]:[]}}function se(e,t){if(process.platform!=="darwin")throw new n(`Instagram private story publish does not support trimming long videos on ${process.platform}`,"Use macOS for private story video publishing, or trim the video to 15 seconds first");const a=oe(e);x(`
|
|
44
44
|
import AVFoundation
|
|
45
45
|
import Foundation
|
|
46
46
|
|
|
@@ -72,4 +72,4 @@ if exportSession.status != .completed {
|
|
|
72
72
|
let payload = ["ok": true]
|
|
73
73
|
let json = try JSONSerialization.data(withJSONObject: payload, options: [])
|
|
74
74
|
FileHandle.standardOutput.write(json)
|
|
75
|
-
`,[Q,Z,String(X)],"trim story video");return Z}function NQ(Q){const X=readVideoAsset(Q);if(X.durationMs<=I)return X;const Z=KQ(Q,I),$=readVideoAsset(Z);return{...$,cleanupPaths:[...$.cleanupPaths||[],Z]}}function P(Q){const X=Q();return X>10000000000?Math.floor(X/1000):Math.floor(X)}export function buildConfigureToStoryPhotoPayload(Q){const X=Q.now??(()=>Date.now()),Z=P(X);return{source_type:"4",upload_id:Q.uploadId,story_media_creation_date:String(Z-17),client_shared_at:String(Z-5),client_timestamp:String(Z),configure_mode:1,edits:{crop_original_size:[Q.width,Q.height],crop_center:[0,0],crop_zoom:1.3333334},extra:{source_width:Q.width,source_height:Q.height},jazoest:Q.jazoest}}export function buildConfigureToStoryVideoPayload(Q){const X=Q.now??(()=>Date.now()),Z=P(X),$=Number((Q.durationMs/1000).toFixed(3));return{source_type:"4",upload_id:Q.uploadId,story_media_creation_date:String(Z-17),client_shared_at:String(Z-5),client_timestamp:String(Z),configure_mode:1,poster_frame_index:0,length:$,audio_muted:!1,filter_type:"0",video_result:"deprecated",extra:{source_width:Q.width,source_height:Q.height},jazoest:Q.jazoest}}function LQ(Q){const X=new URLSearchParams;for(const[Z,$]of Object.entries(Q)){if($===void 0||$===null)continue;if(typeof $==="object"){X.set(Z,JSON.stringify($));continue}X.set(Z,String($))}return X.toString()}function b(Q){const X=JSON.stringify(Q),Z=L.createHmac("sha256",n).update(X).digest("hex"),$=new URLSearchParams;$.set("ig_sig_key_version",o);$.set("signed_body",`${Z}.${X}`);return $.toString()}function _(Q){return Object.fromEntries(Object.entries({"X-ASBD-ID":Q.asbdId,"X-CSRFToken":Q.csrfToken,"X-IG-App-ID":Q.igAppId,"X-IG-WWW-Claim":Q.igWwwClaim,"X-Instagram-AJAX":Q.instagramAjax,"X-Web-Session-ID":Q.webSessionId}).filter(([,X])=>!!X))}function OQ(Q,X,Z){return{..._(Z),Accept:"*/*","Content-Type":Q.mimeType,Offset:"0","X-Entity-Length":String(Q.byteLength),"X-Entity-Name":`fb_uploader_${X}`,"X-Entity-Type":Q.mimeType,"X-Instagram-Rupload-Params":JSON.stringify({media_type:1,upload_id:X,upload_media_height:Q.height,upload_media_width:Q.width})}}function m(Q){const X=Math.min(Q.width,Q.height),Z=Number((Q.durationMs/1000).toFixed(3));return{crop_height:X,crop_width:X,crop_x1:Math.max(0,Math.floor((Q.width-X)/2)),crop_y1:Math.max(0,Math.floor((Q.height-X)/2)),mute:!1,trim_end:Z,trim_start:0}}function WQ(Q,X,Z){return{..._(Z),Accept:"*/*",Offset:"0","X-Entity-Length":String(Q.byteLength),"X-Entity-Name":`fb_uploader_${X}`,"X-Instagram-Rupload-Params":JSON.stringify({"client-passthrough":"1",is_unified_video:"0",is_sidecar:"1",media_type:2,for_album:!1,video_format:"",upload_id:X,upload_media_duration_ms:Q.durationMs,upload_media_height:Q.height,upload_media_width:Q.width,video_transform:null,video_edit_params:m(Q)})}}function GQ(Q,X,Z){return{..._(Z),Accept:"*/*",Offset:"0","X-Entity-Length":String(Q.byteLength),"X-Entity-Name":`fb_uploader_${X}`,"X-Instagram-Rupload-Params":JSON.stringify({"client-passthrough":"1",media_type:2,upload_id:X,upload_media_duration_ms:Q.durationMs,upload_media_height:Q.height,upload_media_width:Q.width,video_transform:null,video_edit_params:m(Q)})}}function HQ(Q,X,Z){return{..._(Z),Accept:"*/*","Content-Type":Q.coverImage.mimeType,Offset:"0","X-Entity-Length":String(Q.coverImage.byteLength),"X-Entity-Name":`fb_uploader_${X}`,"X-Entity-Type":Q.coverImage.mimeType,"X-Instagram-Rupload-Params":JSON.stringify({media_type:2,upload_id:X,upload_media_height:Q.height,upload_media_width:Q.width})}}async function B(Q,X){const Z=await Q.text();let $;try{$=Z?JSON.parse(Z):{}}catch{throw new K(`Instagram private publish ${X} returned invalid JSON`)}if(!Q.ok){const q=Z?` ${Z.slice(0,500)}`:"";throw new K(`Instagram private publish ${X} failed: ${Q.status}${q}`)}return $}async function E(Q,X,Z){let $;for(let F=0;F<v;F+=1)try{return await Q(X,Z)}catch(N){$=N;if(!g(N)||F>=v-1){const W=explainPrivateNetworkError(N,X);if(W)throw new K(`Instagram private publish upload failed: ${W}`);throw N}}const q=explainPrivateNetworkError($,X);if(q)throw new K(`Instagram private publish upload failed: ${q}`);throw $ instanceof Error?$:Error(String($))}async function JQ(Q){if(Q.type==="video")return{type:"video",asset:readVideoAsset(Q.filePath)};return{type:"image",asset:prepareImageAssetForPrivateUpload(Q.filePath)}}function f(Q){for(const X of Q){if(X.type==="image"){if(X.asset.cleanupPath)U.rmSync(X.asset.cleanupPath,{force:!0});continue}for(const Z of X.asset.cleanupPaths||[])U.rmSync(Z,{force:!0});if(X.asset.coverImage.cleanupPath)U.rmSync(X.asset.coverImage.cleanupPath,{force:!0})}}async function c(Q,X,Z,$,q="feed"){if(X.type==="image"){const J=await E(Q,`https://i.instagram.com/rupload_igphoto/fb_uploader_${Z}`,{method:"POST",headers:OQ(X.asset,Z,$),body:X.asset.bytes}),G=await B(J,"upload");if(String(G?.status||"")!=="ok")throw new K(`Instagram private publish upload failed for ${X.asset.fileName}`);return}const F=await E(Q,`https://i.instagram.com/rupload_igvideo/fb_uploader_${Z}`,{method:"POST",headers:q==="story"?GQ(X.asset,Z,$):WQ(X.asset,Z,$),body:X.asset.bytes}),N=await B(F,"video upload");if(String(N?.status||"")!=="ok")throw new K(`Instagram private publish video upload failed for ${X.asset.fileName}`);const W=await E(Q,`https://i.instagram.com/rupload_igphoto/fb_uploader_${Z}`,{method:"POST",headers:HQ(X.asset,Z,$),body:X.asset.coverImage.bytes}),O=await B(W,"video cover upload");if(String(O?.status||"")!=="ok")throw new K(`Instagram private publish video cover upload failed for ${X.asset.fileName}`)}async function VQ(Q){const X=Q.waitMs??r,Z={method:"POST",headers:{..._(Q.apiContext),"Content-Type":"application/json"},body:JSON.stringify(Q.payload)};for(let $=0;$<w;$+=1){let q,F;try{q=await Q.fetcher("https://www.instagram.com/api/v1/media/configure_sidecar/",Z);F=await q.text()}catch(O){throw markPublishOutcomeUncertain(O instanceof Error?O:new K(`Instagram private publish configure_sidecar request failed: ${String(O)}`))}let N={};try{N=F?JSON.parse(F):{}}catch{throw markPublishOutcomeUncertain(new K("Instagram private publish configure_sidecar returned invalid JSON"))}if(!q.ok){const O=F?` ${F.slice(0,500)}`:"";throw markPublishOutcomeUncertain(new K(`Instagram private publish configure_sidecar failed: ${q.status}${O}`))}const W=String(N?.message||"");if(q.status===202||/transcode not finished yet/i.test(W)){if($>=w-1)throw markPublishOutcomeUncertain(new K("Instagram private publish configure_sidecar timed out waiting for video transcode",F.slice(0,500)));await X(d);continue}if(String(N?.status||"").toLowerCase()==="fail")throw new K("Instagram private publish configure_sidecar failed",W||F.slice(0,500));return{code:N?.media?.code,mediaId:String(N?.media?.id||"")}}throw new K("Instagram private publish configure_sidecar failed")}export async function publishMediaViaPrivateApi(Q){const X=Q.now??(()=>Date.now()),Z=String(X()),$=Q.mediaItems.length>1?Q.mediaItems.map((W,O)=>String(X()+O+1)):[String(X())],q=Q.fetcher??((W,O)=>S(Q.page,W,O)),F=Q.prepareMediaAsset??JQ,N=await Promise.all(Q.mediaItems.map((W)=>F(W)));try{for(let O=0;O<N.length;O+=1){const J=N[O],G=$[O];await c(q,J,G,Q.apiContext)}if($.length===1){if(N[0]?.type!=="image")throw new K("Instagram private publish only supports single-video uploads through instagram reel");let O;try{const J=await q("https://www.instagram.com/api/v1/media/configure/",{method:"POST",headers:{..._(Q.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:buildConfigureBody({uploadId:$[0],caption:Q.caption,jazoest:Q.jazoest})});O=await B(J,"configure")}catch(J){throw markPublishOutcomeUncertain(J instanceof Error?J:new K(`Instagram private publish configure request failed: ${String(J)}`))}return{code:O?.media?.code,mediaId:String(O?.media?.id||""),uploadIds:$}}const W=await VQ({fetcher:q,payload:buildConfigureSidecarPayload({uploadIds:$,caption:Q.caption,clientSidecarId:Z,jazoest:Q.jazoest}),apiContext:Q.apiContext,waitMs:Q.waitMs});return{code:W.code,mediaId:W.mediaId||"",uploadIds:$}}finally{f(N)}}export async function publishImagesViaPrivateApi(Q){return publishMediaViaPrivateApi({page:Q.page,mediaItems:Q.imagePaths.map((X)=>({type:"image",filePath:X})),caption:Q.caption,apiContext:Q.apiContext,jazoest:Q.jazoest,now:Q.now,fetcher:Q.fetcher,waitMs:Q.waitMs,prepareMediaAsset:Q.prepareAsset?async(X)=>({type:"image",asset:await Q.prepareAsset(X.filePath)}):void 0})}export async function publishStoryViaPrivateApi(Q){const X=Q.now??(()=>Date.now()),Z=String(X()),$=Q.fetcher??((G,H)=>S(Q.page,G,H)),F=await(Q.prepareMediaAsset??(async(G)=>G.type==="video"?{type:"video",asset:NQ(G.filePath)}:{type:"image",asset:prepareImageAssetForPrivateStoryUpload(G.filePath)}))(Q.mediaItem),N=Q.currentUserId||("getCookies"in Q.page?String((await(Q.page.getCookies?.({domain:"instagram.com"})??Promise.resolve([]))).find((G)=>G.name==="ds_user_id")?.value||""):"");if(!N)throw new K("Instagram story publish could not derive current user id from browser session");const W={_csrftoken:Q.apiContext.csrfToken,_uid:N,_uuid:L.randomUUID(),device:p},O=(G,H)=>b({...buildConfigureToStoryPhotoPayload({uploadId:Z,width:G,height:H,now:X,jazoest:Q.jazoest}),...W}),J=(G,H,Y)=>b({...buildConfigureToStoryVideoPayload({uploadId:Z,width:G,height:H,durationMs:Y,now:X,jazoest:Q.jazoest}),...W});try{await c($,F,Z,Q.apiContext,"story");if(F.type==="image"){let H;try{const Y=await $("https://i.instagram.com/api/v1/media/configure_to_story/",{method:"POST",headers:{..._(Q.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:O(F.asset.width,F.asset.height)});H=await B(Y,"configure_to_story")}catch(Y){throw markPublishOutcomeUncertain(Y instanceof Error?Y:new K(`Instagram private publish configure_to_story request failed: ${String(Y)}`))}return{mediaPk:String(H?.media?.pk||H?.media?.id||"").split("_")[0]||void 0,uploadId:Z}}let G;try{await B(await $("https://i.instagram.com/api/v1/media/configure_to_story/",{method:"POST",headers:{..._(Q.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:O(F.asset.width,F.asset.height)}),"configure_to_story cover");const H=await $("https://i.instagram.com/api/v1/media/configure_to_story/?video=1",{method:"POST",headers:{..._(Q.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:J(F.asset.width,F.asset.height,F.asset.durationMs)});G=await B(H,"configure_to_story")}catch(H){throw markPublishOutcomeUncertain(H instanceof Error?H:new K(`Instagram private publish configure_to_story request failed: ${String(H)}`))}return{mediaPk:String(G?.media?.pk||G?.media?.id||"").split("_")[0]||void 0,uploadId:Z}}finally{f([F])}}
|
|
75
|
+
`,[e,a,String(t)],"trim story video");return a}function de(e){const t=readVideoAsset(e);if(t.durationMs<=O)return t;const a=se(e,O),r=readVideoAsset(a);return{...r,cleanupPaths:[...r.cleanupPaths||[],a]}}function k(e){const t=e();return t>10000000000?Math.floor(t/1000):Math.floor(t)}export function buildConfigureToStoryPhotoPayload(e){const t=e.now??(()=>Date.now()),a=k(t);return{source_type:"4",upload_id:e.uploadId,story_media_creation_date:String(a-17),client_shared_at:String(a-5),client_timestamp:String(a),configure_mode:1,edits:{crop_original_size:[e.width,e.height],crop_center:[0,0],crop_zoom:1.3333334},extra:{source_width:e.width,source_height:e.height},jazoest:e.jazoest}}export function buildConfigureToStoryVideoPayload(e){const t=e.now??(()=>Date.now()),a=k(t),r=Number((e.durationMs/1000).toFixed(3));return{source_type:"4",upload_id:e.uploadId,story_media_creation_date:String(a-17),client_shared_at:String(a-5),client_timestamp:String(a),configure_mode:1,poster_frame_index:0,length:r,audio_muted:!1,filter_type:"0",video_result:"deprecated",extra:{source_width:e.width,source_height:e.height},jazoest:e.jazoest}}function Se(e){const t=new URLSearchParams;for(const[a,r]of Object.entries(e)){if(r===void 0||r===null)continue;if(typeof r==="object"){t.set(a,JSON.stringify(r));continue}t.set(a,String(r))}return t.toString()}function j(e){const t=JSON.stringify(e),a=w.createHmac("sha256",J).update(t).digest("hex"),r=new URLSearchParams;r.set("ig_sig_key_version",B);r.set("signed_body",`${a}.${t}`);return r.toString()}function g(e){return Object.fromEntries(Object.entries({"X-ASBD-ID":e.asbdId,"X-CSRFToken":e.csrfToken,"X-IG-App-ID":e.igAppId,"X-IG-WWW-Claim":e.igWwwClaim,"X-Instagram-AJAX":e.instagramAjax,"X-Web-Session-ID":e.webSessionId}).filter(([,t])=>!!t))}function ce(e,t,a){return{...g(a),Accept:"*/*","Content-Type":e.mimeType,Offset:"0","X-Entity-Length":String(e.byteLength),"X-Entity-Name":`fb_uploader_${t}`,"X-Entity-Type":e.mimeType,"X-Instagram-Rupload-Params":JSON.stringify({media_type:1,upload_id:t,upload_media_height:e.height,upload_media_width:e.width})}}function D(e){const t=Math.min(e.width,e.height),a=Number((e.durationMs/1000).toFixed(3));return{crop_height:t,crop_width:t,crop_x1:Math.max(0,Math.floor((e.width-t)/2)),crop_y1:Math.max(0,Math.floor((e.height-t)/2)),mute:!1,trim_end:a,trim_start:0}}function pe(e,t,a){return{...g(a),Accept:"*/*",Offset:"0","X-Entity-Length":String(e.byteLength),"X-Entity-Name":`fb_uploader_${t}`,"X-Instagram-Rupload-Params":JSON.stringify({"client-passthrough":"1",is_unified_video:"0",is_sidecar:"1",media_type:2,for_album:!1,video_format:"",upload_id:t,upload_media_duration_ms:e.durationMs,upload_media_height:e.height,upload_media_width:e.width,video_transform:null,video_edit_params:D(e)})}}function me(e,t,a){return{...g(a),Accept:"*/*",Offset:"0","X-Entity-Length":String(e.byteLength),"X-Entity-Name":`fb_uploader_${t}`,"X-Instagram-Rupload-Params":JSON.stringify({"client-passthrough":"1",media_type:2,upload_id:t,upload_media_duration_ms:e.durationMs,upload_media_height:e.height,upload_media_width:e.width,video_transform:null,video_edit_params:D(e)})}}function le(e,t,a){return{...g(a),Accept:"*/*","Content-Type":e.coverImage.mimeType,Offset:"0","X-Entity-Length":String(e.coverImage.byteLength),"X-Entity-Name":`fb_uploader_${t}`,"X-Entity-Type":e.coverImage.mimeType,"X-Instagram-Rupload-Params":JSON.stringify({media_type:2,upload_id:t,upload_media_height:e.height,upload_media_width:e.width})}}async function _(e,t){const a=await e.text();let r;try{r=a?JSON.parse(a):{}}catch{throw new n(`Instagram private publish ${t} returned invalid JSON`)}if(!e.ok){const i=a?` ${a.slice(0,500)}`:"";throw new n(`Instagram private publish ${t} failed: ${e.status}${i}`)}return r}async function T(e,t,a){let r;for(let o=0;o<E;o+=1)try{return await e(t,a)}catch(s){r=s;if(!U(s)||o>=E-1){const c=explainPrivateNetworkError(s,t);if(c)throw new n(`Instagram private publish upload failed: ${c}`);throw s}}const i=explainPrivateNetworkError(r,t);if(i)throw new n(`Instagram private publish upload failed: ${i}`);throw r instanceof Error?r:Error(String(r))}async function ue(e){if(e.type==="video")return{type:"video",asset:readVideoAsset(e.filePath)};return{type:"image",asset:prepareImageAssetForPrivateUpload(e.filePath)}}function F(e){for(const t of e){if(t.type==="image"){if(t.asset.cleanupPath)h.rmSync(t.asset.cleanupPath,{force:!0});continue}for(const a of t.asset.cleanupPaths||[])h.rmSync(a,{force:!0});if(t.asset.coverImage.cleanupPath)h.rmSync(t.asset.coverImage.cleanupPath,{force:!0})}}async function X(e,t,a,r,i="feed"){if(t.type==="image"){const l=await T(e,`https://i.instagram.com/rupload_igphoto/fb_uploader_${a}`,{method:"POST",headers:ce(t.asset,a,r),body:t.asset.bytes}),p=await _(l,"upload");if(String(p?.status||"")!=="ok")throw new n(`Instagram private publish upload failed for ${t.asset.fileName}`);return}const o=await T(e,`https://i.instagram.com/rupload_igvideo/fb_uploader_${a}`,{method:"POST",headers:i==="story"?me(t.asset,a,r):pe(t.asset,a,r),body:t.asset.bytes}),s=await _(o,"video upload");if(String(s?.status||"")!=="ok")throw new n(`Instagram private publish video upload failed for ${t.asset.fileName}`);const c=await T(e,`https://i.instagram.com/rupload_igphoto/fb_uploader_${a}`,{method:"POST",headers:le(t.asset,a,r),body:t.asset.coverImage.bytes}),d=await _(c,"video cover upload");if(String(d?.status||"")!=="ok")throw new n(`Instagram private publish video cover upload failed for ${t.asset.fileName}`)}async function fe(e){const t=e.waitMs??q,a={method:"POST",headers:{...g(e.apiContext),"Content-Type":"application/json"},body:JSON.stringify(e.payload)};for(let r=0;r<M;r+=1){let i,o;try{i=await e.fetcher("https://www.instagram.com/api/v1/media/configure_sidecar/",a);o=await i.text()}catch(d){throw markPublishOutcomeUncertain(d instanceof Error?d:new n(`Instagram private publish configure_sidecar request failed: ${String(d)}`))}let s={};try{s=o?JSON.parse(o):{}}catch{throw markPublishOutcomeUncertain(new n("Instagram private publish configure_sidecar returned invalid JSON"))}if(!i.ok){const d=o?` ${o.slice(0,500)}`:"";throw markPublishOutcomeUncertain(new n(`Instagram private publish configure_sidecar failed: ${i.status}${d}`))}const c=String(s?.message||"");if(i.status===202||/transcode not finished yet/i.test(c)){if(r>=M-1)throw markPublishOutcomeUncertain(new n("Instagram private publish configure_sidecar timed out waiting for video transcode",o.slice(0,500)));await t(G);continue}if(String(s?.status||"").toLowerCase()==="fail")throw new n("Instagram private publish configure_sidecar failed",c||o.slice(0,500));return{code:s?.media?.code,mediaId:String(s?.media?.id||"")}}throw new n("Instagram private publish configure_sidecar failed")}export async function publishMediaViaPrivateApi(e){const t=e.now??(()=>Date.now()),a=String(t()),r=e.mediaItems.length>1?e.mediaItems.map((c,d)=>String(t()+d+1)):[String(t())],i=e.fetcher??((c,d)=>P(e.page,c,d)),o=e.prepareMediaAsset??ue,s=await Promise.all(e.mediaItems.map((c)=>o(c)));try{for(let d=0;d<s.length;d+=1){const l=s[d],p=r[d];await X(i,l,p,e.apiContext)}if(r.length===1){if(s[0]?.type!=="image")throw new n("Instagram private publish only supports single-video uploads through instagram reel");let d;try{const l=await i("https://www.instagram.com/api/v1/media/configure/",{method:"POST",headers:{...g(e.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:buildConfigureBody({uploadId:r[0],caption:e.caption,jazoest:e.jazoest})});d=await _(l,"configure")}catch(l){throw markPublishOutcomeUncertain(l instanceof Error?l:new n(`Instagram private publish configure request failed: ${String(l)}`))}return{code:d?.media?.code,mediaId:String(d?.media?.id||""),uploadIds:r}}const c=await fe({fetcher:i,payload:buildConfigureSidecarPayload({uploadIds:r,caption:e.caption,clientSidecarId:a,jazoest:e.jazoest}),apiContext:e.apiContext,waitMs:e.waitMs});return{code:c.code,mediaId:c.mediaId||"",uploadIds:r}}finally{F(s)}}export async function publishImagesViaPrivateApi(e){return publishMediaViaPrivateApi({page:e.page,mediaItems:e.imagePaths.map((t)=>({type:"image",filePath:t})),caption:e.caption,apiContext:e.apiContext,jazoest:e.jazoest,now:e.now,fetcher:e.fetcher,waitMs:e.waitMs,prepareMediaAsset:e.prepareAsset?async(t)=>({type:"image",asset:await e.prepareAsset(t.filePath)}):void 0})}export async function publishStoryViaPrivateApi(e){const t=e.now??(()=>Date.now()),a=String(t()),r=e.fetcher??((p,m)=>P(e.page,p,m)),o=await(e.prepareMediaAsset??(async(p)=>p.type==="video"?{type:"video",asset:de(p.filePath)}:{type:"image",asset:prepareImageAssetForPrivateStoryUpload(p.filePath)}))(e.mediaItem),s=e.currentUserId||("getCookies"in e.page?String((await(e.page.getCookies?.({domain:"instagram.com"})??Promise.resolve([]))).find((p)=>p.name==="ds_user_id")?.value||""):"");if(!s)throw new n("Instagram story publish could not derive current user id from browser session");const c={_csrftoken:e.apiContext.csrfToken,_uid:s,_uuid:w.randomUUID(),device:H},d=(p,m)=>j({...buildConfigureToStoryPhotoPayload({uploadId:a,width:p,height:m,now:t,jazoest:e.jazoest}),...c}),l=(p,m,f)=>j({...buildConfigureToStoryVideoPayload({uploadId:a,width:p,height:m,durationMs:f,now:t,jazoest:e.jazoest}),...c});try{await X(r,o,a,e.apiContext,"story");if(o.type==="image"){let m;try{const f=await r("https://i.instagram.com/api/v1/media/configure_to_story/",{method:"POST",headers:{...g(e.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:d(o.asset.width,o.asset.height)});m=await _(f,"configure_to_story")}catch(f){throw markPublishOutcomeUncertain(f instanceof Error?f:new n(`Instagram private publish configure_to_story request failed: ${String(f)}`))}return{mediaPk:String(m?.media?.pk||m?.media?.id||"").split("_")[0]||void 0,uploadId:a}}let p;try{await _(await r("https://i.instagram.com/api/v1/media/configure_to_story/",{method:"POST",headers:{...g(e.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:d(o.asset.width,o.asset.height)}),"configure_to_story cover");const m=await r("https://i.instagram.com/api/v1/media/configure_to_story/?video=1",{method:"POST",headers:{...g(e.apiContext),"Content-Type":"application/x-www-form-urlencoded"},body:l(o.asset.width,o.asset.height,o.asset.durationMs)});p=await _(m,"configure_to_story")}catch(m){throw markPublishOutcomeUncertain(m instanceof Error?m:new n(`Instagram private publish configure_to_story request failed: ${String(m)}`))}return{mediaPk:String(p?.media?.pk||p?.media?.id||"").split("_")[0]||void 0,uploadId:a}}finally{F([o])}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as _ from"node:fs";import{resolveInstagramRuntimeInfo as g}from"./runtime-info.js";const p="__opencli_ig_protocol_capture",c="__opencli_ig_protocol_capture_errors",m="/tmp/instagram_post_protocol_trace.json",R=["/rupload_igphoto/","/rupload_igvideo/","/api/v1/","/media/configure/","/media/configure_sidecar/","/media/configure_to_story/","/api/graphql/"].join("|");export function buildInstallInstagramProtocolCaptureJs(t=p,e=c){return`
|
|
2
2
|
(() => {
|
|
3
|
-
const CAPTURE_VAR = ${JSON.stringify(
|
|
4
|
-
const CAPTURE_ERRORS_VAR = ${JSON.stringify(
|
|
3
|
+
const CAPTURE_VAR = ${JSON.stringify(t)};
|
|
4
|
+
const CAPTURE_ERRORS_VAR = ${JSON.stringify(e)};
|
|
5
5
|
const PATCH_GUARD = CAPTURE_VAR + '_patched';
|
|
6
6
|
const FILTERS = [
|
|
7
7
|
'/rupload_igphoto/',
|
|
@@ -169,12 +169,12 @@ import*as U from"node:fs";import{resolveInstagramRuntimeInfo as W}from"./runtime
|
|
|
169
169
|
window[PATCH_GUARD] = true;
|
|
170
170
|
return { ok: true };
|
|
171
171
|
})()
|
|
172
|
-
`}export function buildReadInstagramProtocolCaptureJs(
|
|
172
|
+
`}export function buildReadInstagramProtocolCaptureJs(t=p,e=c){return`
|
|
173
173
|
(() => {
|
|
174
|
-
const data = Array.isArray(window[${JSON.stringify(
|
|
175
|
-
const errors = Array.isArray(window[${JSON.stringify(
|
|
176
|
-
window[${JSON.stringify(
|
|
177
|
-
window[${JSON.stringify(
|
|
174
|
+
const data = Array.isArray(window[${JSON.stringify(t)}]) ? window[${JSON.stringify(t)}] : [];
|
|
175
|
+
const errors = Array.isArray(window[${JSON.stringify(e)}]) ? window[${JSON.stringify(e)}] : [];
|
|
176
|
+
window[${JSON.stringify(t)}] = [];
|
|
177
|
+
window[${JSON.stringify(e)}] = [];
|
|
178
178
|
return { data, errors };
|
|
179
179
|
})()
|
|
180
|
-
`}export async function installInstagramProtocolCapture(
|
|
180
|
+
`}export async function installInstagramProtocolCapture(t){if(typeof t.startNetworkCapture==="function")try{await t.startNetworkCapture(R);return}catch(e){const r=e instanceof Error?e.message:String(e);if(!r.includes("Unknown action")&&!r.includes("network-capture"))throw e}await t.evaluate(buildInstallInstagramProtocolCaptureJs())}export async function readInstagramProtocolCapture(t){if(typeof t.readNetworkCapture==="function")try{const r=await t.readNetworkCapture();return{data:Array.isArray(r)?r:[],errors:[]}}catch(r){const n=r instanceof Error?r.message:String(r);if(!n.includes("Unknown action")&&!n.includes("network-capture"))throw r}const e=await t.evaluate(buildReadInstagramProtocolCaptureJs());return{data:Array.isArray(e?.data)?e.data:[],errors:Array.isArray(e?.errors)?e.errors:[]}}export async function dumpInstagramProtocolCaptureIfEnabled(t){if(process.env.OPENCLI_INSTAGRAM_CAPTURE!=="1")return;const e=await readInstagramProtocolCapture(t);_.writeFileSync(m,JSON.stringify(e,null,2))}function A(t){return t.filter((e)=>e?.name&&e?.value).map((e)=>`${e.name}=${e.value}`).join("; ")}export async function instagramPrivateApiFetch(t,e,r={}){const n=String(e),[y,l]=await Promise.all([t.getCookies({url:n}),t.getCookies({domain:"instagram.com"})]),i=new Map;for(const o of l)i.set(o.name,o);for(const o of y)i.set(o.name,o);const s=A(Array.from(i.values())),f=i.get("csrftoken")?.value||"",a=r.headers??{},d=Object.entries(a).find(([o])=>o.toLowerCase()==="x-ig-app-id")?.[1]||"",h=d?null:await g(t),u=d||h?.appId||"",w=Object.keys(r.headers??{}).some((o)=>o.toLowerCase()==="content-type");return fetch(n,{method:r.method??"GET",headers:{Accept:"application/json, text/plain, */*","X-CSRFToken":f,"X-Requested-With":"XMLHttpRequest",Origin:"https://www.instagram.com",Referer:"https://www.instagram.com/",...u?{"X-IG-App-ID":u}:{},...s?{Cookie:s}:{},...typeof r.body==="string"&&!w?{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}:{},...a},...r.body!==void 0?{body:r.body}:{}})}
|
package/clis/instagram/detail.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{cli as
|
|
2
|
-
`).trim()}function
|
|
3
|
-
`),thumbnail_url:String(
|
|
1
|
+
import{cli as _,Strategy as p}from"@jackwener/opencli/registry";import{CommandExecutionError as s}from"@jackwener/opencli/errors";import{buildInstagramFetchScript as g,ensurePage as f,handleFetchFailure as w,normalizeFetchResult as h,parseInstagramMediaTarget as y}from"./download.js";function v(t){return String(t||"").replace(/\s+/g," ").trim()}function b(t){return String(t||"").replace(/\r\n?/g,`
|
|
2
|
+
`).trim()}function u(t){const e=Number(t||0);return Number.isFinite(e)&&e>0?new Date(e*1000).toISOString():""}function N(t){if(!t||typeof t!=="object")return null;const e=t.is_video===!0,r=String(e?t.video_url||"":t.display_url||"").trim();if(!r)return null;return{kind:e?"video":"image",url:r}}function l(t){const e=Array.isArray(t?.edge_sidecar_to_children?.edges)?t.edge_sidecar_to_children.edges.map((n)=>n?.node).filter(Boolean):[];return(e.length>0?e:[t]).map(N).filter(Boolean)}function S(t,e){const r=String(e?.product_type||"").toLowerCase();if(r==="clips"||r==="reel"||t==="reel")return"reel";return t||"p"}function k(t){if(t.length>1)return"carousel";return t[0]?.kind||""}function c(t){const e=Number(t?.count??0);return Number.isFinite(e)?e:0}function F(t){const e=t?.edge_media_to_caption?.edges?.[0]?.node?.text||"";return b(e)}function d(t,e){if(!e||typeof e!=="object")throw new s("Instagram returned malformed media detail payload");const r=String(e.shortcode||t.shortcode||"").trim(),n=String(e.id||"").trim(),o=String(e?.owner?.username||"").trim();if(!r||!n||!o)throw new s("Instagram returned malformed media detail payload");const i=l(e);if(i.length===0)throw new s("Instagram detail payload did not contain any media URLs");const m=S(t.kind,e);return{shortcode:r,media_id:n,kind:m,type:k(i),posted_at:u(e.taken_at_timestamp),owner:o,owner_name:String(e?.owner?.full_name||"").trim(),owner_verified:e?.owner?.is_verified?"Yes":"No",caption:F(e),likes:c(e?.edge_media_preview_like),comments:c(e?.edge_media_to_comment)||c(e?.edge_media_to_parent_comment),views:Number.isFinite(Number(e?.video_view_count))?Number(e.video_view_count):Number.isFinite(Number(e?.video_play_count))?Number(e.video_play_count):"",media_count:i.length,media_types:i.map((a)=>a.kind).join(", "),media_urls:i.map((a)=>a.url).join(`
|
|
3
|
+
`),thumbnail_url:String(e.display_url||"").trim(),url:t.canonicalUrl}}_({site:"instagram",name:"detail",access:"read",description:"Get single-post Instagram details, including direct media URLs",domain:"www.instagram.com",strategy:p.COOKIE,navigateBefore:!1,args:[{name:"url",positional:!0,required:!0,help:"Instagram post / reel / tv URL"}],columns:["shortcode","media_id","kind","type","posted_at","owner","owner_name","owner_verified","likes","comments","views","media_count","media_types","media_urls","thumbnail_url","url","caption"],func:async(t,e)=>{const r=f(t),n=y(String(e.url??""));await r.goto(n.canonicalUrl);const o=h(await r.evaluate(g(n.shortcode)));if(!o.ok)w(o);return[d(n,o.media)]},__test__:{normalizeCaptionText:v,formatPostedAt:u,normalizeMediaNodes:l,normalizeDetailRow:d}});
|
package/clis/instagram/post.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as U from"node:fs";import*as O from"node:path";import{cli as Y,Strategy as Z}from"@jackwener/opencli/registry";import{ArgumentError as p,AuthRequiredError as C,CommandExecutionError as i}from"@jackwener/opencli/errors";import{installInstagramProtocolCapture as ee,readInstagramProtocolCapture as te}from"./_shared/protocol-capture.js";import{publishMediaViaPrivateApi as ae,publishImagesViaPrivateApi as ne,resolveInstagramPrivatePublishConfig as re,isPublishOutcomeUncertain as oe}from"./_shared/private-publish.js";import{resolveInstagramRuntimeInfo as ie}from"./_shared/runtime-info.js";import{setInputFiles as se}from"../_shared/file-inject.js";const m="https://www.instagram.com/",le=new Set([".jpg",".jpeg",".png",".webp"]),ce=new Set([".mp4"]),A=10,de="/tmp/instagram_post_protocol_trace.json";async function I(e,t=!1){if(t){await e.goto(`${m}?__opencli_reset=${Date.now()}`);await e.wait({time:1})}await e.goto(m)}export function buildEnsureComposerOpenJs(){return`
|
|
2
2
|
(() => {
|
|
3
3
|
const path = window.location?.pathname || '';
|
|
4
4
|
const onLoginRoute = /\\/accounts\\/login\\/?/.test(path);
|
|
@@ -61,7 +61,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
61
61
|
const settled = !shared && !composerOpen && !/sharing/.test(visibleText);
|
|
62
62
|
return { ok: shared, failed, settled, url: /\\/p\\//.test(url) ? url : '' };
|
|
63
63
|
})()
|
|
64
|
-
`}function
|
|
64
|
+
`}function ue(e){if(!e)throw new i("Browser session required for instagram post");return e}function fe(e){if(!e.length)throw new p('Argument "media" is required.',"Provide --media /path/to/file.jpg or --media /path/a.jpg,/path/b.mp4");if(e.length>A)throw new p(`Too many media items: ${e.length}`,`Instagram carousel posts support at most ${A} items`);return e.map((a)=>{const n=O.resolve(String(a||"").trim());if(!n)throw new p("Media path cannot be empty");if(!U.existsSync(n))throw new p(`Media file not found: ${n}`);const r=O.extname(n).toLowerCase();if(le.has(r))return{type:"image",filePath:n};if(ce.has(r))return{type:"video",filePath:n};throw new p(`Unsupported media format: ${r}`,"Supported formats: images (.jpg, .jpeg, .png, .webp) and videos (.mp4)")})}function pe(e){const t=String(e.media??"").trim();return fe(t.split(",").map((a)=>a.trim()).filter(Boolean))}const P=2200;function ge(e){if(e.media===void 0)throw new p('Argument "media" is required.',"Provide --media /path/to/file.jpg or --media /path/a.jpg,/path/b.mp4");D(e.content)}function D(e){const t=[...String(e??"")].length;if(t>P)throw new p(`Instagram caption is too long: ${t} characters (limit ${P}).`,`Shorten the caption by ${t-P} characters. Nothing was uploaded or posted.`)}function me(e){const t=e instanceof Error?e.message:String(e);return/failed to normalize/i.test(t)||/caption_too_long|caption too long/i.test(t)}function he(e){if(!(e instanceof i))return!1;if(me(e))return!1;return e.message.startsWith("Instagram private publish")||e.message.startsWith("Instagram private route")}function E(e,t,a=""){return[{status:"✅ Posted",detail:Ee(e),url:t,media_id:String(a||""),account_id:String(a||"").split("_")[1]||""}]}function we(e,t){const a=e instanceof Error?e.message:String(e),n=t instanceof Error?t.message:String(t);return`Private route failed first: ${a}. UI fallback then failed: ${n}`}function ye(e,t){const a=e instanceof Error?e.message:String(e),n=t instanceof Error?t.message:String(t);return`Instagram publish failed. Cause (private API route): ${a}`+` — the UI fallback then also failed with: ${n}`}async function be(e){const t=await re(e.page),a=e.mediaItems.every((r)=>r.type==="image")?await ne({page:e.page,imagePaths:e.mediaItems.map((r)=>r.filePath),caption:e.content,apiContext:t.apiContext,jazoest:t.jazoest}):await ae({page:e.page,mediaItems:e.mediaItems,caption:e.content,apiContext:t.apiContext,jazoest:t.jazoest}),n=a.code?new URL(`/p/${a.code}/`,m).toString():e.canDiffProfile?await k(e.page,e.existingPostPaths):"";return E(e.mediaItems,n,a.mediaId)}async function xe(e){let t,a=null;for(let n=0;n<e.commandAttemptBudget;n++){let r=!1;try{await I(e.page,e.forceFreshStart||n>0);await e.installProtocolCapture();await e.page.wait({time:2});await b(e.page);await T(e.page);const o=await V(e.page,e.mediaItems);if(e.preUploadDelaySeconds>0)await e.page.wait({time:e.preUploadDelaySeconds});let l=!1,s=null;for(const f of o){let h=f;for(let w=0;w<e.uploadAttemptBudget;w++){await Ce(e.page,e.mediaItems,h);const y=await H(e.page,e.previewProbeWindowSeconds);if(y.state==="preview"){l=!0;break}if(y.state==="failed"){s=S(y.detail);for(let v=0;v<e.inlineUploadRetryBudget;v++){if(!await qe(e.page))break;await e.page.wait({time:3});const g=await H(e.page,Math.max(3,Math.floor(e.previewProbeWindowSeconds/2)));if(g.state==="preview"){l=!0;break}if(g.state!=="failed")break}if(l)break;await Me(e.page);await b(e.page);if(w<e.uploadAttemptBudget-1){try{await e.drainProtocolCapture();await I(e.page,!0);await e.installProtocolCapture();await e.page.wait({time:2});await b(e.page);await T(e.page);h=await B(e.page,h,e.mediaItems);if(e.preUploadDelaySeconds>0)await e.page.wait({time:e.preUploadDelaySeconds})}catch{throw s}await e.page.wait({time:1.5});continue}break}break}if(l)break}if(!l){if(s)throw s;await Ne(e.page,e.finalPreviewWaitSeconds)}try{await Ue(e.page)}catch(f){await Oe(e.page,f)}if(e.content){await Ve(e.page,e.content);await He(e.page,e.content)}if(e.preShareDelaySeconds>0)await e.page.wait({time:e.preShareDelaySeconds});await j(e.page,["Share","分享"],"caption");r=!0;let d="";try{d=await W(e.page)}catch(f){if(f instanceof i&&f.message==="Instagram post share failed"&&await Re(e.page)){await e.page.wait({time:Math.max(2,e.preShareDelaySeconds)});d=await W(e.page)}else throw f}await e.drainProtocolCapture();if(!d&&e.canDiffProfile)d=await k(e.page,e.existingPostPaths);return E(e.mediaItems,d)}catch(o){t=o;if(o instanceof i&&o.message!=="Failed to open Instagram post composer")a=o;if(o instanceof C)throw o;if(r){let s="";if(e.canDiffProfile)try{s=await k(e.page,e.existingPostPaths)}catch{}if(s)return E(e.mediaItems,s);const d=o instanceof Error?o.message:String(o);throw new i(`Instagram share was clicked but the outcome could not be confirmed: ${d}`,"The post may already be live. Do NOT rerun this command blindly — open the profile (or rerun after checking) and confirm no new post exists first; retrying on a false failure creates a duplicate post.")}if(!(o instanceof i)||n===e.commandAttemptBudget-1){if(o instanceof i&&o.message==="Failed to open Instagram post composer"&&a)throw a;throw o}let l=!1;if(e.mediaItems.length>=10&&e.page.closeWindow)try{await e.drainProtocolCapture();await e.page.closeWindow();l=!0}catch{}if(!l){await b(e.page);await e.page.wait({time:1})}}}throw t instanceof Error?t:new i("Instagram post failed")}async function T(e){const t=await e.evaluate(buildEnsureComposerOpenJs());if(!t?.ok){if(t?.reason==="auth")throw new C("www.instagram.com","Instagram login required before posting");throw new i("Failed to open Instagram post composer")}}async function b(e){for(let t=0;t<4;t++){if(!(await e.evaluate(`
|
|
65
65
|
(() => {
|
|
66
66
|
const isVisible = (el) => {
|
|
67
67
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -105,7 +105,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
105
105
|
|
|
106
106
|
return { ok: false };
|
|
107
107
|
})()
|
|
108
|
-
`))?.ok)return;await
|
|
108
|
+
`))?.ok)return;await e.wait({time:0.5})}}async function _(e,t){const a=t.some((r)=>r.type==="video"),n=await e.evaluate(`
|
|
109
109
|
((includesVideo) => {
|
|
110
110
|
const isVisible = (el) => {
|
|
111
111
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -164,10 +164,10 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
164
164
|
return '[data-opencli-ig-upload-index="' + index + '"]';
|
|
165
165
|
});
|
|
166
166
|
return { ok: true, selectors };
|
|
167
|
-
})(${JSON.stringify(
|
|
168
|
-
`);if(!
|
|
167
|
+
})(${JSON.stringify(a)})
|
|
168
|
+
`);if(!n?.ok||!n.selectors?.length)throw new i("Instagram upload input not found","Open the new-post composer in a logged-in browser session and retry");return n.selectors}async function V(e,t){try{return await _(e,t)}catch(a){if(!(a instanceof i)||!a.message.includes("upload input not found"))throw a;await T(e);await e.wait({time:1.5});try{return await _(e,t)}catch(n){if(!(n instanceof i)||!n.message.includes("upload input not found"))throw n;await I(e,!0);await e.wait({time:2});await b(e);await T(e);await e.wait({time:2});return _(e,t)}}}function Se(e){const t=e.match(/data-opencli-ig-upload-index="(\d+)"/);if(!t)return null;const a=Number.parseInt(t[1]||"",10);return Number.isNaN(a)?null:a}async function B(e,t,a){const n=await V(e,a),r=Se(t);if(r!==null&&n[r])return n[r];return n[0]||t}async function ve(e,t){await e.evaluate(`
|
|
169
169
|
(() => {
|
|
170
|
-
const input = document.querySelector(${JSON.stringify(
|
|
170
|
+
const input = document.querySelector(${JSON.stringify(t)});
|
|
171
171
|
if (!(input instanceof HTMLInputElement)) return { ok: false };
|
|
172
172
|
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
173
173
|
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
@@ -208,7 +208,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
208
208
|
if (failed) return { state: 'failed', detail: dialogText || 'Something went wrong' };
|
|
209
209
|
return { state: 'pending', detail: dialogText || '' };
|
|
210
210
|
})()
|
|
211
|
-
`}async function
|
|
211
|
+
`}async function x(e){const t=await e.evaluate(buildInspectUploadStageJs());if(t?.state)return t;if(t?.ok===!0)return{state:"preview",detail:t.detail};return{state:"pending",detail:t?.detail}}function S(e){return new i("Instagram image upload failed",e?`Instagram rejected the upload: ${e}`:"Instagram rejected the upload before the preview stage")}async function Ce(e,t,a){const n=t.map((o)=>o.filePath);let r=a;for(let o=0;o<2;o++)try{if((await se(e,r,n)).method==="cdp")await ve(e,r);return}catch(l){const s=l instanceof Error?l.message:String(l);if((s.includes("No element found matching selector")||s.includes("Could not find node with given id")||s.includes("No node with given id found")||s.includes("未找到可用的文件上传输入框"))&&o===0){r=await B(e,r,t);continue}throw l}}function Ee(e){if(e.every((t)=>t.type==="image"))return e.length===1?"Single image post shared successfully":`${e.length}-image carousel post shared successfully`;return e.length===1?"Single mixed-media post shared successfully":`${e.length}-item mixed-media carousel post shared successfully`}function Te(e){if(e.length>=10)return 6;if(e.length>=5)return 4;return 3}function ke(e){if(e.length>=10)return 3;if(e.length>=5)return 1.5;return 0}function Ae(e){if(e.length>=10)return 3;if(e.length>=5)return 3;return 2}function Ie(e){if(e.length>=10)return 6;if(e.length>=5)return 6;return 4}function Pe(e){if(e.length>=10)return 12;if(e.length>=5)return 16;return 12}function _e(e){if(e.length>=10)return 4;if(e.length>=5)return 3;return 0}function Le(e){if(e.length>=10)return 3;if(e.length>=5)return 2;return 1}async function Me(e){return!!(await e.evaluate(`
|
|
212
212
|
(() => {
|
|
213
213
|
const isVisible = (el) => {
|
|
214
214
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -231,7 +231,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
231
231
|
}
|
|
232
232
|
return { ok: false };
|
|
233
233
|
})()
|
|
234
|
-
`))?.ok}async function
|
|
234
|
+
`))?.ok}async function qe(e){return!!(await e.evaluate(`
|
|
235
235
|
(() => {
|
|
236
236
|
const isVisible = (el) => {
|
|
237
237
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -265,7 +265,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
265
265
|
}
|
|
266
266
|
return { ok: false };
|
|
267
267
|
})()
|
|
268
|
-
`))?.ok}async function
|
|
268
|
+
`))?.ok}async function Ne(e,t=12){const a=Math.max(1,Math.ceil(t));for(let n=0;n<a;n++){const r=await x(e);if(r.state==="preview")return;if(r.state==="failed"){await e.screenshot({path:"/tmp/instagram_post_preview_debug.png"});throw S("Inspect /tmp/instagram_post_preview_debug.png. "+(r.detail||""))}if(n<a-1)await e.wait({time:1})}await e.screenshot({path:"/tmp/instagram_post_preview_debug.png"});throw new i("Instagram image preview did not appear after upload","The selected file input may not match the active composer; inspect /tmp/instagram_post_preview_debug.png")}async function H(e,t=4){const a=Math.max(1,Math.ceil(t*2));for(let n=0;n<a;n++){const r=await x(e);if(r.state!=="pending")return r;if(n<a-1)await e.wait({time:0.5})}return{state:"pending"}}export function buildClickActionJs(e,t="any"){return`
|
|
269
269
|
((labels, scope) => {
|
|
270
270
|
const isVisible = (el) => {
|
|
271
271
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -319,8 +319,8 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
return { ok: false };
|
|
322
|
-
})(${JSON.stringify(
|
|
323
|
-
`}async function
|
|
322
|
+
})(${JSON.stringify(e)}, ${JSON.stringify(t)})
|
|
323
|
+
`}async function j(e,t,a="any"){const n=await e.evaluate(buildClickActionJs(t,a));if(!n?.ok)throw new i(`Instagram action button not found: ${t.join(" / ")}`);return n.label||t[0]}async function Re(e){return!!(await e.evaluate(`
|
|
324
324
|
(() => {
|
|
325
325
|
const isVisible = (el) => {
|
|
326
326
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -358,12 +358,12 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
358
358
|
|
|
359
359
|
return { ok: false };
|
|
360
360
|
})()
|
|
361
|
-
`))?.ok}async function
|
|
361
|
+
`))?.ok}async function F(e){return!!(await e.evaluate(`
|
|
362
362
|
(() => {
|
|
363
363
|
const editable = document.querySelector('textarea, [contenteditable="true"]');
|
|
364
364
|
return { ok: !!editable };
|
|
365
365
|
})()
|
|
366
|
-
`))?.ok}async function
|
|
366
|
+
`))?.ok}async function J(e){return!!(await e.evaluate(`
|
|
367
367
|
(() => {
|
|
368
368
|
const editable = document.querySelector('textarea, [contenteditable="true"]');
|
|
369
369
|
const dialogText = Array.from(document.querySelectorAll('[role="dialog"]'))
|
|
@@ -377,7 +377,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
377
377
|
|| dialogText.includes('advanced settings'),
|
|
378
378
|
};
|
|
379
379
|
})()
|
|
380
|
-
`))?.ok}async function
|
|
380
|
+
`))?.ok}async function Ue(e){for(let t=0;t<3;t++){if(await J(e))return;try{await j(e,["Next","下一步"],"media")}catch(n){if(n instanceof i){await e.wait({time:1.5});if(await J(e))return;const r=await x(e);if(r.state==="failed")throw S(r.detail);if(t<2)continue}throw n}await e.wait({time:1.5});if(await F(e))return;const a=await x(e);if(a.state==="failed")throw S(a.detail)}await e.screenshot({path:"/tmp/instagram_post_caption_debug.png"});throw new i("Instagram caption editor did not appear","Instagram may have changed the publish flow; inspect /tmp/instagram_post_caption_debug.png")}async function Xe(e){if(!await F(e)){await e.screenshot({path:"/tmp/instagram_post_caption_debug.png"});throw new i("Instagram caption editor did not appear","Instagram may have changed the publish flow; inspect /tmp/instagram_post_caption_debug.png")}}async function Oe(e,t){const a=await x(e);if(a.state==="failed")throw S(a.detail);throw t}async function De(e){return!!(await e.evaluate(`
|
|
381
381
|
(() => {
|
|
382
382
|
const textarea = document.querySelector('[aria-label="Write a caption..."], textarea');
|
|
383
383
|
if (textarea instanceof HTMLTextAreaElement) {
|
|
@@ -437,7 +437,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
437
437
|
|
|
438
438
|
return { ok: true, kind: 'contenteditable' };
|
|
439
439
|
})()
|
|
440
|
-
`))?.ok}async function
|
|
440
|
+
`))?.ok}async function Ve(e,t){if(e.insertText&&await De(e))try{await e.insertText(t);await e.wait({time:0.3});await e.evaluate(`
|
|
441
441
|
(() => {
|
|
442
442
|
const textarea = document.querySelector('[aria-label="Write a caption..."], textarea');
|
|
443
443
|
if (textarea instanceof HTMLTextAreaElement) {
|
|
@@ -459,7 +459,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
459
459
|
editor.blur();
|
|
460
460
|
return { ok: true };
|
|
461
461
|
})()
|
|
462
|
-
`);return}catch{}if(!(await
|
|
462
|
+
`);return}catch{}if(!(await e.evaluate(`
|
|
463
463
|
((content) => {
|
|
464
464
|
const createParagraph = (text) => ({
|
|
465
465
|
children: text
|
|
@@ -548,8 +548,8 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
548
548
|
}
|
|
549
549
|
|
|
550
550
|
return { ok: false };
|
|
551
|
-
})(${JSON.stringify(
|
|
552
|
-
`))?.ok)throw new
|
|
551
|
+
})(${JSON.stringify(t)})
|
|
552
|
+
`))?.ok)throw new i("Failed to fill Instagram caption")}async function Be(e,t){return!!(await e.evaluate(`
|
|
553
553
|
((content) => {
|
|
554
554
|
const normalized = content.trim();
|
|
555
555
|
const readLexicalText = (node) => {
|
|
@@ -602,11 +602,11 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
return { ok: false };
|
|
605
|
-
})(${JSON.stringify(
|
|
606
|
-
`))?.ok}async function
|
|
605
|
+
})(${JSON.stringify(t)})
|
|
606
|
+
`))?.ok}async function He(e,t){for(let a=0;a<6;a++){if(await Be(e,t))return;if(a<5)await e.wait({time:0.5})}await e.screenshot({path:"/tmp/instagram_post_caption_fill_debug.png"});throw new i("Instagram caption did not stick before sharing","Inspect /tmp/instagram_post_caption_fill_debug.png for the caption editor state")}async function W(e){let t=0;for(let a=0;a<90;a++){const n=await e.evaluate(buildPublishStatusProbeJs());if(n?.failed){await e.screenshot({path:"/tmp/instagram_post_share_debug.png"});throw new i("Instagram post share failed","Inspect /tmp/instagram_post_share_debug.png for the share failure state")}if(n?.ok)return n.url||"";if(n?.settled){t+=1;if(t>=3)return""}else t=0;if(a<89)await e.wait({time:1})}await e.screenshot({path:"/tmp/instagram_post_share_debug.png"});throw new i("Instagram post share confirmation did not appear","Inspect /tmp/instagram_post_share_debug.png for the final publish state")}async function z(e){return(await e.getCookies({domain:"instagram.com"})).find((a)=>a.name==="ds_user_id")?.value||""}async function G(e,t=""){if(t){const n=await ie(e),r=await e.evaluate(`
|
|
607
607
|
(async () => {
|
|
608
|
-
const userId = ${JSON.stringify(
|
|
609
|
-
const appId = ${JSON.stringify(
|
|
608
|
+
const userId = ${JSON.stringify(t)};
|
|
609
|
+
const appId = ${JSON.stringify(n.appId||"")};
|
|
610
610
|
try {
|
|
611
611
|
const res = await fetch(
|
|
612
612
|
'https://www.instagram.com/api/v1/users/' + encodeURIComponent(userId) + '/info/',
|
|
@@ -623,7 +623,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
623
623
|
return { ok: false };
|
|
624
624
|
}
|
|
625
625
|
})()
|
|
626
|
-
`);if(
|
|
626
|
+
`);if(r?.ok&&r.username)return new URL(`/${r.username}/`,m).toString()}const a=await e.evaluate(`
|
|
627
627
|
(() => {
|
|
628
628
|
const isVisible = (el) => {
|
|
629
629
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -648,7 +648,7 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
648
648
|
const path = explicitProfile;
|
|
649
649
|
return { ok: !!path, path };
|
|
650
650
|
})()
|
|
651
|
-
`);if(!
|
|
651
|
+
`);if(!a?.ok||!a.path)return"";return new URL(a.path,m).toString()}async function X(e){const t=await e.evaluate(`
|
|
652
652
|
(() => {
|
|
653
653
|
const isVisible = (el) => {
|
|
654
654
|
if (!(el instanceof HTMLElement)) return false;
|
|
@@ -668,4 +668,4 @@ import*as E from"node:fs";import*as v from"node:path";import{cli as r,Strategy a
|
|
|
668
668
|
|
|
669
669
|
return { ok: hrefs.length > 0, hrefs };
|
|
670
670
|
})()
|
|
671
|
-
`);return Array.isArray(
|
|
671
|
+
`);return Array.isArray(t?.hrefs)?t.hrefs.filter(Boolean):[]}async function $e(e){const t=await z(e);if(!t)return null;const a=await G(e,t);if(!a)return null;try{await e.goto(a);await e.wait({time:3});return new Set(await X(e))}catch{return null}}async function k(e,t){const a=await e.getCurrentUrl?.();if(a&&/\/p\//.test(a))return a;const n=await z(e),r=await G(e,n);if(!r)return"";await e.goto(r);await e.wait({time:4});for(let o=0;o<8;o++){const s=(await X(e)).find((d)=>!t.has(d))||"";if(s)return new URL(s,m).toString();if(o<7)await e.wait({time:1})}return""}Y({site:"instagram",name:"post",access:"write",description:"Post an Instagram feed image or mixed-media carousel",domain:"www.instagram.com",strategy:Z.UI,browser:!0,args:[{name:"media",required:!1,valueRequired:!0,help:`Comma-separated media paths (images/videos, up to ${A})`},{name:"content",fromFile:!0,positional:!0,required:!1,help:"Caption text"},{name:"timeout",type:"int",required:!1,default:300,help:"Max seconds for the overall command (default: 300)"}],columns:["status","detail","url","media_id","account_id"],validateArgs:ge,func:async(e,t)=>{const a=ue(e),n=pe(t);D(t.content);const r=String(t.content??"").trim(),o=await $e(a),l=o!==null,s=o??new Set,d=Te(n),f=ke(n),h=Ae(n),w=Ie(n),y=Pe(n),v=_e(n),L=Le(n),g=process.env.OPENCLI_INSTAGRAM_CAPTURE==="1",M=[],q=[],K=async()=>{if(!g)return;await ee(a)},N=async()=>{if(!g)return;const c=await te(a);if(c.data.length)M.push(...c.data);if(c.errors.length)q.push(...c.errors)};try{try{return await be({page:a,mediaItems:n,content:r,existingPostPaths:s,canDiffProfile:l})}catch(c){if(c instanceof C)throw c;if(oe(c)){let u="",R=!1;if(l)try{u=await k(a,s);R=!0}catch{}if(u)return E(n,u);if(!R){const Q=c instanceof Error?c.message:String(c);throw new i(`Instagram publish outcome uncertain: ${Q}`,"The post may already be live. Do NOT rerun this command blindly — check the profile for a new post first; retrying on a false failure creates a duplicate post.")}}if(!he(c))throw c;try{return await xe({page:a,mediaItems:n,content:r,existingPostPaths:s,canDiffProfile:l,commandAttemptBudget:d,preUploadDelaySeconds:f,uploadAttemptBudget:h,previewProbeWindowSeconds:w,finalPreviewWaitSeconds:y,preShareDelaySeconds:v,inlineUploadRetryBudget:L,installProtocolCapture:K,drainProtocolCapture:N,forceFreshStart:!0})}catch(u){if(u instanceof C)throw u;if(u instanceof i)throw new i(ye(c,u),we(c,u));throw u}}}finally{if(g){try{await N()}catch{}U.writeFileSync(de,JSON.stringify({data:M,errors:q},null,2))}}}});
|