@jackwener/opencli 1.6.1 → 1.6.2

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.
Files changed (384) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +27 -45
  3. package/README.zh-CN.md +32 -34
  4. package/autoresearch/browse-tasks.json +18 -20
  5. package/autoresearch/commands/debug.ts +163 -0
  6. package/autoresearch/commands/fix.ts +145 -0
  7. package/autoresearch/commands/plan.ts +88 -0
  8. package/autoresearch/commands/run.ts +138 -0
  9. package/autoresearch/config.ts +82 -0
  10. package/autoresearch/engine.ts +359 -0
  11. package/autoresearch/eval-all.ts +127 -0
  12. package/autoresearch/eval-browse.ts +1 -1
  13. package/autoresearch/eval-publish.ts +238 -0
  14. package/autoresearch/eval-save.ts +249 -0
  15. package/autoresearch/eval-skill.ts +14 -8
  16. package/autoresearch/eval-v2ex.ts +220 -0
  17. package/autoresearch/eval-zhihu.ts +230 -0
  18. package/autoresearch/logger.ts +69 -0
  19. package/autoresearch/presets/combined-reliability.ts +27 -0
  20. package/autoresearch/presets/index.ts +23 -0
  21. package/autoresearch/presets/operate-reliability.ts +24 -0
  22. package/autoresearch/presets/save-reliability.ts +26 -0
  23. package/autoresearch/presets/skill-quality.ts +20 -0
  24. package/autoresearch/presets/v2ex-reliability.ts +24 -0
  25. package/autoresearch/presets/zhihu-reliability.ts +25 -0
  26. package/autoresearch/publish-tasks.json +345 -0
  27. package/autoresearch/run-save.sh +11 -0
  28. package/autoresearch/save-adapters/xhs-explore-deep.ts +64 -0
  29. package/autoresearch/save-adapters/xhs-note-comments.ts +61 -0
  30. package/autoresearch/save-adapters/xhs-search-full.ts +62 -0
  31. package/autoresearch/save-adapters/zhihu-hot-detail.ts +52 -0
  32. package/autoresearch/save-adapters/zhihu-question-full.ts +57 -0
  33. package/autoresearch/save-adapters/zhihu-search-detail.ts +53 -0
  34. package/autoresearch/save-tasks.json +281 -0
  35. package/autoresearch/v2ex-tasks.json +899 -0
  36. package/autoresearch/zhihu-tasks.json +848 -0
  37. package/dist/browser/base-page.d.ts +4 -2
  38. package/dist/browser/base-page.js +37 -4
  39. package/dist/browser/bridge.js +10 -8
  40. package/dist/browser/cdp.js +2 -6
  41. package/dist/browser/daemon-client.d.ts +11 -1
  42. package/dist/browser/daemon-client.js +3 -0
  43. package/dist/browser/dom-helpers.d.ts +4 -2
  44. package/dist/browser/dom-helpers.js +42 -31
  45. package/dist/browser/dom-snapshot.js +23 -1
  46. package/dist/browser/page.d.ts +7 -2
  47. package/dist/browser/page.js +112 -30
  48. package/dist/browser.test.js +1 -1
  49. package/dist/build-manifest.d.ts +1 -0
  50. package/dist/build-manifest.js +1 -0
  51. package/dist/cli-manifest.json +1135 -184
  52. package/dist/cli.d.ts +2 -0
  53. package/dist/cli.js +48 -7
  54. package/dist/cli.test.d.ts +1 -0
  55. package/dist/cli.test.js +88 -0
  56. package/dist/clis/1688/item.d.ts +70 -0
  57. package/dist/clis/1688/item.js +187 -0
  58. package/dist/clis/1688/item.test.d.ts +1 -0
  59. package/dist/clis/1688/item.test.js +67 -0
  60. package/dist/clis/1688/search.d.ts +56 -0
  61. package/dist/clis/1688/search.js +309 -0
  62. package/dist/clis/1688/search.test.d.ts +1 -0
  63. package/dist/clis/1688/search.test.js +75 -0
  64. package/dist/clis/1688/shared.d.ts +112 -0
  65. package/dist/clis/1688/shared.js +514 -0
  66. package/dist/clis/1688/shared.test.d.ts +1 -0
  67. package/dist/clis/1688/shared.test.js +57 -0
  68. package/dist/clis/1688/store.d.ts +45 -0
  69. package/dist/clis/1688/store.js +226 -0
  70. package/dist/clis/1688/store.test.d.ts +1 -0
  71. package/dist/clis/1688/store.test.js +62 -0
  72. package/dist/clis/amazon/bestsellers.d.ts +0 -20
  73. package/dist/clis/amazon/bestsellers.js +6 -129
  74. package/dist/clis/amazon/bestsellers.test.js +12 -3
  75. package/dist/clis/amazon/movers-shakers.d.ts +1 -0
  76. package/dist/clis/amazon/movers-shakers.js +7 -0
  77. package/dist/clis/amazon/new-releases.d.ts +1 -0
  78. package/dist/clis/amazon/new-releases.js +7 -0
  79. package/dist/clis/amazon/rankings.d.ts +59 -0
  80. package/dist/clis/amazon/rankings.js +226 -0
  81. package/dist/clis/amazon/rankings.test.d.ts +1 -0
  82. package/dist/clis/amazon/rankings.test.js +41 -0
  83. package/dist/clis/amazon/shared.d.ts +11 -0
  84. package/dist/clis/amazon/shared.js +121 -11
  85. package/dist/clis/amazon/shared.test.js +11 -0
  86. package/dist/clis/bilibili/comments.js +2 -2
  87. package/dist/clis/bilibili/comments.test.js +3 -2
  88. package/dist/clis/bilibili/download.js +2 -1
  89. package/dist/clis/bilibili/subtitle.js +4 -3
  90. package/dist/clis/bilibili/subtitle.test.js +2 -1
  91. package/dist/clis/bilibili/utils.d.ts +5 -0
  92. package/dist/clis/bilibili/utils.js +30 -0
  93. package/dist/clis/bilibili/utils.test.d.ts +1 -0
  94. package/dist/clis/bilibili/utils.test.js +17 -0
  95. package/dist/clis/douban/marks.js +1 -1
  96. package/dist/clis/douban/subject.yaml +50 -19
  97. package/dist/clis/doubao/utils.js +32 -12
  98. package/dist/clis/douyin/_shared/browser-fetch.test.js +0 -1
  99. package/dist/clis/douyin/_shared/transcode.test.js +0 -2
  100. package/dist/clis/douyin/draft.test.js +0 -2
  101. package/dist/clis/facebook/search.test.js +0 -2
  102. package/dist/clis/gemini/ask.js +9 -3
  103. package/dist/clis/gemini/ask.test.d.ts +1 -0
  104. package/dist/clis/gemini/ask.test.js +100 -0
  105. package/dist/clis/gemini/reply-state.test.d.ts +1 -0
  106. package/dist/clis/gemini/reply-state.test.js +641 -0
  107. package/dist/clis/gemini/utils.d.ts +44 -1
  108. package/dist/clis/gemini/utils.js +528 -61
  109. package/dist/clis/gemini/utils.test.js +149 -2
  110. package/dist/clis/hupu/detail.d.ts +1 -0
  111. package/dist/clis/hupu/detail.js +72 -0
  112. package/dist/clis/hupu/hot.yaml +43 -0
  113. package/dist/clis/hupu/like.d.ts +1 -0
  114. package/dist/clis/hupu/like.js +75 -0
  115. package/dist/clis/hupu/reply.d.ts +1 -0
  116. package/dist/clis/hupu/reply.js +71 -0
  117. package/dist/clis/hupu/search.d.ts +1 -0
  118. package/dist/clis/hupu/search.js +59 -0
  119. package/dist/clis/hupu/unlike.d.ts +1 -0
  120. package/dist/clis/hupu/unlike.js +75 -0
  121. package/dist/clis/hupu/utils.d.ts +20 -0
  122. package/dist/clis/hupu/utils.js +319 -0
  123. package/dist/clis/instagram/_shared/private-publish.d.ts +138 -0
  124. package/dist/clis/instagram/_shared/private-publish.js +1030 -0
  125. package/dist/clis/instagram/_shared/private-publish.test.d.ts +1 -0
  126. package/dist/clis/instagram/_shared/private-publish.test.js +705 -0
  127. package/dist/clis/instagram/_shared/protocol-capture.d.ts +26 -0
  128. package/dist/clis/instagram/_shared/protocol-capture.js +282 -0
  129. package/dist/clis/instagram/_shared/protocol-capture.test.d.ts +1 -0
  130. package/dist/clis/instagram/_shared/protocol-capture.test.js +114 -0
  131. package/dist/clis/instagram/_shared/runtime-info.d.ts +9 -0
  132. package/dist/clis/instagram/_shared/runtime-info.js +81 -0
  133. package/dist/clis/instagram/note.d.ts +1 -0
  134. package/dist/clis/instagram/note.js +222 -0
  135. package/dist/clis/instagram/note.test.d.ts +1 -0
  136. package/dist/clis/instagram/note.test.js +81 -0
  137. package/dist/clis/instagram/post.d.ts +4 -0
  138. package/dist/clis/instagram/post.js +1496 -0
  139. package/dist/clis/instagram/post.test.d.ts +1 -0
  140. package/dist/clis/instagram/post.test.js +1647 -0
  141. package/dist/clis/instagram/reel.d.ts +1 -0
  142. package/dist/clis/instagram/reel.js +826 -0
  143. package/dist/clis/instagram/reel.test.d.ts +1 -0
  144. package/dist/clis/instagram/reel.test.js +167 -0
  145. package/dist/clis/instagram/story.d.ts +1 -0
  146. package/dist/clis/instagram/story.js +115 -0
  147. package/dist/clis/instagram/story.test.d.ts +1 -0
  148. package/dist/clis/instagram/story.test.js +167 -0
  149. package/dist/clis/sinafinance/stock-rank.d.ts +4 -0
  150. package/dist/clis/sinafinance/stock-rank.js +65 -0
  151. package/dist/clis/substack/utils.test.js +0 -2
  152. package/dist/clis/twitter/post.js +72 -45
  153. package/dist/clis/twitter/post.test.d.ts +1 -0
  154. package/dist/clis/twitter/post.test.js +116 -0
  155. package/dist/clis/twitter/reply.d.ts +12 -0
  156. package/dist/clis/twitter/reply.js +257 -35
  157. package/dist/clis/twitter/reply.test.d.ts +1 -0
  158. package/dist/clis/twitter/reply.test.js +151 -0
  159. package/dist/clis/xianyu/chat.d.ts +7 -0
  160. package/dist/clis/xianyu/chat.js +146 -0
  161. package/dist/clis/xianyu/chat.test.d.ts +1 -0
  162. package/dist/clis/xianyu/chat.test.js +15 -0
  163. package/dist/clis/xianyu/item.d.ts +7 -0
  164. package/dist/clis/xianyu/item.js +152 -0
  165. package/dist/clis/xianyu/item.test.d.ts +1 -0
  166. package/dist/clis/xianyu/item.test.js +56 -0
  167. package/dist/clis/xianyu/search.d.ts +10 -0
  168. package/dist/clis/xianyu/search.js +134 -0
  169. package/dist/clis/xianyu/search.test.d.ts +1 -0
  170. package/dist/clis/xianyu/search.test.js +17 -0
  171. package/dist/clis/xianyu/utils.d.ts +1 -0
  172. package/dist/clis/xianyu/utils.js +8 -0
  173. package/dist/clis/xiaoe/catalog.yaml +129 -0
  174. package/dist/clis/xiaoe/content.yaml +43 -0
  175. package/dist/clis/xiaoe/courses.yaml +73 -0
  176. package/dist/clis/xiaoe/detail.yaml +39 -0
  177. package/dist/clis/xiaoe/play-url.yaml +124 -0
  178. package/dist/clis/xiaohongshu/comments.test.js +0 -2
  179. package/dist/clis/xiaohongshu/creator-note-detail.test.js +0 -2
  180. package/dist/clis/xiaohongshu/creator-notes.test.js +0 -2
  181. package/dist/clis/xiaohongshu/download.test.js +0 -2
  182. package/dist/clis/xiaohongshu/note.test.js +0 -2
  183. package/dist/clis/xiaohongshu/publish.test.js +0 -2
  184. package/dist/clis/xiaohongshu/search.js +29 -20
  185. package/dist/clis/xiaohongshu/search.test.js +56 -48
  186. package/dist/clis/yuanbao/ask.d.ts +21 -0
  187. package/dist/clis/yuanbao/ask.js +427 -0
  188. package/dist/clis/yuanbao/ask.test.d.ts +1 -0
  189. package/dist/clis/yuanbao/ask.test.js +124 -0
  190. package/dist/clis/yuanbao/new.d.ts +1 -0
  191. package/dist/clis/yuanbao/new.js +70 -0
  192. package/dist/clis/yuanbao/new.test.d.ts +1 -0
  193. package/dist/clis/yuanbao/new.test.js +30 -0
  194. package/dist/clis/yuanbao/shared.d.ts +13 -0
  195. package/dist/clis/yuanbao/shared.js +49 -0
  196. package/dist/clis/zhihu/question.js +30 -19
  197. package/dist/clis/zhihu/question.test.js +34 -16
  198. package/dist/commanderAdapter.js +8 -4
  199. package/dist/commanderAdapter.test.js +42 -0
  200. package/dist/completion.js +3 -1
  201. package/dist/completion.test.d.ts +1 -0
  202. package/dist/completion.test.js +23 -0
  203. package/dist/doctor.js +1 -1
  204. package/dist/electron-apps.d.ts +2 -0
  205. package/dist/electron-apps.js +7 -1
  206. package/dist/errors.js +1 -1
  207. package/dist/execution.js +25 -35
  208. package/dist/explore.js +1 -1
  209. package/dist/launcher.d.ts +4 -0
  210. package/dist/launcher.js +64 -8
  211. package/dist/launcher.test.js +88 -7
  212. package/dist/output.d.ts +2 -0
  213. package/dist/output.js +10 -1
  214. package/dist/output.test.d.ts +0 -3
  215. package/dist/output.test.js +59 -92
  216. package/dist/pipeline/executor.test.js +0 -2
  217. package/dist/pipeline/steps/download.test.js +0 -2
  218. package/dist/registry.d.ts +2 -0
  219. package/dist/serialization.d.ts +1 -0
  220. package/dist/serialization.js +1 -0
  221. package/dist/types.d.ts +9 -2
  222. package/docs/.vitepress/config.mts +4 -0
  223. package/docs/adapters/browser/1688.md +52 -0
  224. package/docs/adapters/browser/36kr.md +2 -1
  225. package/docs/adapters/browser/doubao.md +5 -1
  226. package/docs/adapters/browser/hupu.md +53 -0
  227. package/docs/adapters/browser/sinafinance.md +32 -2
  228. package/docs/adapters/browser/weibo.md +6 -1
  229. package/docs/adapters/browser/wikipedia.md +2 -0
  230. package/docs/adapters/browser/xianyu.md +42 -0
  231. package/docs/adapters/browser/xiaoe.md +44 -0
  232. package/docs/adapters/browser/yuanbao.md +64 -0
  233. package/docs/adapters/index.md +14 -5
  234. package/docs/comparison.md +1 -1
  235. package/docs/developer/ai-workflow.md +2 -2
  236. package/docs/developer/contributing.md +1 -1
  237. package/docs/developer/testing.md +2 -0
  238. package/docs/guide/plugins.md +1 -0
  239. package/docs/guide/troubleshooting.md +11 -0
  240. package/docs/superpowers/specs/2026-04-03-v2ex-autoresearch-design.md +41 -0
  241. package/docs/zh/guide/plugins.md +1 -0
  242. package/extension/dist/background.js +1127 -0
  243. package/extension/src/background.test.ts +39 -0
  244. package/extension/src/background.ts +223 -34
  245. package/extension/src/cdp.ts +194 -4
  246. package/extension/src/protocol.ts +22 -1
  247. package/package.json +3 -2
  248. package/scripts/postinstall.js +1 -1
  249. package/skills/opencli-explorer/SKILL.md +1 -1
  250. package/skills/opencli-oneshot/SKILL.md +2 -2
  251. package/skills/opencli-operate/SKILL.md +120 -27
  252. package/skills/opencli-usage/SKILL.md +31 -20
  253. package/skills/opencli-usage/browser.md +114 -16
  254. package/skills/opencli-usage/public-api.md +32 -3
  255. package/skills/smart-search/SKILL.md +156 -0
  256. package/skills/smart-search/references/sources-ai.md +74 -0
  257. package/skills/smart-search/references/sources-info.md +43 -0
  258. package/skills/smart-search/references/sources-media.md +50 -0
  259. package/skills/smart-search/references/sources-other.md +42 -0
  260. package/skills/smart-search/references/sources-shopping.md +31 -0
  261. package/skills/smart-search/references/sources-social.md +51 -0
  262. package/skills/smart-search/references/sources-tech.md +42 -0
  263. package/skills/smart-search/references/sources-travel.md +20 -0
  264. package/src/browser/base-page.ts +41 -6
  265. package/src/browser/bridge.ts +11 -8
  266. package/src/browser/cdp.ts +1 -8
  267. package/src/browser/daemon-client.ts +11 -1
  268. package/src/browser/dom-helpers.ts +43 -31
  269. package/src/browser/dom-snapshot.ts +23 -1
  270. package/src/browser/page.ts +115 -31
  271. package/src/browser.test.ts +1 -1
  272. package/src/build-manifest.ts +2 -0
  273. package/src/cli.test.ts +133 -0
  274. package/src/cli.ts +73 -11
  275. package/src/clis/1688/item.test.ts +69 -0
  276. package/src/clis/1688/item.ts +282 -0
  277. package/src/clis/1688/search.test.ts +81 -0
  278. package/src/clis/1688/search.ts +402 -0
  279. package/src/clis/1688/shared.test.ts +75 -0
  280. package/src/clis/1688/shared.ts +623 -0
  281. package/src/clis/1688/store.test.ts +69 -0
  282. package/src/clis/1688/store.ts +300 -0
  283. package/src/clis/amazon/bestsellers.test.ts +12 -3
  284. package/src/clis/amazon/bestsellers.ts +6 -178
  285. package/src/clis/amazon/movers-shakers.ts +8 -0
  286. package/src/clis/amazon/new-releases.ts +8 -0
  287. package/src/clis/amazon/rankings.test.ts +47 -0
  288. package/src/clis/amazon/rankings.ts +312 -0
  289. package/src/clis/amazon/shared.test.ts +16 -0
  290. package/src/clis/amazon/shared.ts +134 -12
  291. package/src/clis/bilibili/comments.test.ts +4 -3
  292. package/src/clis/bilibili/comments.ts +2 -2
  293. package/src/clis/bilibili/download.ts +2 -1
  294. package/src/clis/bilibili/subtitle.test.ts +2 -1
  295. package/src/clis/bilibili/subtitle.ts +4 -3
  296. package/src/clis/bilibili/utils.test.ts +21 -0
  297. package/src/clis/bilibili/utils.ts +27 -0
  298. package/src/clis/douban/marks.ts +1 -1
  299. package/src/clis/douban/subject.yaml +50 -19
  300. package/src/clis/doubao/utils.ts +32 -12
  301. package/src/clis/douyin/_shared/browser-fetch.test.ts +0 -1
  302. package/src/clis/douyin/_shared/transcode.test.ts +0 -2
  303. package/src/clis/douyin/draft.test.ts +0 -2
  304. package/src/clis/facebook/search.test.ts +0 -2
  305. package/src/clis/gemini/ask.test.ts +116 -0
  306. package/src/clis/gemini/ask.ts +10 -3
  307. package/src/clis/gemini/reply-state.test.ts +708 -0
  308. package/src/clis/gemini/utils.test.ts +184 -2
  309. package/src/clis/gemini/utils.ts +588 -60
  310. package/src/clis/hupu/detail.ts +126 -0
  311. package/src/clis/hupu/hot.yaml +43 -0
  312. package/src/clis/hupu/like.ts +76 -0
  313. package/src/clis/hupu/reply.ts +76 -0
  314. package/src/clis/hupu/search.ts +95 -0
  315. package/src/clis/hupu/unlike.ts +76 -0
  316. package/src/clis/hupu/utils.ts +381 -0
  317. package/src/clis/instagram/_shared/private-publish.test.ts +827 -0
  318. package/src/clis/instagram/_shared/private-publish.ts +1303 -0
  319. package/src/clis/instagram/_shared/protocol-capture.test.ts +148 -0
  320. package/src/clis/instagram/_shared/protocol-capture.ts +321 -0
  321. package/src/clis/instagram/_shared/runtime-info.ts +91 -0
  322. package/src/clis/instagram/note.test.ts +96 -0
  323. package/src/clis/instagram/note.ts +254 -0
  324. package/src/clis/instagram/post.test.ts +1716 -0
  325. package/src/clis/instagram/post.ts +1620 -0
  326. package/src/clis/instagram/reel.test.ts +191 -0
  327. package/src/clis/instagram/reel.ts +886 -0
  328. package/src/clis/instagram/story.test.ts +191 -0
  329. package/src/clis/instagram/story.ts +151 -0
  330. package/src/clis/sinafinance/stock-rank.ts +68 -0
  331. package/src/clis/substack/utils.test.ts +0 -2
  332. package/src/clis/twitter/post.test.ts +157 -0
  333. package/src/clis/twitter/post.ts +82 -48
  334. package/src/clis/twitter/reply.test.ts +177 -0
  335. package/src/clis/twitter/reply.ts +285 -39
  336. package/src/clis/xianyu/chat.test.ts +20 -0
  337. package/src/clis/xianyu/chat.ts +175 -0
  338. package/src/clis/xianyu/item.test.ts +67 -0
  339. package/src/clis/xianyu/item.ts +172 -0
  340. package/src/clis/xianyu/search.test.ts +22 -0
  341. package/src/clis/xianyu/search.ts +151 -0
  342. package/src/clis/xianyu/utils.ts +9 -0
  343. package/src/clis/xiaoe/catalog.yaml +129 -0
  344. package/src/clis/xiaoe/content.yaml +43 -0
  345. package/src/clis/xiaoe/courses.yaml +73 -0
  346. package/src/clis/xiaoe/detail.yaml +39 -0
  347. package/src/clis/xiaoe/play-url.yaml +124 -0
  348. package/src/clis/xiaohongshu/comments.test.ts +0 -2
  349. package/src/clis/xiaohongshu/creator-note-detail.test.ts +0 -2
  350. package/src/clis/xiaohongshu/creator-notes.test.ts +0 -2
  351. package/src/clis/xiaohongshu/download.test.ts +0 -2
  352. package/src/clis/xiaohongshu/note.test.ts +0 -2
  353. package/src/clis/xiaohongshu/publish.test.ts +0 -2
  354. package/src/clis/xiaohongshu/search.test.ts +59 -48
  355. package/src/clis/xiaohongshu/search.ts +31 -21
  356. package/src/clis/yuanbao/ask.test.ts +156 -0
  357. package/src/clis/yuanbao/ask.ts +522 -0
  358. package/src/clis/yuanbao/new.test.ts +36 -0
  359. package/src/clis/yuanbao/new.ts +81 -0
  360. package/src/clis/yuanbao/shared.ts +57 -0
  361. package/src/clis/zhihu/question.test.ts +42 -17
  362. package/src/clis/zhihu/question.ts +31 -26
  363. package/src/commanderAdapter.test.ts +51 -0
  364. package/src/commanderAdapter.ts +8 -4
  365. package/src/completion.test.ts +30 -0
  366. package/src/completion.ts +3 -1
  367. package/src/doctor.ts +1 -1
  368. package/src/electron-apps.ts +9 -1
  369. package/src/errors.ts +1 -1
  370. package/src/execution.ts +26 -30
  371. package/src/explore.ts +1 -1
  372. package/src/launcher.test.ts +121 -7
  373. package/src/launcher.ts +87 -9
  374. package/src/output.test.ts +50 -90
  375. package/src/output.ts +10 -1
  376. package/src/pipeline/executor.test.ts +0 -2
  377. package/src/pipeline/steps/download.test.ts +0 -2
  378. package/src/registry.ts +2 -0
  379. package/src/serialization.ts +2 -0
  380. package/src/types.ts +9 -2
  381. package/tests/e2e/browser-auth.test.ts +9 -0
  382. package/CLI-EXPLORER.md +0 -724
  383. package/CLI-ONESHOT.md +0 -216
  384. package/SKILL.md +0 -59
