@sovovs/bycli 1.8.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-manifest.json +0 -61
- package/clis/twitter/search.js +3 -3
- package/dist/src/adapter-shadow.js +2 -2
- package/dist/src/browser/analyze.d.ts +10 -99
- package/dist/src/browser/analyze.js +10 -226
- package/dist/src/browser/cdp.js +67 -7
- package/dist/src/browser/daemon-client.d.ts +2 -0
- package/dist/src/browser/daemon-client.js +1 -1
- package/dist/src/browser/extension-capabilities.d.ts +13 -0
- package/dist/src/browser/extension-capabilities.js +22 -0
- package/dist/src/browser/extension-capabilities.test.d.ts +1 -0
- package/dist/src/browser/extension-version-metadata.test.d.ts +1 -0
- package/dist/src/browser/navigation-guard.d.ts +78 -0
- package/dist/src/browser/navigation-guard.js +142 -0
- package/dist/src/browser/navigation-guard.test.d.ts +1 -0
- package/dist/src/browser/page.d.ts +1 -0
- package/dist/src/browser/page.js +20 -1
- package/dist/src/browser/url-policy.d.ts +89 -0
- package/dist/src/browser/url-policy.js +311 -0
- package/dist/src/browser/url-policy.test.d.ts +1 -0
- package/dist/src/browser/verify-fixture.js +2 -2
- package/dist/src/build-manifest.js +4 -2
- package/dist/src/capabilityRouting.d.ts +3 -2
- package/dist/src/capabilityRouting.js +10 -2
- package/dist/src/cli.js +11 -14
- package/dist/src/commanderAdapter.js +5 -5
- package/dist/src/config-paths.d.ts +19 -0
- package/dist/src/config-paths.js +31 -0
- package/dist/src/daemon.js +256 -0
- package/dist/src/discovery.d.ts +10 -3
- package/dist/src/discovery.js +20 -10
- package/dist/src/discovery.test.d.ts +1 -0
- package/dist/src/execution.d.ts +5 -0
- package/dist/src/execution.js +272 -48
- package/dist/src/help.js +8 -8
- package/dist/src/main.js +18 -2
- package/dist/src/manifest-schema.d.ts +9 -0
- package/dist/src/manifest-schema.js +162 -0
- package/dist/src/manifest-schema.test.d.ts +1 -0
- package/dist/src/manifest-types.d.ts +1 -1
- package/dist/src/observation/redaction.js +10 -4
- package/dist/src/plugin.js +11 -8
- package/dist/src/recorder/highlevel/analyze.d.ts +29 -0
- package/dist/src/recorder/highlevel/analyze.js +91 -0
- package/dist/src/recorder/highlevel/init.d.ts +125 -0
- package/dist/src/recorder/highlevel/init.js +279 -0
- package/dist/src/recorder/highlevel/init.test.d.ts +1 -0
- package/dist/src/recorder/highlevel/verify.d.ts +73 -0
- package/dist/src/recorder/highlevel/verify.js +74 -0
- package/dist/src/recorder/http/analyze-runner.d.ts +28 -0
- package/dist/src/recorder/http/analyze-runner.js +78 -0
- package/dist/src/recorder/http/analyze-runner.test.d.ts +1 -0
- package/dist/src/recorder/http/handlers.d.ts +51 -0
- package/dist/src/recorder/http/handlers.js +219 -0
- package/dist/src/recorder/http/wrapper-config.d.ts +20 -0
- package/dist/src/recorder/http/wrapper-config.js +82 -0
- package/dist/src/recorder/http/wrapper-envelope.d.ts +31 -0
- package/dist/src/recorder/http/wrapper-envelope.js +51 -0
- package/dist/src/recorder/http/wrapper-gates.d.ts +16 -0
- package/dist/src/recorder/http/wrapper-gates.js +28 -0
- package/dist/src/recorder/http/wrapper-metrics.d.ts +1 -0
- package/dist/src/recorder/http/wrapper-metrics.js +5 -0
- package/dist/src/recorder/http/wrapper-registry.d.ts +50 -0
- package/dist/src/recorder/http/wrapper-registry.js +98 -0
- package/dist/src/recorder/http/wrapper-server.d.ts +59 -0
- package/dist/src/recorder/http/wrapper-server.js +240 -0
- package/dist/src/recorder/http/wrapper.test.d.ts +1 -0
- package/dist/src/recorder/observability/logger.d.ts +5 -0
- package/dist/src/recorder/observability/logger.js +13 -0
- package/dist/src/recorder/runner/config.d.ts +34 -0
- package/dist/src/recorder/runner/config.js +84 -0
- package/dist/src/recorder/runner/config.test.d.ts +1 -0
- package/dist/src/recorder/runner/reap.d.ts +79 -0
- package/dist/src/recorder/runner/reap.js +230 -0
- package/dist/src/recorder/runner/reap.test.d.ts +1 -0
- package/dist/src/recorder/runner/runner-port.d.ts +95 -0
- package/dist/src/recorder/runner/runner-port.js +518 -0
- package/dist/src/recorder/runner/runner-port.test.d.ts +1 -0
- package/dist/src/recorder/runner/session-keys.d.ts +28 -0
- package/dist/src/recorder/runner/session-keys.js +72 -0
- package/dist/src/recorder/runner/session-keys.test.d.ts +1 -0
- package/dist/src/recorder/runner/verify-runner-main.d.ts +96 -0
- package/dist/src/recorder/runner/verify-runner-main.js +292 -0
- package/dist/src/recorder/runner/verify-runner-main.test.d.ts +1 -0
- package/dist/src/registry-api.d.ts +1 -1
- package/dist/src/registry-api.types.test.d.ts +1 -0
- package/dist/src/registry-transaction.d.ts +42 -0
- package/dist/src/registry-transaction.js +194 -0
- package/dist/src/registry-transaction.test.d.ts +1 -0
- package/dist/src/registry.d.ts +58 -16
- package/dist/src/registry.js +131 -15
- package/dist/src/serialization.d.ts +1 -1
- package/dist/src/serialization.js +3 -3
- package/dist/src/types.d.ts +2 -0
- package/package.json +8 -5
- package/scripts/m1-daemon-navigate-drive.mjs +138 -0
- package/scripts/m1-extension-spike.mjs +237 -0
- package/scripts/m1-live-spike.mjs +156 -0
- package/scripts/m6b-connect-back-spike.sh +31 -0
- package/clis/12306/utils.test.js +0 -331
- package/clis/1688/assets.test.js +0 -39
- package/clis/1688/download.test.js +0 -31
- package/clis/1688/item.test.js +0 -67
- package/clis/1688/search.test.js +0 -75
- package/clis/1688/shared.test.js +0 -57
- package/clis/1688/store.test.js +0 -62
- package/clis/36kr/article.test.js +0 -46
- package/clis/36kr/hot.test.js +0 -15
- package/clis/36kr/news.test.js +0 -85
- package/clis/51job/utils.test.js +0 -69
- package/clis/_atlassian/shared.test.js +0 -170
- package/clis/aibase/news.test.js +0 -59
- package/clis/amazon/bestsellers.test.js +0 -29
- package/clis/amazon/discussion.test.js +0 -124
- package/clis/amazon/offer.test.js +0 -29
- package/clis/amazon/product.test.js +0 -24
- package/clis/amazon/rankings.test.js +0 -41
- package/clis/amazon/search.test.js +0 -22
- package/clis/amazon/shared.test.js +0 -44
- package/clis/apple-podcasts/commands.test.js +0 -119
- package/clis/apple-podcasts/utils.test.js +0 -57
- package/clis/arxiv/arxiv.test.js +0 -112
- package/clis/baidu-scholar/search.test.js +0 -23
- package/clis/barchart/greeks.test.js +0 -138
- package/clis/bilibili/comment.test.js +0 -153
- package/clis/bilibili/comments.test.js +0 -142
- package/clis/bilibili/dynamic.test.js +0 -68
- package/clis/bilibili/hot.test.js +0 -17
- package/clis/bilibili/subtitle.test.js +0 -196
- package/clis/bilibili/summary.test.js +0 -210
- package/clis/bilibili/utils.test.js +0 -61
- package/clis/bilibili/video.test.js +0 -132
- package/clis/binance/commands.test.js +0 -70
- package/clis/bloomberg/utils.test.js +0 -129
- package/clis/booking/booking.test.js +0 -356
- package/clis/boss/chatlist.test.js +0 -211
- package/clis/boss/chatmsg.test.js +0 -230
- package/clis/boss/search.test.js +0 -78
- package/clis/boss/utils.test.js +0 -34
- package/clis/brave/search.test.js +0 -76
- package/clis/chaoxing/utils.test.js +0 -45
- package/clis/chatgpt/commands.test.js +0 -45
- package/clis/chatgpt/envelope.test.js +0 -108
- package/clis/chatgpt/image.test.js +0 -188
- package/clis/chatgpt/utils.test.js +0 -330
- package/clis/chatgpt-app/ax.test.js +0 -35
- package/clis/chatwise/composer.test.js +0 -186
- package/clis/chess/analyze.test.js +0 -79
- package/clis/chess/game.test.js +0 -178
- package/clis/chess/games.test.js +0 -164
- package/clis/chess/stats.test.js +0 -79
- package/clis/chess/utils.test.js +0 -230
- package/clis/claude/ask.test.js +0 -338
- package/clis/claude/commands.test.js +0 -118
- package/clis/claude/utils.test.js +0 -148
- package/clis/cnki/search.test.js +0 -18
- package/clis/codex/sidebar.test.js +0 -329
- package/clis/coingecko/coingecko.test.js +0 -109
- package/clis/confluence/commands.test.js +0 -195
- package/clis/coupang/coupang.test.js +0 -159
- package/clis/coupang/utils.test.js +0 -62
- package/clis/ctrip/ctrip.test.js +0 -719
- package/clis/dblp/dblp.test.js +0 -397
- package/clis/deepseek/ask.test.js +0 -312
- package/clis/deepseek/detail.test.js +0 -81
- package/clis/deepseek/send.test.js +0 -107
- package/clis/deepseek/utils.test.js +0 -370
- package/clis/defillama/defillama.test.js +0 -99
- package/clis/devto/devto.test.js +0 -236
- package/clis/dianping/dianping.test.js +0 -578
- package/clis/douban/download.test.js +0 -170
- package/clis/douban/movie-hot.test.js +0 -14
- package/clis/douban/search.test.js +0 -11
- package/clis/douban/subject.test.js +0 -11
- package/clis/douban/utils.test.js +0 -438
- package/clis/doubao/detail.test.js +0 -42
- package/clis/doubao/history.test.js +0 -37
- package/clis/doubao/utils.test.js +0 -344
- package/clis/douyin/_shared/browser-fetch.test.js +0 -64
- package/clis/douyin/_shared/creation-id.test.js +0 -22
- package/clis/douyin/_shared/imagex-upload.test.js +0 -87
- package/clis/douyin/_shared/sts2.test.js +0 -27
- package/clis/douyin/_shared/text-extra.test.js +0 -37
- package/clis/douyin/_shared/timing.test.js +0 -28
- package/clis/douyin/_shared/tos-upload-short-read.test.js +0 -83
- package/clis/douyin/_shared/tos-upload.test.js +0 -229
- package/clis/douyin/_shared/transcode.test.js +0 -91
- package/clis/douyin/_shared/vod-upload.test.js +0 -38
- package/clis/douyin/activities.test.js +0 -55
- package/clis/douyin/collections.test.js +0 -45
- package/clis/douyin/delete.test.js +0 -100
- package/clis/douyin/draft.test.js +0 -335
- package/clis/douyin/drafts.test.js +0 -11
- package/clis/douyin/hashtag.test.js +0 -171
- package/clis/douyin/location.test.js +0 -23
- package/clis/douyin/profile.test.js +0 -46
- package/clis/douyin/publish-upload-id.test.js +0 -170
- package/clis/douyin/publish.test.js +0 -38
- package/clis/douyin/stats.test.js +0 -22
- package/clis/douyin/update.test.js +0 -11
- package/clis/douyin/user-videos.test.js +0 -151
- package/clis/douyin/videos.test.js +0 -54
- package/clis/duckduckgo/search.test.js +0 -128
- package/clis/duckduckgo/suggest.test.js +0 -66
- package/clis/eastmoney/hot-rank.test.js +0 -59
- package/clis/endoflife/endoflife.test.js +0 -51
- package/clis/facebook/feed.test.js +0 -169
- package/clis/facebook/marketplace.test.js +0 -91
- package/clis/facebook/notifications.test.js +0 -458
- package/clis/facebook/search.test.js +0 -55
- package/clis/flathub/flathub.test.js +0 -90
- package/clis/flomo/memos.test.js +0 -144
- package/clis/gemini/ask.test.js +0 -100
- package/clis/gemini/deep-research-result.test.js +0 -155
- package/clis/gemini/deep-research.test.js +0 -181
- package/clis/gemini/reply-state.test.js +0 -671
- package/clis/gemini/utils.test.js +0 -198
- package/clis/geogebra/geogebra.test.js +0 -175
- package/clis/gitee/search.test.js +0 -65
- package/clis/gitee/user.test.js +0 -63
- package/clis/google/utils.test.js +0 -75
- package/clis/google-scholar/cite.test.js +0 -47
- package/clis/google-scholar/profile.test.js +0 -49
- package/clis/google-scholar/search.test.js +0 -71
- package/clis/goproxy/goproxy.test.js +0 -103
- package/clis/gov-law/commands.test.js +0 -39
- package/clis/gov-policy/gov-policy.test.js +0 -224
- package/clis/grok/ask.test.js +0 -29
- package/clis/grok/utils.test.js +0 -103
- package/clis/hackernews/hackernews.test.js +0 -132
- package/clis/hf/hf.test.js +0 -16
- package/clis/hupu/hot.test.js +0 -224
- package/clis/imdb/utils.test.js +0 -88
- package/clis/indeed/indeed.test.js +0 -375
- package/clis/instagram/_shared/private-publish.test.js +0 -705
- package/clis/instagram/_shared/protocol-capture.test.js +0 -114
- package/clis/instagram/download.test.js +0 -118
- package/clis/instagram/note.test.js +0 -53
- package/clis/instagram/post.test.js +0 -1647
- package/clis/instagram/reel.test.js +0 -167
- package/clis/instagram/story.test.js +0 -134
- package/clis/jd/commands.test.js +0 -41
- package/clis/jd/item.test.js +0 -354
- package/clis/jianyu/search.test.js +0 -153
- package/clis/jianyu/shared/procurement-contract.test.js +0 -72
- package/clis/jianyu/shared/procurement-detail.test.js +0 -84
- package/clis/jike/read.test.js +0 -86
- package/clis/jira/commands.test.js +0 -287
- package/clis/juejin/search.js +0 -123
- package/clis/juejin/search.test.js +0 -98
- package/clis/lesswrong/frontpage.test.js +0 -37
- package/clis/lichess/lichess.test.js +0 -85
- package/clis/linkedin/connect.test.js +0 -213
- package/clis/linkedin/inbox.test.js +0 -152
- package/clis/linkedin/job-detail.test.js +0 -38
- package/clis/linkedin/jobs-preferences.test.js +0 -43
- package/clis/linkedin/people-search.test.js +0 -216
- package/clis/linkedin/post-analytics.test.js +0 -40
- package/clis/linkedin/posts.test.js +0 -40
- package/clis/linkedin/profile-analytics.test.js +0 -67
- package/clis/linkedin/profile-experience.test.js +0 -152
- package/clis/linkedin/profile-projects.test.js +0 -111
- package/clis/linkedin/profile-read.test.js +0 -77
- package/clis/linkedin/safe-send.test.js +0 -204
- package/clis/linkedin/salesnav-inbox.test.js +0 -113
- package/clis/linkedin/salesnav-message.test.js +0 -172
- package/clis/linkedin/salesnav-search.test.js +0 -76
- package/clis/linkedin/salesnav-thread.test.js +0 -79
- package/clis/linkedin/search.test.js +0 -222
- package/clis/linkedin/sent-invitations.test.js +0 -62
- package/clis/linkedin/services-read.test.js +0 -105
- package/clis/linkedin/thread-snapshot.test.js +0 -89
- package/clis/linkedin/timeline.test.js +0 -81
- package/clis/linkedin-learning/course.test.js +0 -114
- package/clis/linkedin-learning/search.test.js +0 -144
- package/clis/linkedin-learning/trending.test.js +0 -123
- package/clis/linux-do/feed.test.js +0 -153
- package/clis/linux-do/topic-content.test.js +0 -59
- package/clis/lobsters/lobsters.test.js +0 -169
- package/clis/notebooklm/add-source.test.js +0 -97
- package/clis/notebooklm/compat.test.js +0 -16
- package/clis/notebooklm/create.test.js +0 -58
- package/clis/notebooklm/generate-audio.test.js +0 -63
- package/clis/notebooklm/generate-slides.test.js +0 -75
- package/clis/notebooklm/history.test.js +0 -58
- package/clis/notebooklm/note-list.test.js +0 -56
- package/clis/notebooklm/notes-get.test.js +0 -72
- package/clis/notebooklm/open.test.js +0 -63
- package/clis/notebooklm/rpc.test.js +0 -131
- package/clis/notebooklm/source-fulltext.test.js +0 -106
- package/clis/notebooklm/source-get.test.js +0 -84
- package/clis/notebooklm/source-guide.test.js +0 -104
- package/clis/notebooklm/summary.test.js +0 -78
- package/clis/notebooklm/utils.test.js +0 -449
- package/clis/notebooklm/write-note.test.js +0 -70
- package/clis/nuget/nuget.test.js +0 -111
- package/clis/oeis/oeis.test.js +0 -88
- package/clis/ones/task-helpers.test.js +0 -12
- package/clis/ones/worklog.test.js +0 -20
- package/clis/openfda/openfda.test.js +0 -114
- package/clis/openreview/openreview.test.js +0 -427
- package/clis/osv/osv.test.js +0 -97
- package/clis/paperreview/commands.test.js +0 -243
- package/clis/paperreview/utils.test.js +0 -49
- package/clis/pixiv/download.test.js +0 -87
- package/clis/pixiv/illusts.test.js +0 -99
- package/clis/pixiv/search.test.js +0 -83
- package/clis/powerchina/search.test.js +0 -93
- package/clis/producthunt/utils.test.js +0 -64
- package/clis/pubmed/pubmed.test.js +0 -276
- package/clis/quark/utils.test.js +0 -58
- package/clis/qwen/utils.test.js +0 -45
- package/clis/reddit/extract-media.test.js +0 -149
- package/clis/reddit/frontpage.test.js +0 -34
- package/clis/reddit/home.test.js +0 -170
- package/clis/reddit/hot.test.js +0 -32
- package/clis/reddit/popular.test.js +0 -26
- package/clis/reddit/read.test.js +0 -335
- package/clis/reddit/reply.test.js +0 -89
- package/clis/reddit/search.test.js +0 -26
- package/clis/reddit/subreddit-info.test.js +0 -163
- package/clis/reddit/subreddit.test.js +0 -31
- package/clis/reddit/subscribed.test.js +0 -168
- package/clis/reddit/whoami.test.js +0 -105
- package/clis/rednote/navigation.test.js +0 -26
- package/clis/rednote/rednote.test.js +0 -222
- package/clis/rest-countries/rest-countries.test.js +0 -83
- package/clis/reuters/reuters.test.js +0 -299
- package/clis/rfc/rfc.test.js +0 -74
- package/clis/sinafinance/stock.test.js +0 -59
- package/clis/spotify/utils.test.js +0 -67
- package/clis/stackoverflow/stackoverflow.test.js +0 -404
- package/clis/steam/steam.test.js +0 -46
- package/clis/substack/utils.test.js +0 -44
- package/clis/suno/commands.test.js +0 -188
- package/clis/suno/download.test.js +0 -151
- package/clis/suno/generate.test.js +0 -252
- package/clis/suno/utils.test.js +0 -329
- package/clis/taobao/commands.test.js +0 -41
- package/clis/tdx/hot-rank.test.js +0 -59
- package/clis/ths/hot-rank.test.js +0 -64
- package/clis/tieba/commands.test.js +0 -79
- package/clis/tieba/utils.test.js +0 -290
- package/clis/tiktok/creator-videos.test.js +0 -113
- package/clis/tiktok/refactor.test.js +0 -389
- package/clis/tiktok/write-refactor.test.js +0 -370
- package/clis/toutiao/toutiao.test.js +0 -378
- package/clis/tvmaze/tvmaze.test.js +0 -93
- package/clis/twitter/bookmark-folder.test.js +0 -395
- package/clis/twitter/bookmark-folders.test.js +0 -152
- package/clis/twitter/bookmark.test.js +0 -74
- package/clis/twitter/bookmarks.test.js +0 -205
- package/clis/twitter/delete.test.js +0 -85
- package/clis/twitter/device-follow.test.js +0 -287
- package/clis/twitter/download.test.js +0 -457
- package/clis/twitter/followers.test.js +0 -62
- package/clis/twitter/following.test.js +0 -338
- package/clis/twitter/hide-reply.test.js +0 -76
- package/clis/twitter/like.test.js +0 -73
- package/clis/twitter/likes.test.js +0 -220
- package/clis/twitter/list-add.test.js +0 -133
- package/clis/twitter/list-create.test.js +0 -169
- package/clis/twitter/list-remove.test.js +0 -110
- package/clis/twitter/list-tweets.test.js +0 -196
- package/clis/twitter/lists.test.js +0 -253
- package/clis/twitter/post.test.js +0 -258
- package/clis/twitter/profile.test.js +0 -39
- package/clis/twitter/quote.test.js +0 -194
- package/clis/twitter/reply.test.js +0 -237
- package/clis/twitter/retweet.test.js +0 -73
- package/clis/twitter/search.test.js +0 -349
- package/clis/twitter/shared.test.js +0 -794
- package/clis/twitter/thread.test.js +0 -58
- package/clis/twitter/timeline.test.js +0 -104
- package/clis/twitter/trending.test.js +0 -15
- package/clis/twitter/tweets.test.js +0 -362
- package/clis/twitter/unbookmark.test.js +0 -73
- package/clis/twitter/unlike.test.js +0 -75
- package/clis/twitter/unretweet.test.js +0 -73
- package/clis/twitter/utils.test.js +0 -169
- package/clis/uisdc/news.test.js +0 -66
- package/clis/uiverse/_shared.test.js +0 -62
- package/clis/uiverse/navigation.test.js +0 -12
- package/clis/upwork/upwork.test.js +0 -566
- package/clis/wanfang/search.test.js +0 -23
- package/clis/web/read.test.js +0 -392
- package/clis/weibo/delete.test.js +0 -94
- package/clis/weibo/envelope.test.js +0 -85
- package/clis/weibo/favorites.test.js +0 -114
- package/clis/weibo/publish.test.js +0 -192
- package/clis/weibo/user-posts.test.js +0 -92
- package/clis/weibo/utils.test.js +0 -36
- package/clis/weixin/drafts.test.js +0 -69
- package/clis/weixin/search.test.js +0 -227
- package/clis/weread/ai-outline.test.js +0 -83
- package/clis/weread/book-search.test.js +0 -242
- package/clis/weread/commands.test.js +0 -398
- package/clis/weread/private-api-regression.test.js +0 -369
- package/clis/weread/search-regression.test.js +0 -494
- package/clis/weread/utils.test.js +0 -128
- package/clis/weread-official/commands.test.js +0 -385
- package/clis/weread-official/utils.test.js +0 -242
- package/clis/wikidata/wikidata.test.js +0 -83
- package/clis/wikipedia/trending.test.js +0 -57
- package/clis/wttr/wttr.test.js +0 -84
- package/clis/xianyu/chat.test.js +0 -84
- package/clis/xianyu/im.test.js +0 -253
- package/clis/xianyu/item.test.js +0 -56
- package/clis/xianyu/publish.test.js +0 -220
- package/clis/xianyu/search.test.js +0 -17
- package/clis/xiaoe/xiaoe.test.js +0 -486
- package/clis/xiaohongshu/comments.test.js +0 -258
- package/clis/xiaohongshu/creator-note-detail.test.js +0 -451
- package/clis/xiaohongshu/creator-notes-summary.test.js +0 -94
- package/clis/xiaohongshu/creator-notes.test.js +0 -281
- package/clis/xiaohongshu/creator-stats.test.js +0 -24
- package/clis/xiaohongshu/delete-note.test.js +0 -172
- package/clis/xiaohongshu/download.test.js +0 -316
- package/clis/xiaohongshu/navigation.test.js +0 -34
- package/clis/xiaohongshu/note.test.js +0 -249
- package/clis/xiaohongshu/publish.test.js +0 -608
- package/clis/xiaohongshu/search.test.js +0 -325
- package/clis/xiaohongshu/user-helpers.test.js +0 -160
- package/clis/xiaoyuzhou/auth.test.js +0 -124
- package/clis/xiaoyuzhou/download.test.js +0 -135
- package/clis/xiaoyuzhou/podcast-episodes.test.js +0 -78
- package/clis/xiaoyuzhou/transcript.test.js +0 -195
- package/clis/xiaoyuzhou/utils.test.js +0 -39
- package/clis/xueqiu/comments.test.js +0 -696
- package/clis/xueqiu/danjuan-utils.test.js +0 -41
- package/clis/xueqiu/utils.test.js +0 -26
- package/clis/yahoo/search.test.js +0 -94
- package/clis/youdao/note.test.js +0 -99
- package/clis/youtube/channel.test.js +0 -59
- package/clis/youtube/feed.test.js +0 -131
- package/clis/youtube/transcript-group.test.js +0 -99
- package/clis/youtube/transcript.test.js +0 -296
- package/clis/youtube/utils.test.js +0 -84
- package/clis/yuanbao/ask.test.js +0 -124
- package/clis/yuanbao/new.test.js +0 -30
- package/clis/yuanbao/shared.test.js +0 -80
- package/clis/zhihu/answer-comments.test.js +0 -287
- package/clis/zhihu/answer-detail.test.js +0 -338
- package/clis/zhihu/answer.test.js +0 -54
- package/clis/zhihu/collection.test.js +0 -337
- package/clis/zhihu/collections.test.js +0 -182
- package/clis/zhihu/comment.test.js +0 -50
- package/clis/zhihu/download.test.js +0 -12
- package/clis/zhihu/favorite.test.js +0 -59
- package/clis/zhihu/follow.test.js +0 -42
- package/clis/zhihu/like.test.js +0 -41
- package/clis/zhihu/question.test.js +0 -251
- package/clis/zhihu/recommend.test.js +0 -143
- package/clis/zhihu/search.test.js +0 -198
- package/clis/zhihu/target.test.js +0 -77
- package/clis/zhihu/text.test.js +0 -24
- package/clis/zhihu/write-shared.test.js +0 -176
- package/clis/zlibrary/commands.test.js +0 -65
- package/clis/zsxq/search.test.js +0 -24
- package/clis/zsxq/topic.test.js +0 -30
- package/clis/zsxq/topics.test.js +0 -24
- package/clis/zsxq/utils.test.js +0 -31
- package/dist/src/adapter-shadow.test.js +0 -49
- package/dist/src/adapter-source.test.js +0 -29
- package/dist/src/browser/analyze.test.js +0 -166
- package/dist/src/browser/article-extract.e2e.test.js +0 -105
- package/dist/src/browser/article-extract.test.js +0 -94
- package/dist/src/browser/ax-snapshot.test.js +0 -91
- package/dist/src/browser/base-page.test.js +0 -758
- package/dist/src/browser/cdp-click-fixture.test.js +0 -87
- package/dist/src/browser/cdp.test.js +0 -79
- package/dist/src/browser/compound.test.js +0 -175
- package/dist/src/browser/daemon-client.test.js +0 -199
- package/dist/src/browser/dom-helpers.test.js +0 -106
- package/dist/src/browser/dom-snapshot.test.js +0 -313
- package/dist/src/browser/errors.test.js +0 -60
- package/dist/src/browser/extract.test.js +0 -129
- package/dist/src/browser/find.test.js +0 -180
- package/dist/src/browser/html-tree.test.js +0 -181
- package/dist/src/browser/network-cache.test.js +0 -58
- package/dist/src/browser/network-key.test.js +0 -49
- package/dist/src/browser/page.test.js +0 -378
- package/dist/src/browser/shape-filter.test.js +0 -101
- package/dist/src/browser/shape.test.js +0 -82
- package/dist/src/browser/stealth.test.js +0 -134
- package/dist/src/browser/target-errors.test.js +0 -94
- package/dist/src/browser/target-resolver.test.js +0 -118
- package/dist/src/browser/utils.test.js +0 -29
- package/dist/src/browser/verify-fixture.test.js +0 -219
- package/dist/src/browser.test.js +0 -232
- package/dist/src/build-manifest.test.js +0 -341
- package/dist/src/capabilityRouting.test.js +0 -63
- package/dist/src/cli-argv-preprocess.test.js +0 -209
- package/dist/src/cli.test.js +0 -2803
- package/dist/src/commanderAdapter.test.js +0 -352
- package/dist/src/commands/daemon.test.js +0 -219
- package/dist/src/completion.test.js +0 -24
- package/dist/src/convention-audit.test.js +0 -247
- package/dist/src/daemon.test.js +0 -60
- package/dist/src/doctor.test.js +0 -263
- package/dist/src/download/article-download.test.js +0 -235
- package/dist/src/download/index.test.js +0 -140
- package/dist/src/download/media-download.test.js +0 -112
- package/dist/src/download/progress.test.js +0 -36
- package/dist/src/electron-apps.test.js +0 -49
- package/dist/src/engine.test.js +0 -312
- package/dist/src/errors.test.js +0 -109
- package/dist/src/execution.test.js +0 -623
- package/dist/src/extension-manifest-regression.test.js +0 -12
- package/dist/src/external.test.js +0 -146
- package/dist/src/help.test.js +0 -58
- package/dist/src/hooks.test.js +0 -92
- package/dist/src/interceptor.test.js +0 -81
- package/dist/src/launcher.test.js +0 -138
- package/dist/src/node-network.test.js +0 -55
- package/dist/src/observation/artifact.test.js +0 -121
- package/dist/src/observation/manager.test.js +0 -13
- package/dist/src/observation/redaction.test.js +0 -32
- package/dist/src/observation/retention.test.js +0 -118
- package/dist/src/observation/ring-buffer.test.js +0 -22
- package/dist/src/output.test.js +0 -53
- package/dist/src/package-exports.test.js +0 -112
- package/dist/src/pipeline/executor.test.js +0 -182
- package/dist/src/pipeline/steps/download.test.js +0 -102
- package/dist/src/pipeline/steps/fetch.test.js +0 -117
- package/dist/src/pipeline/template.test.js +0 -175
- package/dist/src/pipeline/transform.test.js +0 -133
- package/dist/src/plugin-manifest.test.js +0 -179
- package/dist/src/plugin-scaffold.test.js +0 -83
- package/dist/src/plugin.test.js +0 -1324
- package/dist/src/registry.test.js +0 -209
- package/dist/src/runtime-detect.test.js +0 -39
- package/dist/src/serialization.test.js +0 -78
- package/dist/src/snapshotFormatter.test.js +0 -521
- package/dist/src/tui.test.js +0 -19
- package/dist/src/update-check.test.js +0 -116
- package/dist/src/utils.test.js +0 -155
- package/dist/src/validate.test.js +0 -90
- package/dist/src/weixin-download.test.js +0 -45
|
@@ -1,705 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as os from 'node:os';
|
|
3
|
-
import * as path from 'node:path';
|
|
4
|
-
import { afterAll, describe, expect, it } from 'vitest';
|
|
5
|
-
import { buildConfigureBody, buildConfigureSidecarPayload, buildConfigureToStoryPhotoPayload, buildConfigureToStoryVideoPayload, deriveInstagramJazoest, derivePrivateApiContextFromCapture, extractInstagramRuntimeInfo, getInstagramFeedNormalizedDimensions, getInstagramStoryNormalizedDimensions, isInstagramFeedAspectRatioAllowed, isInstagramStoryAspectRatioAllowed, publishStoryViaPrivateApi, publishMediaViaPrivateApi, publishImagesViaPrivateApi, readImageAsset, resolveInstagramPrivatePublishConfig, } from './private-publish.js';
|
|
6
|
-
const tempDirs = [];
|
|
7
|
-
function createTempFile(name, bytes) {
|
|
8
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-instagram-private-'));
|
|
9
|
-
tempDirs.push(dir);
|
|
10
|
-
const filePath = path.join(dir, name);
|
|
11
|
-
fs.writeFileSync(filePath, bytes);
|
|
12
|
-
return filePath;
|
|
13
|
-
}
|
|
14
|
-
afterAll(() => {
|
|
15
|
-
for (const dir of tempDirs) {
|
|
16
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
describe('instagram private publish helpers', () => {
|
|
20
|
-
it('derives the private API context from captured instagram request headers', () => {
|
|
21
|
-
const entries = [
|
|
22
|
-
{
|
|
23
|
-
kind: 'cdp',
|
|
24
|
-
url: 'https://www.instagram.com/api/v1/feed/timeline/',
|
|
25
|
-
method: 'GET',
|
|
26
|
-
requestHeaders: {
|
|
27
|
-
'X-ASBD-ID': '359341',
|
|
28
|
-
'X-CSRFToken': 'csrf-token',
|
|
29
|
-
'X-IG-App-ID': '936619743392459',
|
|
30
|
-
'X-IG-WWW-Claim': 'hmac.claim',
|
|
31
|
-
'X-Instagram-AJAX': '1036517563',
|
|
32
|
-
'X-Web-Session-ID': 'abc:def:ghi',
|
|
33
|
-
},
|
|
34
|
-
timestamp: Date.now(),
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
expect(derivePrivateApiContextFromCapture(entries)).toEqual({
|
|
38
|
-
asbdId: '359341',
|
|
39
|
-
csrfToken: 'csrf-token',
|
|
40
|
-
igAppId: '936619743392459',
|
|
41
|
-
igWwwClaim: 'hmac.claim',
|
|
42
|
-
instagramAjax: '1036517563',
|
|
43
|
-
webSessionId: 'abc:def:ghi',
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
it('derives jazoest from the csrf token', () => {
|
|
47
|
-
expect(deriveInstagramJazoest('SJ_btbvfkpAVFKCN_tJstW')).toBe('22047');
|
|
48
|
-
});
|
|
49
|
-
it('extracts app id, rollout hash, and csrf token from instagram html', () => {
|
|
50
|
-
const html = `
|
|
51
|
-
<html>
|
|
52
|
-
<head>
|
|
53
|
-
<script type="application/json">
|
|
54
|
-
{"csrf_token":"csrf-from-html","rollout_hash":"1036523242","X-IG-App-ID":"936619743392459"}
|
|
55
|
-
</script>
|
|
56
|
-
</head>
|
|
57
|
-
</html>
|
|
58
|
-
`;
|
|
59
|
-
expect(extractInstagramRuntimeInfo(html)).toEqual({
|
|
60
|
-
appId: '936619743392459',
|
|
61
|
-
csrfToken: 'csrf-from-html',
|
|
62
|
-
instagramAjax: '1036523242',
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
it('resolves private publish config from capture, runtime html, and cookies', async () => {
|
|
66
|
-
const entries = [
|
|
67
|
-
{
|
|
68
|
-
kind: 'cdp',
|
|
69
|
-
url: 'https://www.instagram.com/api/v1/feed/timeline/',
|
|
70
|
-
method: 'GET',
|
|
71
|
-
requestHeaders: {
|
|
72
|
-
'X-ASBD-ID': '359341',
|
|
73
|
-
'X-IG-WWW-Claim': 'hmac.claim',
|
|
74
|
-
'X-Web-Session-ID': 'abc:def:ghi',
|
|
75
|
-
},
|
|
76
|
-
timestamp: Date.now(),
|
|
77
|
-
},
|
|
78
|
-
];
|
|
79
|
-
const page = {
|
|
80
|
-
goto: async () => undefined,
|
|
81
|
-
wait: async () => undefined,
|
|
82
|
-
getCookies: async () => [{ name: 'csrftoken', value: 'csrf-cookie', domain: 'instagram.com' }],
|
|
83
|
-
startNetworkCapture: async () => undefined,
|
|
84
|
-
readNetworkCapture: async () => entries,
|
|
85
|
-
evaluate: async () => ({
|
|
86
|
-
appId: '936619743392459',
|
|
87
|
-
csrfToken: 'csrf-from-html',
|
|
88
|
-
instagramAjax: '1036523242',
|
|
89
|
-
}),
|
|
90
|
-
};
|
|
91
|
-
await expect(resolveInstagramPrivatePublishConfig(page)).resolves.toEqual({
|
|
92
|
-
apiContext: {
|
|
93
|
-
asbdId: '359341',
|
|
94
|
-
csrfToken: 'csrf-from-html',
|
|
95
|
-
igAppId: '936619743392459',
|
|
96
|
-
igWwwClaim: 'hmac.claim',
|
|
97
|
-
instagramAjax: '1036523242',
|
|
98
|
-
webSessionId: 'abc:def:ghi',
|
|
99
|
-
},
|
|
100
|
-
jazoest: deriveInstagramJazoest('csrf-from-html'),
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
it('retries transient private publish config resolution failures and then succeeds', async () => {
|
|
104
|
-
const entries = [
|
|
105
|
-
{
|
|
106
|
-
kind: 'cdp',
|
|
107
|
-
url: 'https://www.instagram.com/api/v1/feed/timeline/',
|
|
108
|
-
method: 'GET',
|
|
109
|
-
requestHeaders: {
|
|
110
|
-
'X-ASBD-ID': '359341',
|
|
111
|
-
'X-IG-WWW-Claim': 'hmac.claim',
|
|
112
|
-
'X-Web-Session-ID': 'abc:def:ghi',
|
|
113
|
-
},
|
|
114
|
-
timestamp: Date.now(),
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
let evaluateAttempts = 0;
|
|
118
|
-
const page = {
|
|
119
|
-
goto: async () => undefined,
|
|
120
|
-
wait: async () => undefined,
|
|
121
|
-
getCookies: async () => [{ name: 'csrftoken', value: 'csrf-cookie', domain: 'instagram.com' }],
|
|
122
|
-
startNetworkCapture: async () => undefined,
|
|
123
|
-
readNetworkCapture: async () => entries,
|
|
124
|
-
evaluate: async () => {
|
|
125
|
-
evaluateAttempts += 1;
|
|
126
|
-
if (evaluateAttempts === 1) {
|
|
127
|
-
throw new TypeError('fetch failed');
|
|
128
|
-
}
|
|
129
|
-
return {
|
|
130
|
-
appId: '936619743392459',
|
|
131
|
-
csrfToken: 'csrf-from-html',
|
|
132
|
-
instagramAjax: '1036523242',
|
|
133
|
-
};
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
await expect(resolveInstagramPrivatePublishConfig(page)).resolves.toEqual({
|
|
137
|
-
apiContext: {
|
|
138
|
-
asbdId: '359341',
|
|
139
|
-
csrfToken: 'csrf-from-html',
|
|
140
|
-
igAppId: '936619743392459',
|
|
141
|
-
igWwwClaim: 'hmac.claim',
|
|
142
|
-
instagramAjax: '1036523242',
|
|
143
|
-
webSessionId: 'abc:def:ghi',
|
|
144
|
-
},
|
|
145
|
-
jazoest: deriveInstagramJazoest('csrf-from-html'),
|
|
146
|
-
});
|
|
147
|
-
expect(evaluateAttempts).toBe(2);
|
|
148
|
-
});
|
|
149
|
-
it('builds the single-image configure form body', () => {
|
|
150
|
-
expect(buildConfigureBody({
|
|
151
|
-
uploadId: '1775134280303',
|
|
152
|
-
caption: 'hello private route',
|
|
153
|
-
jazoest: '22047',
|
|
154
|
-
})).toBe('archive_only=false&caption=hello+private+route&clips_share_preview_to_feed=1'
|
|
155
|
-
+ '&disable_comments=0&disable_oa_reuse=false&igtv_share_preview_to_feed=1'
|
|
156
|
-
+ '&is_meta_only_post=0&is_unified_video=1&like_and_view_counts_disabled=0'
|
|
157
|
-
+ '&media_share_flow=creation_flow&share_to_facebook=&share_to_fb_destination_type=USER'
|
|
158
|
-
+ '&source_type=library&upload_id=1775134280303&video_subtitles_enabled=0&jazoest=22047');
|
|
159
|
-
});
|
|
160
|
-
it('builds the carousel configure_sidecar JSON payload', () => {
|
|
161
|
-
expect(buildConfigureSidecarPayload({
|
|
162
|
-
uploadIds: ['1', '3', '2'],
|
|
163
|
-
caption: 'hello carousel',
|
|
164
|
-
clientSidecarId: '1775134574348',
|
|
165
|
-
jazoest: '22047',
|
|
166
|
-
})).toEqual({
|
|
167
|
-
archive_only: false,
|
|
168
|
-
caption: 'hello carousel',
|
|
169
|
-
children_metadata: [
|
|
170
|
-
{ upload_id: '1' },
|
|
171
|
-
{ upload_id: '3' },
|
|
172
|
-
{ upload_id: '2' },
|
|
173
|
-
],
|
|
174
|
-
client_sidecar_id: '1775134574348',
|
|
175
|
-
disable_comments: '0',
|
|
176
|
-
is_meta_only_post: false,
|
|
177
|
-
is_open_to_public_submission: false,
|
|
178
|
-
like_and_view_counts_disabled: 0,
|
|
179
|
-
media_share_flow: 'creation_flow',
|
|
180
|
-
share_to_facebook: '',
|
|
181
|
-
share_to_fb_destination_type: 'USER',
|
|
182
|
-
source_type: 'library',
|
|
183
|
-
jazoest: '22047',
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
it('reads png and jpeg image assets with mime type and dimensions', () => {
|
|
187
|
-
const png = createTempFile('sample.png', Buffer.from('89504E470D0A1A0A0000000D49484452000000030000000508060000008D6F26E50000000049454E44AE426082', 'hex'));
|
|
188
|
-
const jpeg = createTempFile('sample.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
189
|
-
expect(readImageAsset(png)).toMatchObject({
|
|
190
|
-
mimeType: 'image/png',
|
|
191
|
-
width: 3,
|
|
192
|
-
height: 5,
|
|
193
|
-
});
|
|
194
|
-
expect(readImageAsset(jpeg)).toMatchObject({
|
|
195
|
-
mimeType: 'image/jpeg',
|
|
196
|
-
width: 6,
|
|
197
|
-
height: 4,
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
it('computes feed-safe aspect-ratio normalization targets', () => {
|
|
201
|
-
expect(isInstagramFeedAspectRatioAllowed(1080, 1350)).toBe(true);
|
|
202
|
-
expect(isInstagramFeedAspectRatioAllowed(1179, 2556)).toBe(false);
|
|
203
|
-
expect(getInstagramFeedNormalizedDimensions(1179, 2556)).toEqual({
|
|
204
|
-
width: 2045,
|
|
205
|
-
height: 2556,
|
|
206
|
-
});
|
|
207
|
-
expect(getInstagramFeedNormalizedDimensions(2120, 1140)).toBeNull();
|
|
208
|
-
});
|
|
209
|
-
it('computes story-safe aspect-ratio normalization targets', () => {
|
|
210
|
-
expect(isInstagramStoryAspectRatioAllowed(1080, 1920)).toBe(true);
|
|
211
|
-
expect(isInstagramStoryAspectRatioAllowed(1080, 1080)).toBe(false);
|
|
212
|
-
expect(getInstagramStoryNormalizedDimensions(1080, 1080)).toEqual({
|
|
213
|
-
width: 1080,
|
|
214
|
-
height: 1440,
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
it('builds the single-photo configure_to_story payload', () => {
|
|
218
|
-
expect(buildConfigureToStoryPhotoPayload({
|
|
219
|
-
uploadId: '1775134280303',
|
|
220
|
-
width: 1080,
|
|
221
|
-
height: 1920,
|
|
222
|
-
now: () => 1_775_134_280_303,
|
|
223
|
-
jazoest: '22047',
|
|
224
|
-
})).toMatchObject({
|
|
225
|
-
source_type: '4',
|
|
226
|
-
upload_id: '1775134280303',
|
|
227
|
-
configure_mode: 1,
|
|
228
|
-
edits: {
|
|
229
|
-
crop_original_size: [1080, 1920],
|
|
230
|
-
crop_center: [0, 0],
|
|
231
|
-
crop_zoom: 1.3333334,
|
|
232
|
-
},
|
|
233
|
-
extra: {
|
|
234
|
-
source_width: 1080,
|
|
235
|
-
source_height: 1920,
|
|
236
|
-
},
|
|
237
|
-
jazoest: '22047',
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
it('builds the single-video configure_to_story payload', () => {
|
|
241
|
-
expect(buildConfigureToStoryVideoPayload({
|
|
242
|
-
uploadId: '1775134280303',
|
|
243
|
-
width: 1080,
|
|
244
|
-
height: 1920,
|
|
245
|
-
durationMs: 12500,
|
|
246
|
-
now: () => 1_775_134_280_303,
|
|
247
|
-
jazoest: '22047',
|
|
248
|
-
})).toMatchObject({
|
|
249
|
-
source_type: '4',
|
|
250
|
-
upload_id: '1775134280303',
|
|
251
|
-
configure_mode: 1,
|
|
252
|
-
poster_frame_index: 0,
|
|
253
|
-
length: 12.5,
|
|
254
|
-
extra: {
|
|
255
|
-
source_width: 1080,
|
|
256
|
-
source_height: 1920,
|
|
257
|
-
},
|
|
258
|
-
jazoest: '22047',
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
it('publishes a single image through rupload + configure', async () => {
|
|
262
|
-
const jpeg = createTempFile('private-single.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
263
|
-
const calls = [];
|
|
264
|
-
const fetcher = async (url, init) => {
|
|
265
|
-
calls.push({ url: String(url), init });
|
|
266
|
-
if (String(url).includes('/rupload_igphoto/')) {
|
|
267
|
-
return new Response('{"upload_id":"111","status":"ok"}', { status: 200 });
|
|
268
|
-
}
|
|
269
|
-
return new Response('{"media":{"code":"ABC123"}}', { status: 200 });
|
|
270
|
-
};
|
|
271
|
-
const response = await publishImagesViaPrivateApi({
|
|
272
|
-
page: {},
|
|
273
|
-
imagePaths: [jpeg],
|
|
274
|
-
caption: 'private single',
|
|
275
|
-
apiContext: {
|
|
276
|
-
asbdId: '359341',
|
|
277
|
-
csrfToken: 'csrf-token',
|
|
278
|
-
igAppId: '936619743392459',
|
|
279
|
-
igWwwClaim: 'hmac.claim',
|
|
280
|
-
instagramAjax: '1036517563',
|
|
281
|
-
webSessionId: 'abc:def:ghi',
|
|
282
|
-
},
|
|
283
|
-
jazoest: '22047',
|
|
284
|
-
now: () => 111,
|
|
285
|
-
fetcher,
|
|
286
|
-
});
|
|
287
|
-
expect(calls).toHaveLength(2);
|
|
288
|
-
expect(calls[0]?.url).toContain('https://i.instagram.com/rupload_igphoto/fb_uploader_111');
|
|
289
|
-
expect(calls[0]?.init?.headers).toMatchObject({
|
|
290
|
-
'Content-Type': 'image/jpeg',
|
|
291
|
-
'X-Entity-Length': String(fs.statSync(jpeg).size),
|
|
292
|
-
'X-Entity-Name': 'fb_uploader_111',
|
|
293
|
-
'X-IG-App-ID': '936619743392459',
|
|
294
|
-
});
|
|
295
|
-
expect(calls[1]?.url).toBe('https://www.instagram.com/api/v1/media/configure/');
|
|
296
|
-
expect(String(calls[1]?.init?.body || '')).toContain('upload_id=111');
|
|
297
|
-
expect(response).toEqual({ code: 'ABC123', uploadIds: ['111'] });
|
|
298
|
-
});
|
|
299
|
-
it('publishes a single image story through rupload + configure_to_story', async () => {
|
|
300
|
-
const jpeg = createTempFile('private-story.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080010000903012200021101031101FFD9', 'hex'));
|
|
301
|
-
const calls = [];
|
|
302
|
-
const fetcher = async (url, init) => {
|
|
303
|
-
calls.push({ url: String(url), init });
|
|
304
|
-
if (String(url).includes('/rupload_igphoto/')) {
|
|
305
|
-
return new Response('{"upload_id":"111","status":"ok"}', { status: 200 });
|
|
306
|
-
}
|
|
307
|
-
return new Response('{"media":{"pk":"1234567890"}}', { status: 200 });
|
|
308
|
-
};
|
|
309
|
-
const response = await publishStoryViaPrivateApi({
|
|
310
|
-
page: {},
|
|
311
|
-
mediaItem: { type: 'image', filePath: jpeg },
|
|
312
|
-
content: '',
|
|
313
|
-
currentUserId: '61236465677',
|
|
314
|
-
apiContext: {
|
|
315
|
-
asbdId: '359341',
|
|
316
|
-
csrfToken: 'csrf-token',
|
|
317
|
-
igAppId: '936619743392459',
|
|
318
|
-
igWwwClaim: 'hmac.claim',
|
|
319
|
-
instagramAjax: '1036517563',
|
|
320
|
-
webSessionId: 'abc:def:ghi',
|
|
321
|
-
},
|
|
322
|
-
jazoest: '22047',
|
|
323
|
-
now: () => 111,
|
|
324
|
-
fetcher,
|
|
325
|
-
prepareMediaAsset: async () => ({
|
|
326
|
-
type: 'image',
|
|
327
|
-
asset: {
|
|
328
|
-
filePath: jpeg,
|
|
329
|
-
fileName: path.basename(jpeg),
|
|
330
|
-
mimeType: 'image/jpeg',
|
|
331
|
-
width: 1080,
|
|
332
|
-
height: 1920,
|
|
333
|
-
byteLength: fs.statSync(jpeg).size,
|
|
334
|
-
bytes: fs.readFileSync(jpeg),
|
|
335
|
-
},
|
|
336
|
-
}),
|
|
337
|
-
});
|
|
338
|
-
expect(calls).toHaveLength(2);
|
|
339
|
-
expect(calls[0]?.url).toContain('/rupload_igphoto/fb_uploader_111');
|
|
340
|
-
expect(calls[1]?.url).toBe('https://i.instagram.com/api/v1/media/configure_to_story/');
|
|
341
|
-
expect(String(calls[1]?.init?.body || '')).toContain('signed_body=');
|
|
342
|
-
expect(response).toEqual({ mediaPk: '1234567890', uploadId: '111' });
|
|
343
|
-
});
|
|
344
|
-
it('publishes a single video story through rupload + cover + configure_to_story?video=1', async () => {
|
|
345
|
-
const video = createTempFile('private-story.mp4', Buffer.from('story-video'));
|
|
346
|
-
const coverBytes = Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080010000903012200021101031101FFD9', 'hex');
|
|
347
|
-
const calls = [];
|
|
348
|
-
const fetcher = async (url, init) => {
|
|
349
|
-
calls.push({ url: String(url), init });
|
|
350
|
-
if (String(url).includes('/rupload_igvideo/')) {
|
|
351
|
-
return new Response('{"upload_id":"222","status":"ok"}', { status: 200 });
|
|
352
|
-
}
|
|
353
|
-
if (String(url).includes('/rupload_igphoto/')) {
|
|
354
|
-
return new Response('{"upload_id":"222","status":"ok"}', { status: 200 });
|
|
355
|
-
}
|
|
356
|
-
return new Response('{"media":{"pk":"9988776655"}}', { status: 200 });
|
|
357
|
-
};
|
|
358
|
-
const response = await publishStoryViaPrivateApi({
|
|
359
|
-
page: {},
|
|
360
|
-
mediaItem: { type: 'video', filePath: video },
|
|
361
|
-
content: '',
|
|
362
|
-
currentUserId: '61236465677',
|
|
363
|
-
apiContext: {
|
|
364
|
-
asbdId: '359341',
|
|
365
|
-
csrfToken: 'csrf-token',
|
|
366
|
-
igAppId: '936619743392459',
|
|
367
|
-
igWwwClaim: 'hmac.claim',
|
|
368
|
-
instagramAjax: '1036517563',
|
|
369
|
-
webSessionId: 'abc:def:ghi',
|
|
370
|
-
},
|
|
371
|
-
jazoest: '22047',
|
|
372
|
-
now: () => 222,
|
|
373
|
-
fetcher,
|
|
374
|
-
prepareMediaAsset: async () => ({
|
|
375
|
-
type: 'video',
|
|
376
|
-
asset: {
|
|
377
|
-
filePath: video,
|
|
378
|
-
fileName: path.basename(video),
|
|
379
|
-
mimeType: 'video/mp4',
|
|
380
|
-
width: 1080,
|
|
381
|
-
height: 1920,
|
|
382
|
-
durationMs: 12500,
|
|
383
|
-
byteLength: fs.statSync(video).size,
|
|
384
|
-
bytes: fs.readFileSync(video),
|
|
385
|
-
coverImage: {
|
|
386
|
-
filePath: '/tmp/cover.jpg',
|
|
387
|
-
fileName: 'cover.jpg',
|
|
388
|
-
mimeType: 'image/jpeg',
|
|
389
|
-
width: 1080,
|
|
390
|
-
height: 1920,
|
|
391
|
-
byteLength: coverBytes.length,
|
|
392
|
-
bytes: coverBytes,
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
}),
|
|
396
|
-
});
|
|
397
|
-
expect(calls).toHaveLength(4);
|
|
398
|
-
expect(calls[0]?.url).toContain('/rupload_igvideo/fb_uploader_222');
|
|
399
|
-
expect(calls[1]?.url).toContain('/rupload_igphoto/fb_uploader_222');
|
|
400
|
-
expect(calls[2]?.url).toBe('https://i.instagram.com/api/v1/media/configure_to_story/');
|
|
401
|
-
expect(calls[3]?.url).toBe('https://i.instagram.com/api/v1/media/configure_to_story/?video=1');
|
|
402
|
-
expect(String(calls[2]?.init?.body || '')).toContain('signed_body=');
|
|
403
|
-
expect(String(calls[3]?.init?.body || '')).toContain('signed_body=');
|
|
404
|
-
expect(response).toEqual({ mediaPk: '9988776655', uploadId: '222' });
|
|
405
|
-
});
|
|
406
|
-
it('publishes a carousel through rupload + configure_sidecar', async () => {
|
|
407
|
-
const first = createTempFile('private-carousel-1.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
408
|
-
const second = createTempFile('private-carousel-2.png', Buffer.from('89504E470D0A1A0A0000000D49484452000000030000000508060000008D6F26E50000000049454E44AE426082', 'hex'));
|
|
409
|
-
const calls = [];
|
|
410
|
-
let uploadCounter = 0;
|
|
411
|
-
const fetcher = async (url, init) => {
|
|
412
|
-
calls.push({ url: String(url), init });
|
|
413
|
-
if (String(url).includes('/rupload_igphoto/')) {
|
|
414
|
-
uploadCounter += 1;
|
|
415
|
-
return new Response(JSON.stringify({ upload_id: String(200 + uploadCounter), status: 'ok' }), { status: 200 });
|
|
416
|
-
}
|
|
417
|
-
return new Response('{"media":{"code":"SIDE123"}}', { status: 200 });
|
|
418
|
-
};
|
|
419
|
-
const response = await publishImagesViaPrivateApi({
|
|
420
|
-
page: {},
|
|
421
|
-
imagePaths: [first, second],
|
|
422
|
-
caption: 'private carousel',
|
|
423
|
-
apiContext: {
|
|
424
|
-
asbdId: '359341',
|
|
425
|
-
csrfToken: 'csrf-token',
|
|
426
|
-
igAppId: '936619743392459',
|
|
427
|
-
igWwwClaim: 'hmac.claim',
|
|
428
|
-
instagramAjax: '1036517563',
|
|
429
|
-
webSessionId: 'abc:def:ghi',
|
|
430
|
-
},
|
|
431
|
-
jazoest: '22047',
|
|
432
|
-
now: () => 200,
|
|
433
|
-
fetcher,
|
|
434
|
-
prepareAsset: async (filePath) => readImageAsset(filePath),
|
|
435
|
-
});
|
|
436
|
-
expect(calls).toHaveLength(3);
|
|
437
|
-
expect(calls[2]?.url).toBe('https://www.instagram.com/api/v1/media/configure_sidecar/');
|
|
438
|
-
expect(JSON.parse(String(calls[2]?.init?.body || '{}'))).toMatchObject({
|
|
439
|
-
caption: 'private carousel',
|
|
440
|
-
client_sidecar_id: '200',
|
|
441
|
-
children_metadata: [{ upload_id: '201' }, { upload_id: '202' }],
|
|
442
|
-
});
|
|
443
|
-
expect(response).toEqual({ code: 'SIDE123', uploadIds: ['201', '202'] });
|
|
444
|
-
});
|
|
445
|
-
it('uses prepared assets when private carousel upload needs aspect-ratio normalization', async () => {
|
|
446
|
-
const first = createTempFile('private-carousel-normalize-1.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
447
|
-
const second = createTempFile('private-carousel-normalize-2.png', Buffer.from('89504E470D0A1A0A0000000D49484452000000030000000508060000008D6F26E50000000049454E44AE426082', 'hex'));
|
|
448
|
-
const calls = [];
|
|
449
|
-
let uploadCounter = 0;
|
|
450
|
-
const fetcher = async (url, init) => {
|
|
451
|
-
calls.push({ url: String(url), init });
|
|
452
|
-
if (String(url).includes('/rupload_igphoto/')) {
|
|
453
|
-
uploadCounter += 1;
|
|
454
|
-
return new Response(JSON.stringify({ upload_id: String(400 + uploadCounter), status: 'ok' }), { status: 200 });
|
|
455
|
-
}
|
|
456
|
-
return new Response('{"media":{"code":"SIDEPAD"}}', { status: 200 });
|
|
457
|
-
};
|
|
458
|
-
const preparedBytes = Buffer.from('89504E470D0A1A0A0000000D49484452000007FD000009FC08060000008D6F26E50000000049454E44AE426082', 'hex');
|
|
459
|
-
const response = await publishImagesViaPrivateApi({
|
|
460
|
-
page: {},
|
|
461
|
-
imagePaths: [first, second],
|
|
462
|
-
caption: 'private carousel normalized',
|
|
463
|
-
apiContext: {
|
|
464
|
-
asbdId: '359341',
|
|
465
|
-
csrfToken: 'csrf-token',
|
|
466
|
-
igAppId: '936619743392459',
|
|
467
|
-
igWwwClaim: 'hmac.claim',
|
|
468
|
-
instagramAjax: '1036517563',
|
|
469
|
-
webSessionId: 'abc:def:ghi',
|
|
470
|
-
},
|
|
471
|
-
jazoest: '22047',
|
|
472
|
-
now: () => 400,
|
|
473
|
-
fetcher,
|
|
474
|
-
prepareAsset: async (filePath) => {
|
|
475
|
-
if (filePath === second) {
|
|
476
|
-
return {
|
|
477
|
-
filePath: '/tmp/normalized.png',
|
|
478
|
-
fileName: 'normalized.png',
|
|
479
|
-
mimeType: 'image/png',
|
|
480
|
-
width: 2045,
|
|
481
|
-
height: 2556,
|
|
482
|
-
byteLength: preparedBytes.length,
|
|
483
|
-
bytes: preparedBytes,
|
|
484
|
-
cleanupPath: '/tmp/normalized.png',
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
return readImageAsset(filePath);
|
|
488
|
-
},
|
|
489
|
-
});
|
|
490
|
-
const secondUploadHeaders = calls[1]?.init?.headers ?? {};
|
|
491
|
-
expect(JSON.parse(String(secondUploadHeaders['X-Instagram-Rupload-Params'] || '{}'))).toMatchObject({
|
|
492
|
-
upload_media_width: 2045,
|
|
493
|
-
upload_media_height: 2556,
|
|
494
|
-
});
|
|
495
|
-
expect(response).toEqual({ code: 'SIDEPAD', uploadIds: ['401', '402'] });
|
|
496
|
-
});
|
|
497
|
-
it('includes the response body when configure_sidecar returns a 400', async () => {
|
|
498
|
-
const first = createTempFile('private-carousel-error-1.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
499
|
-
const second = createTempFile('private-carousel-error-2.png', Buffer.from('89504E470D0A1A0A0000000D49484452000000030000000508060000008D6F26E50000000049454E44AE426082', 'hex'));
|
|
500
|
-
let uploadCounter = 0;
|
|
501
|
-
const fetcher = async (url) => {
|
|
502
|
-
if (String(url).includes('/rupload_igphoto/')) {
|
|
503
|
-
uploadCounter += 1;
|
|
504
|
-
return new Response(JSON.stringify({ upload_id: String(300 + uploadCounter), status: 'ok' }), { status: 200 });
|
|
505
|
-
}
|
|
506
|
-
return new Response('{"message":"children_metadata invalid"}', { status: 400 });
|
|
507
|
-
};
|
|
508
|
-
await expect(publishImagesViaPrivateApi({
|
|
509
|
-
page: {},
|
|
510
|
-
imagePaths: [first, second],
|
|
511
|
-
caption: 'private carousel',
|
|
512
|
-
apiContext: {
|
|
513
|
-
asbdId: '359341',
|
|
514
|
-
csrfToken: 'csrf-token',
|
|
515
|
-
igAppId: '936619743392459',
|
|
516
|
-
igWwwClaim: 'hmac.claim',
|
|
517
|
-
instagramAjax: '1036517563',
|
|
518
|
-
webSessionId: 'abc:def:ghi',
|
|
519
|
-
},
|
|
520
|
-
jazoest: '22047',
|
|
521
|
-
now: () => 300,
|
|
522
|
-
fetcher,
|
|
523
|
-
prepareAsset: async (filePath) => readImageAsset(filePath),
|
|
524
|
-
})).rejects.toThrow('children_metadata invalid');
|
|
525
|
-
});
|
|
526
|
-
it('retries transient rupload fetch failures and still completes the carousel publish', async () => {
|
|
527
|
-
const first = createTempFile('private-carousel-retry-1.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
528
|
-
const second = createTempFile('private-carousel-retry-2.png', Buffer.from('89504E470D0A1A0A0000000D49484452000000030000000508060000008D6F26E50000000049454E44AE426082', 'hex'));
|
|
529
|
-
const calls = [];
|
|
530
|
-
let firstUploadAttempts = 0;
|
|
531
|
-
let uploadCounter = 0;
|
|
532
|
-
const fetcher = async (url) => {
|
|
533
|
-
const value = String(url);
|
|
534
|
-
calls.push(value);
|
|
535
|
-
if (value.includes('/rupload_igphoto/')) {
|
|
536
|
-
firstUploadAttempts += value.includes('fb_uploader_501') ? 1 : 0;
|
|
537
|
-
if (value.includes('fb_uploader_501') && firstUploadAttempts === 1) {
|
|
538
|
-
throw new TypeError('fetch failed');
|
|
539
|
-
}
|
|
540
|
-
uploadCounter += 1;
|
|
541
|
-
return new Response(JSON.stringify({ upload_id: String(500 + uploadCounter), status: 'ok' }), { status: 200 });
|
|
542
|
-
}
|
|
543
|
-
return new Response('{"media":{"code":"SIDERETRY"}}', { status: 200 });
|
|
544
|
-
};
|
|
545
|
-
const response = await publishImagesViaPrivateApi({
|
|
546
|
-
page: {},
|
|
547
|
-
imagePaths: [first, second],
|
|
548
|
-
caption: 'private carousel retry',
|
|
549
|
-
apiContext: {
|
|
550
|
-
asbdId: '359341',
|
|
551
|
-
csrfToken: 'csrf-token',
|
|
552
|
-
igAppId: '936619743392459',
|
|
553
|
-
igWwwClaim: 'hmac.claim',
|
|
554
|
-
instagramAjax: '1036517563',
|
|
555
|
-
webSessionId: 'abc:def:ghi',
|
|
556
|
-
},
|
|
557
|
-
jazoest: '22047',
|
|
558
|
-
now: () => 500,
|
|
559
|
-
fetcher,
|
|
560
|
-
prepareAsset: async (filePath) => readImageAsset(filePath),
|
|
561
|
-
});
|
|
562
|
-
expect(calls.filter((url) => url.includes('fb_uploader_501'))).toHaveLength(2);
|
|
563
|
-
expect(response).toEqual({ code: 'SIDERETRY', uploadIds: ['501', '502'] });
|
|
564
|
-
});
|
|
565
|
-
it('does not retry transient configure_sidecar fetch failures to avoid duplicate posts', async () => {
|
|
566
|
-
const first = createTempFile('private-carousel-no-retry-1.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
567
|
-
const second = createTempFile('private-carousel-no-retry-2.png', Buffer.from('89504E470D0A1A0A0000000D49484452000000030000000508060000008D6F26E50000000049454E44AE426082', 'hex'));
|
|
568
|
-
const calls = [];
|
|
569
|
-
let uploadCounter = 0;
|
|
570
|
-
const fetcher = async (url) => {
|
|
571
|
-
const value = String(url);
|
|
572
|
-
calls.push(value);
|
|
573
|
-
if (value.includes('/rupload_igphoto/')) {
|
|
574
|
-
uploadCounter += 1;
|
|
575
|
-
return new Response(JSON.stringify({ upload_id: String(600 + uploadCounter), status: 'ok' }), { status: 200 });
|
|
576
|
-
}
|
|
577
|
-
throw new TypeError('fetch failed');
|
|
578
|
-
};
|
|
579
|
-
await expect(publishImagesViaPrivateApi({
|
|
580
|
-
page: {},
|
|
581
|
-
imagePaths: [first, second],
|
|
582
|
-
caption: 'private no retry configure',
|
|
583
|
-
apiContext: {
|
|
584
|
-
asbdId: '359341',
|
|
585
|
-
csrfToken: 'csrf-token',
|
|
586
|
-
igAppId: '936619743392459',
|
|
587
|
-
igWwwClaim: 'hmac.claim',
|
|
588
|
-
instagramAjax: '1036517563',
|
|
589
|
-
webSessionId: 'abc:def:ghi',
|
|
590
|
-
},
|
|
591
|
-
jazoest: '22047',
|
|
592
|
-
now: () => 600,
|
|
593
|
-
fetcher,
|
|
594
|
-
prepareAsset: async (filePath) => readImageAsset(filePath),
|
|
595
|
-
})).rejects.toThrow('fetch failed');
|
|
596
|
-
expect(calls.filter((url) => url.includes('configure_sidecar'))).toHaveLength(1);
|
|
597
|
-
});
|
|
598
|
-
it('publishes a mixed image/video carousel and polls configure_sidecar until transcoding finishes', async () => {
|
|
599
|
-
const image = createTempFile('mixed-private-image.jpg', Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080004000603012200021101031101FFD9', 'hex'));
|
|
600
|
-
const video = createTempFile('mixed-private-video.mp4', Buffer.from('video-binary'));
|
|
601
|
-
const coverBytes = Buffer.from('FFD8FFE000104A46494600010100000100010000FFC00011080168028003012200021101031101FFD9', 'hex');
|
|
602
|
-
const calls = [];
|
|
603
|
-
let configureAttempts = 0;
|
|
604
|
-
const fetcher = async (url, init) => {
|
|
605
|
-
const value = String(url);
|
|
606
|
-
calls.push({ url: value, init });
|
|
607
|
-
if (value.includes('/rupload_igphoto/') && value.includes('fb_uploader_701')) {
|
|
608
|
-
return new Response('{"upload_id":"701","status":"ok"}', { status: 200 });
|
|
609
|
-
}
|
|
610
|
-
if (value.includes('/rupload_igvideo/') && value.includes('fb_uploader_702')) {
|
|
611
|
-
return new Response('{"media_id":17944674009157009,"status":"ok"}', { status: 200 });
|
|
612
|
-
}
|
|
613
|
-
if (value.includes('/rupload_igphoto/') && value.includes('fb_uploader_702')) {
|
|
614
|
-
return new Response('{"upload_id":"702","status":"ok"}', { status: 200 });
|
|
615
|
-
}
|
|
616
|
-
configureAttempts += 1;
|
|
617
|
-
if (configureAttempts === 1) {
|
|
618
|
-
return new Response('{"message":"Transcode not finished yet.","status":"fail"}', { status: 202 });
|
|
619
|
-
}
|
|
620
|
-
return new Response('{"status":"ok","media":{"code":"MIXEDSIDE123"}}', { status: 200 });
|
|
621
|
-
};
|
|
622
|
-
const response = await publishMediaViaPrivateApi({
|
|
623
|
-
page: {},
|
|
624
|
-
mediaItems: [
|
|
625
|
-
{ type: 'image', filePath: image },
|
|
626
|
-
{ type: 'video', filePath: video },
|
|
627
|
-
],
|
|
628
|
-
caption: 'mixed private carousel',
|
|
629
|
-
apiContext: {
|
|
630
|
-
asbdId: '359341',
|
|
631
|
-
csrfToken: 'csrf-token',
|
|
632
|
-
igAppId: '936619743392459',
|
|
633
|
-
igWwwClaim: 'hmac.claim',
|
|
634
|
-
instagramAjax: '1036517563',
|
|
635
|
-
webSessionId: 'abc:def:ghi',
|
|
636
|
-
},
|
|
637
|
-
jazoest: '22047',
|
|
638
|
-
now: () => 700,
|
|
639
|
-
fetcher,
|
|
640
|
-
prepareMediaAsset: async (item) => {
|
|
641
|
-
if (item.type === 'image') {
|
|
642
|
-
return {
|
|
643
|
-
type: 'image',
|
|
644
|
-
asset: readImageAsset(item.filePath),
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
return {
|
|
648
|
-
type: 'video',
|
|
649
|
-
asset: {
|
|
650
|
-
filePath: item.filePath,
|
|
651
|
-
fileName: 'mixed-private-video.mp4',
|
|
652
|
-
mimeType: 'video/mp4',
|
|
653
|
-
width: 640,
|
|
654
|
-
height: 360,
|
|
655
|
-
durationMs: 28245,
|
|
656
|
-
byteLength: 12,
|
|
657
|
-
bytes: Buffer.from('video-binary'),
|
|
658
|
-
coverImage: {
|
|
659
|
-
filePath: '/tmp/mixed-private-cover.jpg',
|
|
660
|
-
fileName: 'mixed-private-cover.jpg',
|
|
661
|
-
mimeType: 'image/jpeg',
|
|
662
|
-
width: 640,
|
|
663
|
-
height: 360,
|
|
664
|
-
byteLength: coverBytes.length,
|
|
665
|
-
bytes: coverBytes,
|
|
666
|
-
},
|
|
667
|
-
},
|
|
668
|
-
};
|
|
669
|
-
},
|
|
670
|
-
waitMs: async () => undefined,
|
|
671
|
-
});
|
|
672
|
-
expect(calls).toHaveLength(5);
|
|
673
|
-
expect(calls[0]?.url).toContain('/rupload_igphoto/fb_uploader_701');
|
|
674
|
-
expect(calls[1]?.url).toContain('/rupload_igvideo/fb_uploader_702');
|
|
675
|
-
expect(calls[2]?.url).toContain('/rupload_igphoto/fb_uploader_702');
|
|
676
|
-
expect(JSON.parse(String(calls[1]?.init?.headers?.['X-Instagram-Rupload-Params'] || '{}'))).toMatchObject({
|
|
677
|
-
media_type: 2,
|
|
678
|
-
upload_id: '702',
|
|
679
|
-
upload_media_width: 640,
|
|
680
|
-
upload_media_height: 360,
|
|
681
|
-
upload_media_duration_ms: 28245,
|
|
682
|
-
video_edit_params: {
|
|
683
|
-
crop_width: 360,
|
|
684
|
-
crop_height: 360,
|
|
685
|
-
crop_x1: 140,
|
|
686
|
-
crop_y1: 0,
|
|
687
|
-
trim_start: 0,
|
|
688
|
-
trim_end: 28.245,
|
|
689
|
-
mute: false,
|
|
690
|
-
},
|
|
691
|
-
});
|
|
692
|
-
expect(JSON.parse(String(calls[2]?.init?.headers?.['X-Instagram-Rupload-Params'] || '{}'))).toMatchObject({
|
|
693
|
-
media_type: 2,
|
|
694
|
-
upload_id: '702',
|
|
695
|
-
upload_media_width: 640,
|
|
696
|
-
upload_media_height: 360,
|
|
697
|
-
});
|
|
698
|
-
expect(JSON.parse(String(calls[3]?.init?.body || '{}'))).toMatchObject({
|
|
699
|
-
caption: 'mixed private carousel',
|
|
700
|
-
client_sidecar_id: '700',
|
|
701
|
-
children_metadata: [{ upload_id: '701' }, { upload_id: '702' }],
|
|
702
|
-
});
|
|
703
|
-
expect(response).toEqual({ code: 'MIXEDSIDE123', uploadIds: ['701', '702'] });
|
|
704
|
-
});
|
|
705
|
-
});
|