@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
package/clis/jd/item.test.js
DELETED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { JSDOM } from 'jsdom';
|
|
3
|
-
import { getRegistry } from '@sovovs/bycli/registry';
|
|
4
|
-
import { AuthRequiredError } from '@sovovs/bycli/errors';
|
|
5
|
-
import { __test__ } from './item.js';
|
|
6
|
-
import './item.js';
|
|
7
|
-
const originalPerformance = globalThis.performance;
|
|
8
|
-
const originalWindow = globalThis.window;
|
|
9
|
-
const originalDocument = globalThis.document;
|
|
10
|
-
function restoreGlobals() {
|
|
11
|
-
globalThis.performance = originalPerformance;
|
|
12
|
-
globalThis.window = originalWindow;
|
|
13
|
-
globalThis.document = originalDocument;
|
|
14
|
-
}
|
|
15
|
-
describe('jd item adapter', () => {
|
|
16
|
-
const command = getRegistry().get('jd/item');
|
|
17
|
-
it('registers the command with correct shape', () => {
|
|
18
|
-
expect(command).toBeDefined();
|
|
19
|
-
expect(command.site).toBe('jd');
|
|
20
|
-
expect(command.name).toBe('item');
|
|
21
|
-
expect(command.domain).toBe('item.jd.com');
|
|
22
|
-
expect(command.strategy).toBe('cookie');
|
|
23
|
-
expect(typeof command.func).toBe('function');
|
|
24
|
-
});
|
|
25
|
-
it('has sku as a required positional arg', () => {
|
|
26
|
-
const skuArg = command.args.find((a) => a.name === 'sku');
|
|
27
|
-
expect(skuArg).toBeDefined();
|
|
28
|
-
expect(skuArg.required).toBe(true);
|
|
29
|
-
expect(skuArg.positional).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
it('has images arg with default 200', () => {
|
|
32
|
-
const imagesArg = command.args.find((a) => a.name === 'images');
|
|
33
|
-
expect(imagesArg).toBeDefined();
|
|
34
|
-
expect(imagesArg.default).toBe(200);
|
|
35
|
-
});
|
|
36
|
-
it('fails fast when JD blocks the item page', async () => {
|
|
37
|
-
const page = {
|
|
38
|
-
evaluate: vi.fn()
|
|
39
|
-
.mockResolvedValueOnce('https://item.jd.com/100328272886.html')
|
|
40
|
-
.mockResolvedValueOnce({ looksBlocked: true })
|
|
41
|
-
.mockResolvedValueOnce({
|
|
42
|
-
error: 'JD page is blocked by login/security verification',
|
|
43
|
-
pageState: { looksBlocked: true },
|
|
44
|
-
}),
|
|
45
|
-
goto: vi.fn(),
|
|
46
|
-
wait: vi.fn(),
|
|
47
|
-
};
|
|
48
|
-
await expect(command.func(page, { sku: '100328272886', images: 5 })).rejects.toBeInstanceOf(AuthRequiredError);
|
|
49
|
-
expect(page.goto).not.toHaveBeenCalled();
|
|
50
|
-
});
|
|
51
|
-
it('fails fast when a loaded product page has no detail images', async () => {
|
|
52
|
-
const page = {
|
|
53
|
-
evaluate: vi.fn()
|
|
54
|
-
.mockResolvedValueOnce('https://item.jd.com/100328272886.html')
|
|
55
|
-
.mockResolvedValueOnce({ looksBlocked: false })
|
|
56
|
-
.mockResolvedValueOnce(undefined)
|
|
57
|
-
.mockResolvedValueOnce(null)
|
|
58
|
-
.mockResolvedValueOnce({
|
|
59
|
-
title: 'JD product',
|
|
60
|
-
price: '100',
|
|
61
|
-
shop: '京东自营',
|
|
62
|
-
specs: {},
|
|
63
|
-
mainImages: ['https://img10.360buyimg.com/pcpubliccms/jfs/t1/main.jpg'],
|
|
64
|
-
detailImages: [],
|
|
65
|
-
pageState: { isProductPage: true, looksBlocked: false },
|
|
66
|
-
}),
|
|
67
|
-
goto: vi.fn(),
|
|
68
|
-
wait: vi.fn(),
|
|
69
|
-
};
|
|
70
|
-
await expect(command.func(page, { sku: '100328272886', images: 5 })).rejects.toThrow('JD item detail images were not found');
|
|
71
|
-
});
|
|
72
|
-
it('allows zero-image requests to skip detail image fail-fast', async () => {
|
|
73
|
-
const data = {
|
|
74
|
-
title: 'JD product',
|
|
75
|
-
price: '100',
|
|
76
|
-
shop: '京东自营',
|
|
77
|
-
specs: {},
|
|
78
|
-
mainImages: [],
|
|
79
|
-
detailImages: [],
|
|
80
|
-
pageState: { isProductPage: true, looksBlocked: false },
|
|
81
|
-
};
|
|
82
|
-
const page = {
|
|
83
|
-
evaluate: vi.fn()
|
|
84
|
-
.mockResolvedValueOnce('https://item.jd.com/100328272886.html')
|
|
85
|
-
.mockResolvedValueOnce({ looksBlocked: false })
|
|
86
|
-
.mockResolvedValueOnce(undefined)
|
|
87
|
-
.mockResolvedValueOnce(null)
|
|
88
|
-
.mockResolvedValueOnce(data),
|
|
89
|
-
goto: vi.fn(),
|
|
90
|
-
wait: vi.fn(),
|
|
91
|
-
};
|
|
92
|
-
await expect(command.func(page, { sku: '100328272886', images: 0 })).resolves.toEqual([data]);
|
|
93
|
-
});
|
|
94
|
-
it('normalizes JD item URL input to a SKU before building selectors', () => {
|
|
95
|
-
expect(__test__.normalizeJdSkuInput('100328272886')).toBe('100328272886');
|
|
96
|
-
expect(__test__.normalizeJdSkuInput('https://item.jd.com/100328272886.html?purchasetab=gfgm')).toBe('100328272886');
|
|
97
|
-
expect(__test__.normalizeJdSkuInput('skuId=10218494560141')).toBe('10218494560141');
|
|
98
|
-
});
|
|
99
|
-
it('includes expected columns', () => {
|
|
100
|
-
expect(command.columns).toEqual(expect.arrayContaining(['title', 'price', 'shop', 'specs', 'mainImages', 'detailImages']));
|
|
101
|
-
expect(command.columns).not.toContain('avifImages');
|
|
102
|
-
});
|
|
103
|
-
it('extracts only detail avif images and respects the limit', () => {
|
|
104
|
-
const result = __test__.extractAvifImages([
|
|
105
|
-
'https://img14.360buyimg.com/n1/jfs/t1/normal.jpg',
|
|
106
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/detail.avif',
|
|
107
|
-
'https://pcpubliccms.jd.com/image1.avif',
|
|
108
|
-
'https://pcpubliccms.jd.com/image1.avif',
|
|
109
|
-
'https://pcpubliccms.jd.com/image2.avif?x=1',
|
|
110
|
-
'https://example.com/not-jd.avif',
|
|
111
|
-
], 2);
|
|
112
|
-
expect(result).toEqual([
|
|
113
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/detail.avif',
|
|
114
|
-
]);
|
|
115
|
-
});
|
|
116
|
-
it('treats WareGraphic sku images as detail images only for WareGraphic fallback', () => {
|
|
117
|
-
expect(__test__.isJdDetailImage('https://img10.360buyimg.com/sku/jfs/t1/color-option.gif')).toBe(false);
|
|
118
|
-
expect(__test__.isJdWareGraphicDetailImage('https://img10.360buyimg.com/sku/jfs/t1/ware-graphic.jpg')).toBe(true);
|
|
119
|
-
expect(__test__.isJdWareGraphicDetailImage('https://img10.360buyimg.com/sku/s228x228_jfs/t1/thumb.jpg')).toBe(false);
|
|
120
|
-
});
|
|
121
|
-
it('keeps main gallery images while ignoring unrelated contexts for detail images', () => {
|
|
122
|
-
const dom = new JSDOM(`
|
|
123
|
-
<div class="_gallery_116km_1">
|
|
124
|
-
<img src="https://img10.360buyimg.com/pcpubliccms/jfs/t1/main-a.jpg" />
|
|
125
|
-
<img data-src="//img10.360buyimg.com/n1/jfs/t1/main-b.jpg" />
|
|
126
|
-
</div>
|
|
127
|
-
<div class="recommend">
|
|
128
|
-
<img src="https://img10.360buyimg.com/imgzone/jfs/t1/recommend.jpg.avif" />
|
|
129
|
-
</div>
|
|
130
|
-
<div class="detail-content-wrap">
|
|
131
|
-
<img src="https://img10.360buyimg.com/imgzone/jfs/t1/detail-a.jpg.avif" />
|
|
132
|
-
</div>
|
|
133
|
-
`);
|
|
134
|
-
const previousDocument = globalThis.document;
|
|
135
|
-
globalThis.document = dom.window.document;
|
|
136
|
-
try {
|
|
137
|
-
expect(__test__.extractMainImages(10)).toEqual([
|
|
138
|
-
'https://img10.360buyimg.com/pcpubliccms/jfs/t1/main-a.jpg',
|
|
139
|
-
'https://img10.360buyimg.com/n1/jfs/t1/main-b.jpg',
|
|
140
|
-
]);
|
|
141
|
-
expect(__test__.extractDetailImagesFromDom(10)).toEqual([
|
|
142
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/detail-a.jpg.avif',
|
|
143
|
-
]);
|
|
144
|
-
}
|
|
145
|
-
finally {
|
|
146
|
-
globalThis.document = previousDocument;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
it('collects JD detail images from computed background images', () => {
|
|
150
|
-
const dom = new JSDOM(`
|
|
151
|
-
<div id="J-detail">
|
|
152
|
-
<div class="ssd-module computed-bg"></div>
|
|
153
|
-
<div class="ssd-module ignored-bg"></div>
|
|
154
|
-
</div>
|
|
155
|
-
`);
|
|
156
|
-
const previousDocument = globalThis.document;
|
|
157
|
-
const previousGetComputedStyle = globalThis.getComputedStyle;
|
|
158
|
-
globalThis.document = dom.window.document;
|
|
159
|
-
globalThis.getComputedStyle = ((element) => ({
|
|
160
|
-
background: '',
|
|
161
|
-
backgroundImage: element.classList.contains('computed-bg')
|
|
162
|
-
? 'url("//img10.360buyimg.com/imgzone/jfs/t1/computed-detail.jpg.avif")'
|
|
163
|
-
: 'none',
|
|
164
|
-
}));
|
|
165
|
-
try {
|
|
166
|
-
expect(__test__.extractDetailImagesFromDom(10)).toEqual([
|
|
167
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/computed-detail.jpg.avif',
|
|
168
|
-
]);
|
|
169
|
-
}
|
|
170
|
-
finally {
|
|
171
|
-
globalThis.document = previousDocument;
|
|
172
|
-
globalThis.getComputedStyle = previousGetComputedStyle;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
it('collects JD detail images from inline JSON-like script text', () => {
|
|
176
|
-
const dom = new JSDOM(`
|
|
177
|
-
<h2 id="SPXQ-title">商品详情</h2>
|
|
178
|
-
<script>
|
|
179
|
-
window.__DETAIL_DATA__ = {
|
|
180
|
-
images: [
|
|
181
|
-
"https://img10.360buyimg.com/imgzone/jfs/t1/script-detail-a.jpg.avif",
|
|
182
|
-
"//img11.360buyimg.com/imgzone/jfs/t1/script-detail-b.gif"
|
|
183
|
-
]
|
|
184
|
-
};
|
|
185
|
-
</script>
|
|
186
|
-
`);
|
|
187
|
-
const previousDocument = globalThis.document;
|
|
188
|
-
globalThis.document = dom.window.document;
|
|
189
|
-
try {
|
|
190
|
-
expect(__test__.extractDetailImagesFromDom(10)).toEqual([
|
|
191
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/script-detail-a.jpg.avif',
|
|
192
|
-
'https://img11.360buyimg.com/imgzone/jfs/t1/script-detail-b.gif',
|
|
193
|
-
]);
|
|
194
|
-
}
|
|
195
|
-
finally {
|
|
196
|
-
globalThis.document = previousDocument;
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
it('collects JD detail images from same-origin iframe content', () => {
|
|
200
|
-
const dom = new JSDOM(`
|
|
201
|
-
<h2 id="SPXQ-title">商品详情</h2>
|
|
202
|
-
<iframe id="detail-frame"></iframe>
|
|
203
|
-
`, { url: 'https://item.jd.com/100328272886.html' });
|
|
204
|
-
const frameDom = new JSDOM(`
|
|
205
|
-
<div id="J-detail">
|
|
206
|
-
<img src="https://img10.360buyimg.com/imgzone/jfs/t1/frame-detail-a.jpg.avif" />
|
|
207
|
-
<div style="background-image:url(//img11.360buyimg.com/cms/jfs/t1/frame-detail-b.jpg.avif)"></div>
|
|
208
|
-
</div>
|
|
209
|
-
`, { url: 'https://item.jd.com/detail-frame.html' });
|
|
210
|
-
const iframe = dom.window.document.getElementById('detail-frame');
|
|
211
|
-
Object.defineProperty(iframe, 'contentDocument', { value: frameDom.window.document, configurable: true });
|
|
212
|
-
Object.defineProperty(iframe, 'contentWindow', { value: frameDom.window, configurable: true });
|
|
213
|
-
const previousDocument = globalThis.document;
|
|
214
|
-
globalThis.document = dom.window.document;
|
|
215
|
-
try {
|
|
216
|
-
expect(__test__.extractDetailImagesFromDom(10)).toEqual([
|
|
217
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/frame-detail-a.jpg.avif',
|
|
218
|
-
'https://img11.360buyimg.com/cms/jfs/t1/frame-detail-b.jpg.avif',
|
|
219
|
-
]);
|
|
220
|
-
}
|
|
221
|
-
finally {
|
|
222
|
-
globalThis.document = previousDocument;
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
it('collects JD detail images from page data objects', async () => {
|
|
226
|
-
const dom = new JSDOM(`
|
|
227
|
-
<h2 id="SPXQ-title">商品详情</h2>
|
|
228
|
-
`);
|
|
229
|
-
globalThis.document = dom.window.document;
|
|
230
|
-
globalThis.window = dom.window;
|
|
231
|
-
globalThis.__PAGE_DATA__ = {
|
|
232
|
-
detail: {
|
|
233
|
-
images: [
|
|
234
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/page-data-a.jpg.avif',
|
|
235
|
-
{ src: '//img11.360buyimg.com/imgzone/jfs/t1/page-data-b.webp' },
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
try {
|
|
240
|
-
await expect(__test__.extractDetailImagesFromPage(10)).resolves.toEqual([
|
|
241
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/page-data-a.jpg.avif',
|
|
242
|
-
'https://img11.360buyimg.com/imgzone/jfs/t1/page-data-b.webp',
|
|
243
|
-
]);
|
|
244
|
-
}
|
|
245
|
-
finally {
|
|
246
|
-
delete globalThis.__PAGE_DATA__;
|
|
247
|
-
restoreGlobals();
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
it('collects JD detail images from network resource text', async () => {
|
|
251
|
-
const dom = new JSDOM(`
|
|
252
|
-
<h2 id="SPXQ-title">商品详情</h2>
|
|
253
|
-
`);
|
|
254
|
-
const previousFetch = globalThis.fetch;
|
|
255
|
-
globalThis.document = dom.window.document;
|
|
256
|
-
globalThis.window = dom.window;
|
|
257
|
-
globalThis.performance = {
|
|
258
|
-
getEntriesByType: () => [{ name: 'https://cdn.jd.com/detail/data.json' }],
|
|
259
|
-
now: () => 0,
|
|
260
|
-
};
|
|
261
|
-
globalThis.fetch = (async () => ({
|
|
262
|
-
ok: true,
|
|
263
|
-
headers: { get: () => 'application/json' },
|
|
264
|
-
text: async () => JSON.stringify({
|
|
265
|
-
detail: {
|
|
266
|
-
imgs: ['https://img10.360buyimg.com/imgzone/jfs/t1/network-detail-a.jpg.avif'],
|
|
267
|
-
},
|
|
268
|
-
}),
|
|
269
|
-
}));
|
|
270
|
-
try {
|
|
271
|
-
await expect(__test__.extractDetailImagesFromPage(10)).resolves.toEqual([
|
|
272
|
-
'https://img10.360buyimg.com/imgzone/jfs/t1/network-detail-a.jpg.avif',
|
|
273
|
-
]);
|
|
274
|
-
}
|
|
275
|
-
finally {
|
|
276
|
-
globalThis.fetch = previousFetch;
|
|
277
|
-
restoreGlobals();
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
it('collects JD detail images from WareGraphic graphicContent', async () => {
|
|
281
|
-
const dom = new JSDOM(`
|
|
282
|
-
<h2 id="SPXQ-title">商品详情</h2>
|
|
283
|
-
`);
|
|
284
|
-
const previousFetch = globalThis.fetch;
|
|
285
|
-
globalThis.document = dom.window.document;
|
|
286
|
-
globalThis.window = dom.window;
|
|
287
|
-
globalThis.performance = {
|
|
288
|
-
getEntriesByType: () => [
|
|
289
|
-
{ name: 'https://api.m.jd.com/client.action?functionId=pc_item_getWareGraphic&skuId=100328272886' },
|
|
290
|
-
],
|
|
291
|
-
now: () => 0,
|
|
292
|
-
};
|
|
293
|
-
globalThis.fetch = (async () => ({
|
|
294
|
-
ok: true,
|
|
295
|
-
headers: { get: () => 'application/json' },
|
|
296
|
-
text: async () => JSON.stringify({
|
|
297
|
-
data: {
|
|
298
|
-
graphicContent: `
|
|
299
|
-
<div style="background-image:url(//img30.360buyimg.com/sku/jfs/t1/ware-a.jpg)"></div>
|
|
300
|
-
<img src="https://img30.360buyimg.com/sku/jfs/t1/ware-b.png" />
|
|
301
|
-
<a href="https://item.jd.com/100328272886.html">not image</a>
|
|
302
|
-
`,
|
|
303
|
-
},
|
|
304
|
-
}),
|
|
305
|
-
}));
|
|
306
|
-
try {
|
|
307
|
-
await expect(__test__.extractDetailImagesFromPage(10)).resolves.toEqual([
|
|
308
|
-
'https://img30.360buyimg.com/sku/jfs/t1/ware-a.jpg',
|
|
309
|
-
'https://img30.360buyimg.com/sku/jfs/t1/ware-b.png',
|
|
310
|
-
]);
|
|
311
|
-
}
|
|
312
|
-
finally {
|
|
313
|
-
globalThis.fetch = previousFetch;
|
|
314
|
-
restoreGlobals();
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
it('extracts selected specs from the newer JD spec-list DOM', () => {
|
|
318
|
-
const dom = new JSDOM(`
|
|
319
|
-
<div id="spec-list" class="page-right-spec">
|
|
320
|
-
<div class="horizontal-layout specification-series-layout">
|
|
321
|
-
<div class="layout-label">系列品</div>
|
|
322
|
-
<div class="layout-content">
|
|
323
|
-
<div class="specification-series-item specification-series-item--selected">
|
|
324
|
-
<span class="specification-series-item-text">【年度新品】玉兔3.0pro 12kg</span>
|
|
325
|
-
</div>
|
|
326
|
-
<div class="specification-series-item"><span class="specification-series-item-text">其他系列</span></div>
|
|
327
|
-
</div>
|
|
328
|
-
</div>
|
|
329
|
-
<div class="specifications-panel-content">
|
|
330
|
-
<div class="specification-group">
|
|
331
|
-
<div class="specification-group-label">款式</div>
|
|
332
|
-
<div class="specification-group-content">
|
|
333
|
-
<div class="specification-item-sku has-image specification-item-sku--selected" title="">
|
|
334
|
-
<img class="specification-item-sku-image" alt="洗烘套装" src="https://img13.360buyimg.com/pcpubliccms/s48x48_jfs/t1/spec.jpg.avif" />
|
|
335
|
-
<span class="specification-item-sku-text">洗烘套装</span>
|
|
336
|
-
</div>
|
|
337
|
-
<div class="specification-item-sku has-image"><span class="specification-item-sku-text">滚筒单洗</span></div>
|
|
338
|
-
</div>
|
|
339
|
-
</div>
|
|
340
|
-
</div>
|
|
341
|
-
</div>
|
|
342
|
-
`);
|
|
343
|
-
globalThis.document = dom.window.document;
|
|
344
|
-
try {
|
|
345
|
-
expect(__test__.extractSpecs()).toEqual({
|
|
346
|
-
系列品: '【年度新品】玉兔3.0pro 12kg',
|
|
347
|
-
款式: '洗烘套装',
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
finally {
|
|
351
|
-
restoreGlobals();
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
});
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { __test__ } from './search.js';
|
|
3
|
-
describe('jianyu search helpers', () => {
|
|
4
|
-
it('builds candidate URLs with supsearch as preferred entry', () => {
|
|
5
|
-
const candidates = __test__.buildSearchCandidates('procurement');
|
|
6
|
-
expect(candidates[0]).toContain('/jylab/supsearch/index.html');
|
|
7
|
-
expect(candidates[0]).toContain('keywords=procurement');
|
|
8
|
-
expect(candidates[0]).toContain('selectType=title');
|
|
9
|
-
expect(candidates[0]).toContain('searchGroup=1');
|
|
10
|
-
});
|
|
11
|
-
it('builds supsearch URL with required query params', () => {
|
|
12
|
-
const url = __test__.buildSearchUrl('procurement');
|
|
13
|
-
expect(url).toContain('keywords=procurement');
|
|
14
|
-
expect(url).toContain('selectType=title');
|
|
15
|
-
expect(url).toContain('searchGroup=1');
|
|
16
|
-
});
|
|
17
|
-
it('normalizes common date formats', () => {
|
|
18
|
-
expect(__test__.normalizeDate('2026-4-7')).toBe('2026-04-07');
|
|
19
|
-
expect(__test__.normalizeDate('2026年4月7日')).toBe('2026-04-07');
|
|
20
|
-
expect(__test__.normalizeDate('发布时间: 2026/04/07 09:00')).toBe('2026-04-07');
|
|
21
|
-
});
|
|
22
|
-
it('deduplicates by title and url', () => {
|
|
23
|
-
const deduped = __test__.dedupeCandidates([
|
|
24
|
-
{ title: 'A', url: 'https://example.com/1', date: '2026-04-07' },
|
|
25
|
-
{ title: 'A', url: 'https://example.com/1', date: '2026-04-07' },
|
|
26
|
-
{ title: 'A', url: 'https://example.com/2', date: '2026-04-07' },
|
|
27
|
-
]);
|
|
28
|
-
expect(deduped).toHaveLength(2);
|
|
29
|
-
});
|
|
30
|
-
it('filters obvious navigation rows before quality gate', () => {
|
|
31
|
-
const filtered = __test__.filterNavigationRows('电梯', [
|
|
32
|
-
{ title: '招标公告', url: 'https://www.jianyu360.cn/list/stype/ZBGG.html', date: '' },
|
|
33
|
-
{ title: '帮助中心', url: 'https://www.jianyu360.cn/helpCenter/index', date: '' },
|
|
34
|
-
{ title: '某项目电梯采购公告', url: 'https://www.jianyu360.cn/notice/detail/123', date: '2026-04-07' },
|
|
35
|
-
]);
|
|
36
|
-
expect(filtered).toHaveLength(1);
|
|
37
|
-
expect(filtered[0].title).toContain('电梯采购公告');
|
|
38
|
-
});
|
|
39
|
-
it('rejects procurement rows that do not contain query evidence', () => {
|
|
40
|
-
const filtered = __test__.filterNavigationRows('电梯', [
|
|
41
|
-
{
|
|
42
|
-
title: '某项目采购公告',
|
|
43
|
-
url: 'https://www.jianyu360.cn/notice/detail/123',
|
|
44
|
-
date: '2026-04-07',
|
|
45
|
-
contextText: '招标公告 项目编号:ABC-123',
|
|
46
|
-
},
|
|
47
|
-
]);
|
|
48
|
-
expect(filtered).toHaveLength(0);
|
|
49
|
-
});
|
|
50
|
-
it('parses search-index markdown headings', () => {
|
|
51
|
-
const rows = __test__.parseSearchIndexMarkdown(`
|
|
52
|
-
## [标题一](http://duckduckgo.com/l/?uddg=https%3A%2F%2Fbeijing.jianyu360.cn%2Fjybx%2F20260401_26033143187897.html)
|
|
53
|
-
## [标题二](https://www.jianyu360.cn/nologin/content/ABC.html)
|
|
54
|
-
`);
|
|
55
|
-
expect(rows).toHaveLength(2);
|
|
56
|
-
expect(rows[0].title).toBe('标题一');
|
|
57
|
-
expect(rows[1].url).toContain('jianyu360.cn/nologin/content');
|
|
58
|
-
});
|
|
59
|
-
it('unwraps duckduckgo redirect links', () => {
|
|
60
|
-
const direct = __test__.unwrapDuckDuckGoUrl('https://duckduckgo.com/l/?uddg=https%3A%2F%2Fwww.jianyu360.cn%2Fnologin%2Fcontent%2FXYZ.html');
|
|
61
|
-
expect(direct).toBe('https://www.jianyu360.cn/nologin/content/XYZ.html');
|
|
62
|
-
});
|
|
63
|
-
it('extracts publish date from jianyu jybx urls', () => {
|
|
64
|
-
const date = __test__.extractDateFromJianyuUrl('https://shandong.jianyu360.cn/jybx/20260310_26030938267551.html');
|
|
65
|
-
expect(date).toBe('2026-03-10');
|
|
66
|
-
});
|
|
67
|
-
it('normalizes api payload rows with fallback url/title fields', () => {
|
|
68
|
-
const normalized = __test__.normalizeApiRow({
|
|
69
|
-
noticeTitle: '某项目电梯采购公告',
|
|
70
|
-
detailUrl: '/jybx/20260310_26030938267551.html',
|
|
71
|
-
publishTime: '2026-03-10 09:00:00',
|
|
72
|
-
buyer: '测试单位',
|
|
73
|
-
});
|
|
74
|
-
expect(normalized).toBeTruthy();
|
|
75
|
-
expect(normalized?.title).toContain('电梯采购公告');
|
|
76
|
-
expect(normalized?.url).toContain('/jybx/20260310_26030938267551.html');
|
|
77
|
-
expect(normalized?.date).toBe('2026-03-10');
|
|
78
|
-
});
|
|
79
|
-
it('keeps later bucket unique api rows before final filtering and slice', async () => {
|
|
80
|
-
const page = {
|
|
81
|
-
goto: async () => { },
|
|
82
|
-
wait: async () => { },
|
|
83
|
-
evaluate: async () => ({
|
|
84
|
-
challenge: false,
|
|
85
|
-
responses: [
|
|
86
|
-
{
|
|
87
|
-
type: 'fType',
|
|
88
|
-
ok: true,
|
|
89
|
-
status: 200,
|
|
90
|
-
payload: {
|
|
91
|
-
list: [
|
|
92
|
-
{
|
|
93
|
-
noticeTitle: '某项目电梯采购公告',
|
|
94
|
-
detailUrl: '/jybx/20260310_26030938267551.html',
|
|
95
|
-
publishTime: '2026-03-10 09:00:00',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
noticeTitle: '某项目电梯采购公告',
|
|
99
|
-
detailUrl: '/jybx/20260310_26030938267551.html',
|
|
100
|
-
publishTime: '2026-03-10 09:00:00',
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
type: 'eType',
|
|
107
|
-
ok: true,
|
|
108
|
-
status: 200,
|
|
109
|
-
payload: {
|
|
110
|
-
list: [
|
|
111
|
-
{
|
|
112
|
-
noticeTitle: '另一条电梯采购公告',
|
|
113
|
-
detailUrl: '/jybx/20260311_26030938267552.html',
|
|
114
|
-
publishTime: '2026-03-11 09:00:00',
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
}),
|
|
121
|
-
};
|
|
122
|
-
const result = await __test__.fetchJianyuApiRows(page, '电梯', 1);
|
|
123
|
-
expect(result.challenge).toBe(false);
|
|
124
|
-
expect(result.rows).toHaveLength(2);
|
|
125
|
-
expect(result.rows[0].title).toContain('电梯采购公告');
|
|
126
|
-
expect(result.rows[1].title).toContain('另一条电梯采购公告');
|
|
127
|
-
});
|
|
128
|
-
it('classifies nologin links as blocked detail targets', () => {
|
|
129
|
-
const signal = __test__.classifyDetailStatus('https://www.jianyu360.cn/nologin/content/ABC.html');
|
|
130
|
-
expect(signal.detail_status).toBe('blocked');
|
|
131
|
-
});
|
|
132
|
-
it('classifies accessible detail urls as ok even when they are not jybx paths', () => {
|
|
133
|
-
const signal = __test__.classifyDetailStatus('https://www.jianyu360.cn/notice/detail/123');
|
|
134
|
-
expect(signal.detail_status).toBe('ok');
|
|
135
|
-
expect(signal.detail_reason).toBe('detail_candidate');
|
|
136
|
-
});
|
|
137
|
-
it('classifies list pages as entry_only', () => {
|
|
138
|
-
const signal = __test__.classifyDetailStatus('https://www.jianyu360.cn/list/stype/ZBGG.html');
|
|
139
|
-
expect(signal.detail_status).toBe('entry_only');
|
|
140
|
-
});
|
|
141
|
-
it('extracts stable notice id from jybx urls', () => {
|
|
142
|
-
const id = __test__.extractNoticeId('https://shandong.jianyu360.cn/jybx/20260310_26030938267551.html');
|
|
143
|
-
expect(id).toBe('20260310_26030938267551');
|
|
144
|
-
});
|
|
145
|
-
it('keeps only rows inside recency window', () => {
|
|
146
|
-
const within = __test__.isWithinSinceDays('2026-03-20', 30, new Date('2026-04-09T00:00:00Z'));
|
|
147
|
-
const stale = __test__.isWithinSinceDays('2026-02-01', 30, new Date('2026-04-09T00:00:00Z'));
|
|
148
|
-
const missing = __test__.isWithinSinceDays('', 30, new Date('2026-04-09T00:00:00Z'));
|
|
149
|
-
expect(within).toBe(true);
|
|
150
|
-
expect(stale).toBe(false);
|
|
151
|
-
expect(missing).toBe(false);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { __test__, toProcurementDetailRecord, toProcurementSearchRecords, } from './procurement-contract.js';
|
|
3
|
-
describe('procurement contract helpers', () => {
|
|
4
|
-
it('builds v2 search records with compatibility fields', () => {
|
|
5
|
-
const rows = toProcurementSearchRecords([
|
|
6
|
-
{
|
|
7
|
-
title: '某项目电梯采购公告',
|
|
8
|
-
url: 'https://example.com/notice/detail?id=1',
|
|
9
|
-
date: '2026-04-09',
|
|
10
|
-
contextText: '招标公告 项目编号:ABC-123 预算金额:100万元 投标截止时间:2026-04-30',
|
|
11
|
-
},
|
|
12
|
-
], {
|
|
13
|
-
site: 'jianyu',
|
|
14
|
-
query: '电梯',
|
|
15
|
-
limit: 10,
|
|
16
|
-
});
|
|
17
|
-
expect(rows).toHaveLength(1);
|
|
18
|
-
expect(rows[0].rank).toBe(1);
|
|
19
|
-
expect(rows[0].publish_time).toBe('2026-04-09');
|
|
20
|
-
expect(rows[0].date).toBe('2026-04-09');
|
|
21
|
-
expect(rows[0].summary).toBe(rows[0].snippet);
|
|
22
|
-
expect(rows[0].content_type).toBe('notice');
|
|
23
|
-
expect(rows[0].source_site).toBe('jianyu');
|
|
24
|
-
expect(rows[0].project_code).toContain('ABC-123');
|
|
25
|
-
});
|
|
26
|
-
it('throws extraction_drift when all rows are navigation noise', () => {
|
|
27
|
-
expect(() => toProcurementSearchRecords([
|
|
28
|
-
{
|
|
29
|
-
title: '官网首页',
|
|
30
|
-
url: 'https://example.com/index',
|
|
31
|
-
contextText: '官网首页 联系我们',
|
|
32
|
-
},
|
|
33
|
-
], {
|
|
34
|
-
site: 'ggzy',
|
|
35
|
-
query: '电梯',
|
|
36
|
-
limit: 10,
|
|
37
|
-
})).toThrow('[taxonomy=extraction_drift]');
|
|
38
|
-
});
|
|
39
|
-
it('rejects rows that look like procurement notices but miss the query', () => {
|
|
40
|
-
expect(() => toProcurementSearchRecords([
|
|
41
|
-
{
|
|
42
|
-
title: '某项目采购公告',
|
|
43
|
-
url: 'https://example.com/notice/detail?id=1',
|
|
44
|
-
contextText: '招标公告 项目编号:ABC-123 预算金额:100万元',
|
|
45
|
-
},
|
|
46
|
-
], {
|
|
47
|
-
site: 'jianyu',
|
|
48
|
-
query: '电梯',
|
|
49
|
-
limit: 10,
|
|
50
|
-
})).toThrow('[taxonomy=extraction_drift]');
|
|
51
|
-
});
|
|
52
|
-
it('builds detail record with evidence blocks', () => {
|
|
53
|
-
const detail = toProcurementDetailRecord({
|
|
54
|
-
title: '电梯采购公告',
|
|
55
|
-
url: 'https://example.com/notice/detail/100',
|
|
56
|
-
contextText: '项目编号:A-100。预算金额:200万元。投标截止时间:2026年04月30日。',
|
|
57
|
-
}, {
|
|
58
|
-
site: 'powerchina',
|
|
59
|
-
query: '电梯',
|
|
60
|
-
});
|
|
61
|
-
expect(detail.content_type).toBe('notice');
|
|
62
|
-
expect(detail.detail_text).toContain('预算金额');
|
|
63
|
-
expect(detail.evidence_blocks.length).toBeGreaterThan(0);
|
|
64
|
-
});
|
|
65
|
-
it('classifies detail urls and content type', () => {
|
|
66
|
-
expect(__test__.isDetailPage('https://a.com/notice/detail?id=1')).toBe(true);
|
|
67
|
-
expect(__test__.isDetailPage('https://shandong.jianyu360.cn/jybx/20260310_26030938267551.html')).toBe(true);
|
|
68
|
-
expect(__test__.isDetailPage('https://a.com/search?page=1')).toBe(false);
|
|
69
|
-
expect(__test__.classifyContentType('中标结果公告', 'https://a.com/detail/1', '中标候选人')).toBe('result');
|
|
70
|
-
expect(__test__.classifyContentType('电梯采购公告', 'https://shandong.jianyu360.cn/jybx/20260310_26030938267551.html', '首页 帮助中心 招标公告')).toBe('notice');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { runProcurementDetail } from './procurement-detail.js';
|
|
3
|
-
function createPage(evaluateImpl) {
|
|
4
|
-
return {
|
|
5
|
-
goto: async () => { },
|
|
6
|
-
wait: async () => { },
|
|
7
|
-
evaluate: async () => evaluateImpl(),
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
describe('procurement detail runner', () => {
|
|
11
|
-
it('retries transient execution-context errors and succeeds', async () => {
|
|
12
|
-
let attempts = 0;
|
|
13
|
-
const page = createPage(async () => {
|
|
14
|
-
attempts += 1;
|
|
15
|
-
if (attempts < 3) {
|
|
16
|
-
throw new Error('Execution context was destroyed.');
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
title: '电梯采购公告',
|
|
20
|
-
detailText: '项目编号:ABC-100 预算金额:100万元 截止时间:2026-04-30',
|
|
21
|
-
publishTime: '2026-04-09',
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
const rows = await runProcurementDetail(page, {
|
|
25
|
-
url: 'https://example.com/jybx/20260409_1.html',
|
|
26
|
-
site: 'jianyu',
|
|
27
|
-
query: '电梯',
|
|
28
|
-
});
|
|
29
|
-
expect(attempts).toBe(3);
|
|
30
|
-
expect(rows).toHaveLength(1);
|
|
31
|
-
expect(rows[0].title).toContain('电梯采购公告');
|
|
32
|
-
});
|
|
33
|
-
it('retries empty_result once and succeeds on the next attempt', async () => {
|
|
34
|
-
let attempts = 0;
|
|
35
|
-
const page = createPage(async () => {
|
|
36
|
-
attempts += 1;
|
|
37
|
-
if (attempts === 1) {
|
|
38
|
-
return {
|
|
39
|
-
title: '',
|
|
40
|
-
detailText: '',
|
|
41
|
-
publishTime: '',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
title: '防爆电梯采购公告',
|
|
46
|
-
detailText: '采购内容:防爆电梯2台。',
|
|
47
|
-
publishTime: '2026-03-10',
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
const rows = await runProcurementDetail(page, {
|
|
51
|
-
url: 'https://example.com/jybx/20260310_1.html',
|
|
52
|
-
site: 'jianyu',
|
|
53
|
-
query: '防爆电梯',
|
|
54
|
-
});
|
|
55
|
-
expect(attempts).toBe(2);
|
|
56
|
-
expect(rows).toHaveLength(1);
|
|
57
|
-
expect(rows[0].title).toContain('防爆电梯');
|
|
58
|
-
});
|
|
59
|
-
it('does not retry non-retryable extraction_drift errors', async () => {
|
|
60
|
-
let attempts = 0;
|
|
61
|
-
const page = createPage(async () => {
|
|
62
|
-
attempts += 1;
|
|
63
|
-
return null;
|
|
64
|
-
});
|
|
65
|
-
await expect(runProcurementDetail(page, {
|
|
66
|
-
url: 'https://example.com/jybx/20260310_1.html',
|
|
67
|
-
site: 'jianyu',
|
|
68
|
-
query: '电梯',
|
|
69
|
-
})).rejects.toThrow('[taxonomy=extraction_drift]');
|
|
70
|
-
expect(attempts).toBe(1);
|
|
71
|
-
});
|
|
72
|
-
it('rejects captcha/verification pages as selector_drift', async () => {
|
|
73
|
-
const page = createPage(async () => ({
|
|
74
|
-
title: '验证码',
|
|
75
|
-
detailText: '请在下图依次点击:槨畽黛',
|
|
76
|
-
publishTime: '',
|
|
77
|
-
}));
|
|
78
|
-
await expect(runProcurementDetail(page, {
|
|
79
|
-
url: 'https://www.jianyu360.cn/nologin/content/ABC.html',
|
|
80
|
-
site: 'jianyu',
|
|
81
|
-
query: '电梯',
|
|
82
|
-
})).rejects.toThrow('[taxonomy=selector_drift]');
|
|
83
|
-
});
|
|
84
|
-
});
|