@@ -0,0 +1,134 @@
1
+ import { AuthRequiredError, EmptyResultError } from '../../errors.js';
2
+ import { cli, Strategy } from '../../registry.js';
3
+ const MAX_LIMIT = 50;
4
+ function normalizeLimit(value) {
5
+ const n = Number(value);
6
+ if (!Number.isFinite(n))
7
+ return 20;
8
+ return Math.min(MAX_LIMIT, Math.max(1, Math.floor(n)));
9
+ }
10
+ function buildSearchUrl(query) {
11
+ return `https://www.goofish.com/search?q=${encodeURIComponent(query)}`;
12
+ }
13
+ function itemIdFromUrl(url) {
14
+ const match = url.match(/[?&]id=(\d+)/);
15
+ return match ? match[1] : '';
16
+ }
17
+ function buildExtractResultsEvaluate(limit) {
18
+ return `
19
+ (async () => {
20
+ const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
21
+ const waitFor = async (predicate, timeoutMs = 8000) => {
22
+ const start = Date.now();
23
+ while (Date.now() - start < timeoutMs) {
24
+ if (predicate()) return true;
25
+ await wait(150);
26
+ }
27
+ return false;
28
+ };
29
+
30
+ const clean = (value) => (value || '').replace(/\\s+/g, ' ').trim();
31
+ const selectors = {
32
+ card: 'a[href*="/item?id="]',
33
+ title: '[class*="row1-wrap-title"], [class*="main-title"]',
34
+ attrs: '[class*="row2-wrap-cpv"] span[class*="cpv--"]',
35
+ priceWrap: '[class*="price-wrap"]',
36
+ priceNum: '[class*="number"]',
37
+ priceDec: '[class*="decimal"]',
38
+ priceDesc: '[class*="price-desc"] [title], [class*="price-desc"] [style*="line-through"]',
39
+ sellerWrap: '[class*="row4-wrap-seller"]',
40
+ sellerText: '[class*="seller-text"]',
41
+ badge: '[class*="credit-container"] [title], [class*="credit-container"] span',
42
+ };
43
+
44
+ await waitFor(() => {
45
+ const bodyText = document.body?.innerText || '';
46
+ return Boolean(
47
+ document.querySelector(selectors.card)
48
+ || /请先登录|登录后|验证码|安全验证|异常访问/.test(bodyText)
49
+ || /暂无相关宝贝|未找到相关宝贝|没有找到/.test(bodyText)
50
+ );
51
+ });
52
+
53
+ const bodyText = document.body?.innerText || '';
54
+ const requiresAuth = /请先登录|登录后/.test(bodyText);
55
+ const blocked = /验证码|安全验证|异常访问/.test(bodyText);
56
+ const empty = /暂无相关宝贝|未找到相关宝贝|没有找到/.test(bodyText);
57
+
58
+ const items = Array.from(document.querySelectorAll(selectors.card))
59
+ .slice(0, ${limit})
60
+ .map((card) => {
61
+ const href = card.href || card.getAttribute('href') || '';
62
+ const title = clean(card.querySelector(selectors.title)?.textContent || '');
63
+ const attrs = Array.from(card.querySelectorAll(selectors.attrs))
64
+ .map((node) => clean(node.textContent || ''))
65
+ .filter(Boolean);
66
+ const priceWrap = card.querySelector(selectors.priceWrap);
67
+ const priceNumber = clean(priceWrap?.querySelector(selectors.priceNum)?.textContent || '');
68
+ const priceDecimal = clean(priceWrap?.querySelector(selectors.priceDec)?.textContent || '');
69
+ const location = clean(card.querySelector(selectors.sellerWrap)?.querySelector(selectors.sellerText)?.textContent || '');
70
+ const originalPriceNode = card.querySelector(selectors.priceDesc);
71
+ const badgeNode = card.querySelector(selectors.badge);
72
+
73
+ return {
74
+ title,
75
+ url: href,
76
+ item_id: '',
77
+ price: clean('¥' + priceNumber + priceDecimal).replace(/^¥\\s*$/, ''),
78
+ original_price: clean(originalPriceNode?.getAttribute('title') || originalPriceNode?.textContent || ''),
79
+ condition: attrs[0] || '',
80
+ brand: attrs[1] || '',
81
+ extra: attrs.slice(2).join(' | '),
82
+ location,
83
+ badge: clean(badgeNode?.getAttribute('title') || badgeNode?.textContent || ''),
84
+ };
85
+ })
86
+ .filter((item) => item.title && item.url);
87
+
88
+ return { requiresAuth, blocked, empty, items };
89
+ })()
90
+ `;
91
+ }
92
+ cli({
93
+ site: 'xianyu',
94
+ name: 'search',
95
+ description: '搜索闲鱼商品',
96
+ domain: 'www.goofish.com',
97
+ strategy: Strategy.COOKIE,
98
+ navigateBefore: false,
99
+ browser: true,
100
+ args: [
101
+ { name: 'query', required: true, positional: true, help: 'Search keyword' },
102
+ { name: 'limit', type: 'int', default: 20, help: 'Number of results to return' },
103
+ ],
104
+ columns: ['item_id', 'rank', 'title', 'price', 'condition', 'brand', 'location', 'badge', 'url'],
105
+ func: async (page, kwargs) => {
106
+ const query = String(kwargs.query || '').trim();
107
+ const limit = normalizeLimit(kwargs.limit);
108
+ await page.goto(buildSearchUrl(query));
109
+ await page.wait(2);
110
+ await page.autoScroll({ times: 2 });
111
+ const payload = await page.evaluate(buildExtractResultsEvaluate(limit));
112
+ if (payload?.requiresAuth) {
113
+ throw new AuthRequiredError('www.goofish.com', 'Xianyu search results require a logged-in browser session');
114
+ }
115
+ if (payload?.blocked) {
116
+ throw new EmptyResultError('xianyu search', 'Xianyu returned a verification page or blocked the current browser session');
117
+ }
118
+ const items = Array.isArray(payload?.items) ? payload.items : [];
119
+ if (!items.length && !payload?.empty) {
120
+ throw new EmptyResultError('xianyu search', 'No item cards were found on the current Xianyu search page');
121
+ }
122
+ return items.map((item, index) => ({
123
+ rank: index + 1,
124
+ ...item,
125
+ item_id: itemIdFromUrl(item.url),
126
+ }));
127
+ },
128
+ });
129
+ export const __test__ = {
130
+ MAX_LIMIT,
131
+ normalizeLimit,
132
+ buildSearchUrl,
133
+ itemIdFromUrl,
134
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { __test__ } from './search.js';
3
+ describe('xianyu search helpers', () => {
4
+ it('normalizes limit into supported range', () => {
5
+ expect(__test__.normalizeLimit(undefined)).toBe(20);
6
+ expect(__test__.normalizeLimit(0)).toBe(1);
7
+ expect(__test__.normalizeLimit(3.8)).toBe(3);
8
+ expect(__test__.normalizeLimit(999)).toBe(__test__.MAX_LIMIT);
9
+ });
10
+ it('builds search URLs with encoded queries', () => {
11
+ expect(__test__.buildSearchUrl('笔记本电脑')).toBe('https://www.goofish.com/search?q=%E7%AC%94%E8%AE%B0%E6%9C%AC%E7%94%B5%E8%84%91');
12
+ });
13
+ it('extracts item ids from detail URLs', () => {
14
+ expect(__test__.itemIdFromUrl('https://www.goofish.com/item?id=954988715389&categoryId=126854525')).toBe('954988715389');
15
+ expect(__test__.itemIdFromUrl('https://www.goofish.com/search?q=test')).toBe('');
16
+ });
17
+ });
@@ -0,0 +1 @@
1
+ export declare function normalizeNumericId(value: unknown, label: string, example: string): string;
@@ -0,0 +1,8 @@
1
+ import { ArgumentError } from '../../errors.js';
2
+ export function normalizeNumericId(value, label, example) {
3
+ const normalized = String(value || '').trim();
4
+ if (!/^\d+$/.test(normalized)) {
5
+ throw new ArgumentError(`${label} must be a numeric ID`, `Pass a numeric ${label}, for example: ${example}`);
6
+ }
7
+ return normalized;
8
+ }
@@ -0,0 +1,129 @@
1
+ site: xiaoe
2
+ name: catalog
3
+ description: 小鹅通课程目录(支持普通课程、专栏、大专栏)
4
+ domain: h5.xet.citv.cn
5
+ strategy: cookie
6
+
7
+ args:
8
+ url:
9
+ type: str
10
+ required: true
11
+ positional: true
12
+ description: 课程页面 URL
13
+
14
+ pipeline:
15
+ - navigate: ${{ args.url }}
16
+
17
+ - wait: 8
18
+
19
+ - evaluate: |
20
+ (async () => {
21
+ var el = document.querySelector('#app');
22
+ var store = (el && el.__vue__) ? el.__vue__.$store : null;
23
+ if (!store) return [];
24
+ var coreInfo = store.state.coreInfo || {};
25
+ var resourceType = coreInfo.resource_type || 0;
26
+ var origin = window.location.origin;
27
+ var courseName = coreInfo.resource_name || '';
28
+
29
+ function typeLabel(t) {
30
+ return {1:'图文',2:'直播',3:'音频',4:'视频',6:'专栏',8:'大专栏'}[Number(t)] || String(t||'');
31
+ }
32
+ function buildUrl(item) {
33
+ var u = item.jump_url || item.h5_url || item.url || '';
34
+ return (u && !u.startsWith('http')) ? origin + u : u;
35
+ }
36
+ function clickTab(name) {
37
+ var tabs = document.querySelectorAll('span, div');
38
+ for (var i = 0; i < tabs.length; i++) {
39
+ if (tabs[i].children.length === 0 && tabs[i].textContent.trim() === name) {
40
+ tabs[i].click(); return;
41
+ }
42
+ }
43
+ }
44
+
45
+ clickTab('目录');
46
+ await new Promise(function(r) { setTimeout(r, 2000); });
47
+
48
+ // ===== 专栏 / 大专栏 =====
49
+ if (resourceType === 6 || resourceType === 8) {
50
+ await new Promise(function(r) { setTimeout(r, 1000); });
51
+ var listData = [];
52
+ var walkList = function(vm, depth) {
53
+ if (!vm || depth > 6 || listData.length > 0) return;
54
+ var d = vm.$data || {};
55
+ var keys = ['columnList', 'SingleItemList', 'chapterChildren'];
56
+ for (var ki = 0; ki < keys.length; ki++) {
57
+ var arr = d[keys[ki]];
58
+ if (arr && Array.isArray(arr) && arr.length > 0 && arr[0].resource_id) {
59
+ for (var j = 0; j < arr.length; j++) {
60
+ var item = arr[j];
61
+ if (!item.resource_id || !/^[pvlai]_/.test(item.resource_id)) continue;
62
+ listData.push({
63
+ ch: 1, chapter: courseName, no: j + 1,
64
+ title: item.resource_title || item.title || item.chapter_title || '',
65
+ type: typeLabel(item.resource_type || item.chapter_type),
66
+ resource_id: item.resource_id,
67
+ url: buildUrl(item),
68
+ status: item.finished_state === 1 ? '已完成' : (item.resource_count ? item.resource_count + '节' : ''),
69
+ });
70
+ }
71
+ return;
72
+ }
73
+ }
74
+ if (vm.$children) {
75
+ for (var c = 0; c < vm.$children.length; c++) walkList(vm.$children[c], depth + 1);
76
+ }
77
+ };
78
+ walkList(el.__vue__, 0);
79
+ return listData;
80
+ }
81
+
82
+ // ===== 普通课程 =====
83
+ var chapters = document.querySelectorAll('.chapter_box');
84
+ for (var ci = 0; ci < chapters.length; ci++) {
85
+ var vue = chapters[ci].__vue__;
86
+ if (vue && typeof vue.getSecitonList === 'function' && (!vue.isShowSecitonsList || !vue.chapterChildren.length)) {
87
+ if (vue.isShowSecitonsList) vue.isShowSecitonsList = false;
88
+ try { vue.getSecitonList(); } catch(e) {}
89
+ await new Promise(function(r) { setTimeout(r, 1500); });
90
+ }
91
+ }
92
+ await new Promise(function(r) { setTimeout(r, 3000); });
93
+
94
+ var result = [];
95
+ chapters = document.querySelectorAll('.chapter_box');
96
+ for (var cj = 0; cj < chapters.length; cj++) {
97
+ var v = chapters[cj].__vue__;
98
+ if (!v) continue;
99
+ var chTitle = (v.chapterItem && v.chapterItem.chapter_title) || '';
100
+ var children = v.chapterChildren || [];
101
+ for (var ck = 0; ck < children.length; ck++) {
102
+ var child = children[ck];
103
+ var resId = child.resource_id || child.chapter_id || '';
104
+ var chType = child.chapter_type || child.resource_type || 0;
105
+ var urlPath = {1:'/v1/course/text/',2:'/v2/course/alive/',3:'/v1/course/audio/',4:'/v1/course/video/'}[Number(chType)];
106
+ result.push({
107
+ ch: cj + 1, chapter: chTitle, no: ck + 1,
108
+ title: child.chapter_title || child.resource_title || '',
109
+ type: typeLabel(chType),
110
+ resource_id: resId,
111
+ url: urlPath ? origin + urlPath + resId + '?type=2' : '',
112
+ status: child.is_finish === 1 ? '已完成' : (child.learn_progress > 0 ? child.learn_progress + '%' : '未学'),
113
+ });
114
+ }
115
+ }
116
+ return result;
117
+ })()
118
+
119
+ - map:
120
+ ch: ${{ item.ch }}
121
+ chapter: ${{ item.chapter }}
122
+ no: ${{ item.no }}
123
+ title: ${{ item.title }}
124
+ type: ${{ item.type }}
125
+ resource_id: ${{ item.resource_id }}
126
+ url: ${{ item.url }}
127
+ status: ${{ item.status }}
128
+
129
+ columns: [ch, chapter, no, title, type, resource_id, status]
@@ -0,0 +1,43 @@
1
+ site: xiaoe
2
+ name: content
3
+ description: 提取小鹅通图文页面内容为文本
4
+ domain: h5.xet.citv.cn
5
+ strategy: cookie
6
+
7
+ args:
8
+ url:
9
+ type: str
10
+ required: true
11
+ positional: true
12
+ description: 页面 URL
13
+
14
+ pipeline:
15
+ - navigate: ${{ args.url }}
16
+
17
+ - wait: 6
18
+
19
+ - evaluate: |
20
+ (() => {
21
+ var selectors = ['.rich-text-wrap','.content-wrap','.article-content','.text-content',
22
+ '.course-detail','.detail-content','[class*="richtext"]','[class*="rich-text"]','.ql-editor'];
23
+ var content = '';
24
+ for (var i = 0; i < selectors.length; i++) {
25
+ var el = document.querySelector(selectors[i]);
26
+ if (el && el.innerText.trim().length > 50) { content = el.innerText.trim(); break; }
27
+ }
28
+ if (!content) content = (document.querySelector('main') || document.querySelector('#app') || document.body).innerText.trim();
29
+
30
+ var images = [];
31
+ document.querySelectorAll('img').forEach(function(img) {
32
+ if (img.src && !img.src.startsWith('data:') && img.src.includes('xiaoe')) images.push(img.src);
33
+ });
34
+ return [{
35
+ title: document.title,
36
+ content: content,
37
+ content_length: content.length,
38
+ image_count: images.length,
39
+ images: JSON.stringify(images.slice(0, 20)),
40
+ }];
41
+ })()
42
+
43
+ columns: [title, content_length, image_count]
@@ -0,0 +1,73 @@
1
+ site: xiaoe
2
+ name: courses
3
+ description: 列出已购小鹅通课程(含 URL 和店铺名)
4
+ domain: study.xiaoe-tech.com
5
+ strategy: cookie
6
+
7
+ pipeline:
8
+ - navigate: https://study.xiaoe-tech.com/
9
+
10
+ - wait: 8
11
+
12
+ - evaluate: |
13
+ (async () => {
14
+ // 切换到「内容」tab
15
+ var tabs = document.querySelectorAll('span, div');
16
+ for (var i = 0; i < tabs.length; i++) {
17
+ if (tabs[i].children.length === 0 && tabs[i].textContent.trim() === '内容') {
18
+ tabs[i].click();
19
+ break;
20
+ }
21
+ }
22
+ await new Promise(function(r) { setTimeout(r, 2000); });
23
+
24
+ // 匹配课程卡片标题与 Vue 数据
25
+ function matchEntry(title, vm, depth) {
26
+ if (!vm || depth > 5) return null;
27
+ var d = vm.$data || {};
28
+ for (var k in d) {
29
+ if (!Array.isArray(d[k])) continue;
30
+ for (var j = 0; j < d[k].length; j++) {
31
+ var e = d[k][j];
32
+ if (!e || typeof e !== 'object') continue;
33
+ var t = e.title || e.resource_name || '';
34
+ if (t && title.includes(t.substring(0, 10))) return e;
35
+ }
36
+ }
37
+ return vm.$parent ? matchEntry(title, vm.$parent, depth + 1) : null;
38
+ }
39
+
40
+ // 构造课程 URL
41
+ function buildUrl(entry) {
42
+ if (entry.h5_url) return entry.h5_url;
43
+ if (entry.url) return entry.url;
44
+ if (entry.app_id && entry.resource_id) {
45
+ var base = 'https://' + entry.app_id + '.h5.xet.citv.cn';
46
+ if (entry.resource_type === 6) return base + '/v1/course/column/' + entry.resource_id + '?type=3';
47
+ return base + '/p/course/ecourse/' + entry.resource_id;
48
+ }
49
+ return '';
50
+ }
51
+
52
+ var cards = document.querySelectorAll('.course-card-list');
53
+ var results = [];
54
+ for (var c = 0; c < cards.length; c++) {
55
+ var titleEl = cards[c].querySelector('.card-title-box');
56
+ var title = titleEl ? titleEl.textContent.trim() : '';
57
+ if (!title) continue;
58
+ var entry = matchEntry(title, cards[c].__vue__, 0);
59
+ results.push({
60
+ title: title,
61
+ shop: entry ? (entry.shop_name || entry.app_name || '') : '',
62
+ url: entry ? buildUrl(entry) : '',
63
+ });
64
+ }
65
+ return results;
66
+ })()
67
+
68
+ - map:
69
+ title: ${{ item.title }}
70
+ shop: ${{ item.shop }}
71
+ url: ${{ item.url }}
72
+
73
+ columns: [title, shop, url]
@@ -0,0 +1,39 @@
1
+ site: xiaoe
2
+ name: detail
3
+ description: 小鹅通课程详情(名称、价格、学员数、店铺)
4
+ domain: h5.xet.citv.cn
5
+ strategy: cookie
6
+
7
+ args:
8
+ url:
9
+ type: str
10
+ required: true
11
+ positional: true
12
+ description: 课程页面 URL
13
+
14
+ pipeline:
15
+ - navigate: ${{ args.url }}
16
+
17
+ - wait: 5
18
+
19
+ - evaluate: |
20
+ (() => {
21
+ var vm = (document.querySelector('#app') || {}).__vue__;
22
+ if (!vm || !vm.$store) return [];
23
+ var core = vm.$store.state.coreInfo || {};
24
+ var goods = vm.$store.state.goodsInfo || {};
25
+ var shop = ((vm.$store.state.compositeInfo || {}).shop_conf) || {};
26
+ return [{
27
+ name: core.resource_name || '',
28
+ resource_id: core.resource_id || '',
29
+ resource_type: core.resource_type || '',
30
+ cover: core.resource_img || '',
31
+ user_count: core.user_count || 0,
32
+ price: goods.price ? (goods.price / 100).toFixed(2) : '0',
33
+ original_price: goods.line_price ? (goods.line_price / 100).toFixed(2) : '0',
34
+ is_free: goods.is_free || 0,
35
+ shop_name: shop.shop_name || '',
36
+ }];
37
+ })()
38
+
39
+ columns: [name, price, original_price, user_count, shop_name]
@@ -0,0 +1,124 @@
1
+ site: xiaoe
2
+ name: play-url
3
+ description: 小鹅通视频/音频/直播回放 M3U8 播放地址
4
+ domain: h5.xet.citv.cn
5
+ strategy: cookie
6
+
7
+ args:
8
+ url:
9
+ type: str
10
+ required: true
11
+ positional: true
12
+ description: 小节页面 URL
13
+
14
+ pipeline:
15
+ - navigate: ${{ args.url }}
16
+
17
+ - wait: 2
18
+
19
+ - evaluate: |
20
+ (async () => {
21
+ var pageUrl = window.location.href;
22
+ var origin = window.location.origin;
23
+ var resourceId = (pageUrl.match(/[val]_[a-f0-9]+/) || [])[0] || '';
24
+ var productId = (pageUrl.match(/product_id=([^&]+)/) || [])[1] || '';
25
+ var appId = (origin.match(/(app[a-z0-9]+)\./) || [])[1] || '';
26
+ var isLive = resourceId.startsWith('l_') || pageUrl.includes('/alive/');
27
+ var m3u8Url = '', method = '', title = document.title, duration = 0;
28
+
29
+ // 深度搜索 Vue 组件树找 M3U8
30
+ function searchVueM3u8() {
31
+ var el = document.querySelector('#app');
32
+ if (!el || !el.__vue__) return '';
33
+ var walk = function(vm, d) {
34
+ if (!vm || d > 10) return '';
35
+ var data = vm.$data || {};
36
+ for (var k in data) {
37
+ if (k[0] === '_' || k[0] === '$') continue;
38
+ var v = data[k];
39
+ if (typeof v === 'string' && v.includes('.m3u8')) return v;
40
+ if (typeof v === 'object' && v) {
41
+ try {
42
+ var s = JSON.stringify(v);
43
+ var m = s.match(/https?:[^"]*\.m3u8[^"]*/);
44
+ if (m) return m[0].replace(/\\\//g, '/');
45
+ } catch(e) {}
46
+ }
47
+ }
48
+ if (vm.$children) {
49
+ for (var c = 0; c < vm.$children.length; c++) {
50
+ var f = walk(vm.$children[c], d + 1);
51
+ if (f) return f;
52
+ }
53
+ }
54
+ return '';
55
+ };
56
+ return walk(el.__vue__, 0);
57
+ }
58
+
59
+ // ===== 视频课: detail_info → getPlayUrl =====
60
+ if (!isLive && resourceId.startsWith('v_')) {
61
+ try {
62
+ var detailRes = await fetch(origin + '/xe.course.business.video.detail_info.get/2.0.0', {
63
+ method: 'POST', credentials: 'include',
64
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
65
+ body: new URLSearchParams({
66
+ 'bizData[resource_id]': resourceId,
67
+ 'bizData[product_id]': productId || resourceId,
68
+ 'bizData[opr_sys]': 'MacIntel',
69
+ }),
70
+ });
71
+ var detail = await detailRes.json();
72
+ var vi = (detail.data || {}).video_info || {};
73
+ title = vi.file_name || title;
74
+ duration = vi.video_length || 0;
75
+ if (vi.play_sign) {
76
+ var userId = (document.cookie.match(/ctx_user_id=([^;]+)/) || [])[1] || window.__user_id || '';
77
+ var playRes = await fetch(origin + '/xe.material-center.play/getPlayUrl', {
78
+ method: 'POST', credentials: 'include',
79
+ headers: { 'Content-Type': 'application/json' },
80
+ body: JSON.stringify({
81
+ org_app_id: appId, app_id: vi.material_app_id || appId,
82
+ user_id: userId, play_sign: [vi.play_sign],
83
+ play_line: 'A', opr_sys: 'MacIntel',
84
+ }),
85
+ });
86
+ var playData = await playRes.json();
87
+ if (playData.code === 0 && playData.data) {
88
+ var m = JSON.stringify(playData.data).match(/https?:[^"]*\.m3u8[^"]*/);
89
+ if (m) { m3u8Url = m[0].replace(/\\u0026/g, '&').replace(/\\\//g, '/'); method = 'api_direct'; }
90
+ }
91
+ }
92
+ } catch(e) {}
93
+ }
94
+
95
+ // ===== 兜底: Performance API + Vue 搜索轮询 =====
96
+ if (!m3u8Url) {
97
+ for (var attempt = 0; attempt < 30; attempt++) {
98
+ var entries = performance.getEntriesByType('resource');
99
+ for (var i = 0; i < entries.length; i++) {
100
+ if (entries[i].name.includes('.m3u8')) { m3u8Url = entries[i].name; method = 'perf_api'; break; }
101
+ }
102
+ if (!m3u8Url) { m3u8Url = searchVueM3u8(); if (m3u8Url) method = 'vue_search'; }
103
+ if (m3u8Url) break;
104
+ await new Promise(function(r) { setTimeout(r, 500); });
105
+ }
106
+ }
107
+
108
+ if (!duration) {
109
+ var vid = document.querySelector('video'), aud = document.querySelector('audio');
110
+ if (vid && vid.duration && !isNaN(vid.duration)) duration = Math.round(vid.duration);
111
+ if (aud && aud.duration && !isNaN(aud.duration)) duration = Math.round(aud.duration);
112
+ }
113
+
114
+ return [{ title: title, resource_id: resourceId, m3u8_url: m3u8Url, duration_sec: duration, method: method }];
115
+ })()
116
+
117
+ - map:
118
+ title: ${{ item.title }}
119
+ resource_id: ${{ item.resource_id }}
120
+ m3u8_url: ${{ item.m3u8_url }}
121
+ duration_sec: ${{ item.duration_sec }}
122
+ method: ${{ item.method }}
123
+
124
+ columns: [title, resource_id, m3u8_url, duration_sec, method]
@@ -13,8 +13,6 @@ function createPageMock(evaluateResult) {
13
13
  getFormState: vi.fn().mockResolvedValue({ forms: [], orphanFields: [] }),
14
14
  wait: vi.fn().mockResolvedValue(undefined),
15
15
  tabs: vi.fn().mockResolvedValue([]),
16
- closeTab: vi.fn().mockResolvedValue(undefined),
17
- newTab: vi.fn().mockResolvedValue(undefined),
18
16
  selectTab: vi.fn().mockResolvedValue(undefined),
19
17
  networkRequests: vi.fn().mockResolvedValue([]),
20
18
  consoleMessages: vi.fn().mockResolvedValue([]),
@@ -19,8 +19,6 @@ function createPageMock(evaluateResult) {
19
19
  getFormState: vi.fn().mockResolvedValue({ forms: [], orphanFields: [] }),
20
20
  wait: vi.fn().mockResolvedValue(undefined),
21
21
  tabs: vi.fn().mockResolvedValue([]),
22
- closeTab: vi.fn().mockResolvedValue(undefined),
23
- newTab: vi.fn().mockResolvedValue(undefined),
24
22
  selectTab: vi.fn().mockResolvedValue(undefined),
25
23
  networkRequests: vi.fn().mockResolvedValue([]),
26
24
  consoleMessages: vi.fn().mockResolvedValue([]),
@@ -22,8 +22,6 @@ function createPageMock(evaluateResult, interceptedRequests = []) {
22
22
  getFormState: vi.fn().mockResolvedValue({ forms: [], orphanFields: [] }),
23
23
  wait: vi.fn().mockResolvedValue(undefined),
24
24
  tabs: vi.fn().mockResolvedValue([]),
25
- closeTab: vi.fn().mockResolvedValue(undefined),
26
- newTab: vi.fn().mockResolvedValue(undefined),
27
25
  selectTab: vi.fn().mockResolvedValue(undefined),
28
26
  networkRequests: vi.fn().mockResolvedValue([]),
29
27
  consoleMessages: vi.fn().mockResolvedValue([]),
@@ -23,8 +23,6 @@ function createPageMock(evaluateResult) {
23
23
  getFormState: vi.fn().mockResolvedValue({ forms: [], orphanFields: [] }),
24
24
  wait: vi.fn().mockResolvedValue(undefined),
25
25
  tabs: vi.fn().mockResolvedValue([]),
26
- closeTab: vi.fn().mockResolvedValue(undefined),
27
- newTab: vi.fn().mockResolvedValue(undefined),
28
26
  selectTab: vi.fn().mockResolvedValue(undefined),
29
27
  networkRequests: vi.fn().mockResolvedValue([]),
30
28
  consoleMessages: vi.fn().mockResolvedValue([]),
@@ -14,8 +14,6 @@ function createPageMock(evaluateResult) {
14
14
  getFormState: vi.fn().mockResolvedValue({ forms: [], orphanFields: [] }),
15
15
  wait: vi.fn().mockResolvedValue(undefined),
16
16
  tabs: vi.fn().mockResolvedValue([]),
17
- closeTab: vi.fn().mockResolvedValue(undefined),
18
- newTab: vi.fn().mockResolvedValue(undefined),
19
17
  selectTab: vi.fn().mockResolvedValue(undefined),
20
18
  networkRequests: vi.fn().mockResolvedValue([]),
21
19
  consoleMessages: vi.fn().mockResolvedValue([]),
@@ -20,8 +20,6 @@ function createPageMock(evaluateResults, overrides = {}) {
20
20
  getFormState: vi.fn().mockResolvedValue({ forms: [], orphanFields: [] }),
21
21
  wait: vi.fn().mockResolvedValue(undefined),
22
22
  tabs: vi.fn().mockResolvedValue([]),
23
- closeTab: vi.fn().mockResolvedValue(undefined),
24
- newTab: vi.fn().mockResolvedValue(undefined),
25
23
  selectTab: vi.fn().mockResolvedValue(undefined),
26
24
  networkRequests: vi.fn().mockResolvedValue([]),
27
25
  consoleMessages: vi.fn().mockResolvedValue([]),