@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.
- package/CONTRIBUTING.md +1 -1
- package/README.md +27 -45
- package/README.zh-CN.md +32 -34
- package/autoresearch/browse-tasks.json +18 -20
- package/autoresearch/commands/debug.ts +163 -0
- package/autoresearch/commands/fix.ts +145 -0
- package/autoresearch/commands/plan.ts +88 -0
- package/autoresearch/commands/run.ts +138 -0
- package/autoresearch/config.ts +82 -0
- package/autoresearch/engine.ts +359 -0
- package/autoresearch/eval-all.ts +127 -0
- package/autoresearch/eval-browse.ts +1 -1
- package/autoresearch/eval-publish.ts +238 -0
- package/autoresearch/eval-save.ts +249 -0
- package/autoresearch/eval-skill.ts +14 -8
- package/autoresearch/eval-v2ex.ts +220 -0
- package/autoresearch/eval-zhihu.ts +230 -0
- package/autoresearch/logger.ts +69 -0
- package/autoresearch/presets/combined-reliability.ts +27 -0
- package/autoresearch/presets/index.ts +23 -0
- package/autoresearch/presets/operate-reliability.ts +24 -0
- package/autoresearch/presets/save-reliability.ts +26 -0
- package/autoresearch/presets/skill-quality.ts +20 -0
- package/autoresearch/presets/v2ex-reliability.ts +24 -0
- package/autoresearch/presets/zhihu-reliability.ts +25 -0
- package/autoresearch/publish-tasks.json +345 -0
- package/autoresearch/run-save.sh +11 -0
- package/autoresearch/save-adapters/xhs-explore-deep.ts +64 -0
- package/autoresearch/save-adapters/xhs-note-comments.ts +61 -0
- package/autoresearch/save-adapters/xhs-search-full.ts +62 -0
- package/autoresearch/save-adapters/zhihu-hot-detail.ts +52 -0
- package/autoresearch/save-adapters/zhihu-question-full.ts +57 -0
- package/autoresearch/save-adapters/zhihu-search-detail.ts +53 -0
- package/autoresearch/save-tasks.json +281 -0
- package/autoresearch/v2ex-tasks.json +899 -0
- package/autoresearch/zhihu-tasks.json +848 -0
- package/dist/browser/base-page.d.ts +4 -2
- package/dist/browser/base-page.js +37 -4
- package/dist/browser/bridge.js +10 -8
- package/dist/browser/cdp.js +2 -6
- package/dist/browser/daemon-client.d.ts +11 -1
- package/dist/browser/daemon-client.js +3 -0
- package/dist/browser/dom-helpers.d.ts +4 -2
- package/dist/browser/dom-helpers.js +42 -31
- package/dist/browser/dom-snapshot.js +23 -1
- package/dist/browser/page.d.ts +7 -2
- package/dist/browser/page.js +112 -30
- package/dist/browser.test.js +1 -1
- package/dist/build-manifest.d.ts +1 -0
- package/dist/build-manifest.js +1 -0
- package/dist/cli-manifest.json +1135 -184
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +48 -7
- package/dist/cli.test.d.ts +1 -0
- package/dist/cli.test.js +88 -0
- package/dist/clis/1688/item.d.ts +70 -0
- package/dist/clis/1688/item.js +187 -0
- package/dist/clis/1688/item.test.d.ts +1 -0
- package/dist/clis/1688/item.test.js +67 -0
- package/dist/clis/1688/search.d.ts +56 -0
- package/dist/clis/1688/search.js +309 -0
- package/dist/clis/1688/search.test.d.ts +1 -0
- package/dist/clis/1688/search.test.js +75 -0
- package/dist/clis/1688/shared.d.ts +112 -0
- package/dist/clis/1688/shared.js +514 -0
- package/dist/clis/1688/shared.test.d.ts +1 -0
- package/dist/clis/1688/shared.test.js +57 -0
- package/dist/clis/1688/store.d.ts +45 -0
- package/dist/clis/1688/store.js +226 -0
- package/dist/clis/1688/store.test.d.ts +1 -0
- package/dist/clis/1688/store.test.js +62 -0
- package/dist/clis/amazon/bestsellers.d.ts +0 -20
- package/dist/clis/amazon/bestsellers.js +6 -129
- package/dist/clis/amazon/bestsellers.test.js +12 -3
- package/dist/clis/amazon/movers-shakers.d.ts +1 -0
- package/dist/clis/amazon/movers-shakers.js +7 -0
- package/dist/clis/amazon/new-releases.d.ts +1 -0
- package/dist/clis/amazon/new-releases.js +7 -0
- package/dist/clis/amazon/rankings.d.ts +59 -0
- package/dist/clis/amazon/rankings.js +226 -0
- package/dist/clis/amazon/rankings.test.d.ts +1 -0
- package/dist/clis/amazon/rankings.test.js +41 -0
- package/dist/clis/amazon/shared.d.ts +11 -0
- package/dist/clis/amazon/shared.js +121 -11
- package/dist/clis/amazon/shared.test.js +11 -0
- package/dist/clis/bilibili/comments.js +2 -2
- package/dist/clis/bilibili/comments.test.js +3 -2
- package/dist/clis/bilibili/download.js +2 -1
- package/dist/clis/bilibili/subtitle.js +4 -3
- package/dist/clis/bilibili/subtitle.test.js +2 -1
- package/dist/clis/bilibili/utils.d.ts +5 -0
- package/dist/clis/bilibili/utils.js +30 -0
- package/dist/clis/bilibili/utils.test.d.ts +1 -0
- package/dist/clis/bilibili/utils.test.js +17 -0
- package/dist/clis/douban/marks.js +1 -1
- package/dist/clis/douban/subject.yaml +50 -19
- package/dist/clis/doubao/utils.js +32 -12
- package/dist/clis/douyin/_shared/browser-fetch.test.js +0 -1
- package/dist/clis/douyin/_shared/transcode.test.js +0 -2
- package/dist/clis/douyin/draft.test.js +0 -2
- package/dist/clis/facebook/search.test.js +0 -2
- package/dist/clis/gemini/ask.js +9 -3
- package/dist/clis/gemini/ask.test.d.ts +1 -0
- package/dist/clis/gemini/ask.test.js +100 -0
- package/dist/clis/gemini/reply-state.test.d.ts +1 -0
- package/dist/clis/gemini/reply-state.test.js +641 -0
- package/dist/clis/gemini/utils.d.ts +44 -1
- package/dist/clis/gemini/utils.js +528 -61
- package/dist/clis/gemini/utils.test.js +149 -2
- package/dist/clis/hupu/detail.d.ts +1 -0
- package/dist/clis/hupu/detail.js +72 -0
- package/dist/clis/hupu/hot.yaml +43 -0
- package/dist/clis/hupu/like.d.ts +1 -0
- package/dist/clis/hupu/like.js +75 -0
- package/dist/clis/hupu/reply.d.ts +1 -0
- package/dist/clis/hupu/reply.js +71 -0
- package/dist/clis/hupu/search.d.ts +1 -0
- package/dist/clis/hupu/search.js +59 -0
- package/dist/clis/hupu/unlike.d.ts +1 -0
- package/dist/clis/hupu/unlike.js +75 -0
- package/dist/clis/hupu/utils.d.ts +20 -0
- package/dist/clis/hupu/utils.js +319 -0
- package/dist/clis/instagram/_shared/private-publish.d.ts +138 -0
- package/dist/clis/instagram/_shared/private-publish.js +1030 -0
- package/dist/clis/instagram/_shared/private-publish.test.d.ts +1 -0
- package/dist/clis/instagram/_shared/private-publish.test.js +705 -0
- package/dist/clis/instagram/_shared/protocol-capture.d.ts +26 -0
- package/dist/clis/instagram/_shared/protocol-capture.js +282 -0
- package/dist/clis/instagram/_shared/protocol-capture.test.d.ts +1 -0
- package/dist/clis/instagram/_shared/protocol-capture.test.js +114 -0
- package/dist/clis/instagram/_shared/runtime-info.d.ts +9 -0
- package/dist/clis/instagram/_shared/runtime-info.js +81 -0
- package/dist/clis/instagram/note.d.ts +1 -0
- package/dist/clis/instagram/note.js +222 -0
- package/dist/clis/instagram/note.test.d.ts +1 -0
- package/dist/clis/instagram/note.test.js +81 -0
- package/dist/clis/instagram/post.d.ts +4 -0
- package/dist/clis/instagram/post.js +1496 -0
- package/dist/clis/instagram/post.test.d.ts +1 -0
- package/dist/clis/instagram/post.test.js +1647 -0
- package/dist/clis/instagram/reel.d.ts +1 -0
- package/dist/clis/instagram/reel.js +826 -0
- package/dist/clis/instagram/reel.test.d.ts +1 -0
- package/dist/clis/instagram/reel.test.js +167 -0
- package/dist/clis/instagram/story.d.ts +1 -0
- package/dist/clis/instagram/story.js +115 -0
- package/dist/clis/instagram/story.test.d.ts +1 -0
- package/dist/clis/instagram/story.test.js +167 -0
- package/dist/clis/sinafinance/stock-rank.d.ts +4 -0
- package/dist/clis/sinafinance/stock-rank.js +65 -0
- package/dist/clis/substack/utils.test.js +0 -2
- package/dist/clis/twitter/post.js +72 -45
- package/dist/clis/twitter/post.test.d.ts +1 -0
- package/dist/clis/twitter/post.test.js +116 -0
- package/dist/clis/twitter/reply.d.ts +12 -0
- package/dist/clis/twitter/reply.js +257 -35
- package/dist/clis/twitter/reply.test.d.ts +1 -0
- package/dist/clis/twitter/reply.test.js +151 -0
- package/dist/clis/xianyu/chat.d.ts +7 -0
- package/dist/clis/xianyu/chat.js +146 -0
- package/dist/clis/xianyu/chat.test.d.ts +1 -0
- package/dist/clis/xianyu/chat.test.js +15 -0
- package/dist/clis/xianyu/item.d.ts +7 -0
- package/dist/clis/xianyu/item.js +152 -0
- package/dist/clis/xianyu/item.test.d.ts +1 -0
- package/dist/clis/xianyu/item.test.js +56 -0
- package/dist/clis/xianyu/search.d.ts +10 -0
- package/dist/clis/xianyu/search.js +134 -0
- package/dist/clis/xianyu/search.test.d.ts +1 -0
- package/dist/clis/xianyu/search.test.js +17 -0
- package/dist/clis/xianyu/utils.d.ts +1 -0
- package/dist/clis/xianyu/utils.js +8 -0
- package/dist/clis/xiaoe/catalog.yaml +129 -0
- package/dist/clis/xiaoe/content.yaml +43 -0
- package/dist/clis/xiaoe/courses.yaml +73 -0
- package/dist/clis/xiaoe/detail.yaml +39 -0
- package/dist/clis/xiaoe/play-url.yaml +124 -0
- package/dist/clis/xiaohongshu/comments.test.js +0 -2
- package/dist/clis/xiaohongshu/creator-note-detail.test.js +0 -2
- package/dist/clis/xiaohongshu/creator-notes.test.js +0 -2
- package/dist/clis/xiaohongshu/download.test.js +0 -2
- package/dist/clis/xiaohongshu/note.test.js +0 -2
- package/dist/clis/xiaohongshu/publish.test.js +0 -2
- package/dist/clis/xiaohongshu/search.js +29 -20
- package/dist/clis/xiaohongshu/search.test.js +56 -48
- package/dist/clis/yuanbao/ask.d.ts +21 -0
- package/dist/clis/yuanbao/ask.js +427 -0
- package/dist/clis/yuanbao/ask.test.d.ts +1 -0
- package/dist/clis/yuanbao/ask.test.js +124 -0
- package/dist/clis/yuanbao/new.d.ts +1 -0
- package/dist/clis/yuanbao/new.js +70 -0
- package/dist/clis/yuanbao/new.test.d.ts +1 -0
- package/dist/clis/yuanbao/new.test.js +30 -0
- package/dist/clis/yuanbao/shared.d.ts +13 -0
- package/dist/clis/yuanbao/shared.js +49 -0
- package/dist/clis/zhihu/question.js +30 -19
- package/dist/clis/zhihu/question.test.js +34 -16
- package/dist/commanderAdapter.js +8 -4
- package/dist/commanderAdapter.test.js +42 -0
- package/dist/completion.js +3 -1
- package/dist/completion.test.d.ts +1 -0
- package/dist/completion.test.js +23 -0
- package/dist/doctor.js +1 -1
- package/dist/electron-apps.d.ts +2 -0
- package/dist/electron-apps.js +7 -1
- package/dist/errors.js +1 -1
- package/dist/execution.js +25 -35
- package/dist/explore.js +1 -1
- package/dist/launcher.d.ts +4 -0
- package/dist/launcher.js +64 -8
- package/dist/launcher.test.js +88 -7
- package/dist/output.d.ts +2 -0
- package/dist/output.js +10 -1
- package/dist/output.test.d.ts +0 -3
- package/dist/output.test.js +59 -92
- package/dist/pipeline/executor.test.js +0 -2
- package/dist/pipeline/steps/download.test.js +0 -2
- package/dist/registry.d.ts +2 -0
- package/dist/serialization.d.ts +1 -0
- package/dist/serialization.js +1 -0
- package/dist/types.d.ts +9 -2
- package/docs/.vitepress/config.mts +4 -0
- package/docs/adapters/browser/1688.md +52 -0
- package/docs/adapters/browser/36kr.md +2 -1
- package/docs/adapters/browser/doubao.md +5 -1
- package/docs/adapters/browser/hupu.md +53 -0
- package/docs/adapters/browser/sinafinance.md +32 -2
- package/docs/adapters/browser/weibo.md +6 -1
- package/docs/adapters/browser/wikipedia.md +2 -0
- package/docs/adapters/browser/xianyu.md +42 -0
- package/docs/adapters/browser/xiaoe.md +44 -0
- package/docs/adapters/browser/yuanbao.md +64 -0
- package/docs/adapters/index.md +14 -5
- package/docs/comparison.md +1 -1
- package/docs/developer/ai-workflow.md +2 -2
- package/docs/developer/contributing.md +1 -1
- package/docs/developer/testing.md +2 -0
- package/docs/guide/plugins.md +1 -0
- package/docs/guide/troubleshooting.md +11 -0
- package/docs/superpowers/specs/2026-04-03-v2ex-autoresearch-design.md +41 -0
- package/docs/zh/guide/plugins.md +1 -0
- package/extension/dist/background.js +1127 -0
- package/extension/src/background.test.ts +39 -0
- package/extension/src/background.ts +223 -34
- package/extension/src/cdp.ts +194 -4
- package/extension/src/protocol.ts +22 -1
- package/package.json +3 -2
- package/scripts/postinstall.js +1 -1
- package/skills/opencli-explorer/SKILL.md +1 -1
- package/skills/opencli-oneshot/SKILL.md +2 -2
- package/skills/opencli-operate/SKILL.md +120 -27
- package/skills/opencli-usage/SKILL.md +31 -20
- package/skills/opencli-usage/browser.md +114 -16
- package/skills/opencli-usage/public-api.md +32 -3
- package/skills/smart-search/SKILL.md +156 -0
- package/skills/smart-search/references/sources-ai.md +74 -0
- package/skills/smart-search/references/sources-info.md +43 -0
- package/skills/smart-search/references/sources-media.md +50 -0
- package/skills/smart-search/references/sources-other.md +42 -0
- package/skills/smart-search/references/sources-shopping.md +31 -0
- package/skills/smart-search/references/sources-social.md +51 -0
- package/skills/smart-search/references/sources-tech.md +42 -0
- package/skills/smart-search/references/sources-travel.md +20 -0
- package/src/browser/base-page.ts +41 -6
- package/src/browser/bridge.ts +11 -8
- package/src/browser/cdp.ts +1 -8
- package/src/browser/daemon-client.ts +11 -1
- package/src/browser/dom-helpers.ts +43 -31
- package/src/browser/dom-snapshot.ts +23 -1
- package/src/browser/page.ts +115 -31
- package/src/browser.test.ts +1 -1
- package/src/build-manifest.ts +2 -0
- package/src/cli.test.ts +133 -0
- package/src/cli.ts +73 -11
- package/src/clis/1688/item.test.ts +69 -0
- package/src/clis/1688/item.ts +282 -0
- package/src/clis/1688/search.test.ts +81 -0
- package/src/clis/1688/search.ts +402 -0
- package/src/clis/1688/shared.test.ts +75 -0
- package/src/clis/1688/shared.ts +623 -0
- package/src/clis/1688/store.test.ts +69 -0
- package/src/clis/1688/store.ts +300 -0
- package/src/clis/amazon/bestsellers.test.ts +12 -3
- package/src/clis/amazon/bestsellers.ts +6 -178
- package/src/clis/amazon/movers-shakers.ts +8 -0
- package/src/clis/amazon/new-releases.ts +8 -0
- package/src/clis/amazon/rankings.test.ts +47 -0
- package/src/clis/amazon/rankings.ts +312 -0
- package/src/clis/amazon/shared.test.ts +16 -0
- package/src/clis/amazon/shared.ts +134 -12
- package/src/clis/bilibili/comments.test.ts +4 -3
- package/src/clis/bilibili/comments.ts +2 -2
- package/src/clis/bilibili/download.ts +2 -1
- package/src/clis/bilibili/subtitle.test.ts +2 -1
- package/src/clis/bilibili/subtitle.ts +4 -3
- package/src/clis/bilibili/utils.test.ts +21 -0
- package/src/clis/bilibili/utils.ts +27 -0
- package/src/clis/douban/marks.ts +1 -1
- package/src/clis/douban/subject.yaml +50 -19
- package/src/clis/doubao/utils.ts +32 -12
- package/src/clis/douyin/_shared/browser-fetch.test.ts +0 -1
- package/src/clis/douyin/_shared/transcode.test.ts +0 -2
- package/src/clis/douyin/draft.test.ts +0 -2
- package/src/clis/facebook/search.test.ts +0 -2
- package/src/clis/gemini/ask.test.ts +116 -0
- package/src/clis/gemini/ask.ts +10 -3
- package/src/clis/gemini/reply-state.test.ts +708 -0
- package/src/clis/gemini/utils.test.ts +184 -2
- package/src/clis/gemini/utils.ts +588 -60
- package/src/clis/hupu/detail.ts +126 -0
- package/src/clis/hupu/hot.yaml +43 -0
- package/src/clis/hupu/like.ts +76 -0
- package/src/clis/hupu/reply.ts +76 -0
- package/src/clis/hupu/search.ts +95 -0
- package/src/clis/hupu/unlike.ts +76 -0
- package/src/clis/hupu/utils.ts +381 -0
- package/src/clis/instagram/_shared/private-publish.test.ts +827 -0
- package/src/clis/instagram/_shared/private-publish.ts +1303 -0
- package/src/clis/instagram/_shared/protocol-capture.test.ts +148 -0
- package/src/clis/instagram/_shared/protocol-capture.ts +321 -0
- package/src/clis/instagram/_shared/runtime-info.ts +91 -0
- package/src/clis/instagram/note.test.ts +96 -0
- package/src/clis/instagram/note.ts +254 -0
- package/src/clis/instagram/post.test.ts +1716 -0
- package/src/clis/instagram/post.ts +1620 -0
- package/src/clis/instagram/reel.test.ts +191 -0
- package/src/clis/instagram/reel.ts +886 -0
- package/src/clis/instagram/story.test.ts +191 -0
- package/src/clis/instagram/story.ts +151 -0
- package/src/clis/sinafinance/stock-rank.ts +68 -0
- package/src/clis/substack/utils.test.ts +0 -2
- package/src/clis/twitter/post.test.ts +157 -0
- package/src/clis/twitter/post.ts +82 -48
- package/src/clis/twitter/reply.test.ts +177 -0
- package/src/clis/twitter/reply.ts +285 -39
- package/src/clis/xianyu/chat.test.ts +20 -0
- package/src/clis/xianyu/chat.ts +175 -0
- package/src/clis/xianyu/item.test.ts +67 -0
- package/src/clis/xianyu/item.ts +172 -0
- package/src/clis/xianyu/search.test.ts +22 -0
- package/src/clis/xianyu/search.ts +151 -0
- package/src/clis/xianyu/utils.ts +9 -0
- package/src/clis/xiaoe/catalog.yaml +129 -0
- package/src/clis/xiaoe/content.yaml +43 -0
- package/src/clis/xiaoe/courses.yaml +73 -0
- package/src/clis/xiaoe/detail.yaml +39 -0
- package/src/clis/xiaoe/play-url.yaml +124 -0
- package/src/clis/xiaohongshu/comments.test.ts +0 -2
- package/src/clis/xiaohongshu/creator-note-detail.test.ts +0 -2
- package/src/clis/xiaohongshu/creator-notes.test.ts +0 -2
- package/src/clis/xiaohongshu/download.test.ts +0 -2
- package/src/clis/xiaohongshu/note.test.ts +0 -2
- package/src/clis/xiaohongshu/publish.test.ts +0 -2
- package/src/clis/xiaohongshu/search.test.ts +59 -48
- package/src/clis/xiaohongshu/search.ts +31 -21
- package/src/clis/yuanbao/ask.test.ts +156 -0
- package/src/clis/yuanbao/ask.ts +522 -0
- package/src/clis/yuanbao/new.test.ts +36 -0
- package/src/clis/yuanbao/new.ts +81 -0
- package/src/clis/yuanbao/shared.ts +57 -0
- package/src/clis/zhihu/question.test.ts +42 -17
- package/src/clis/zhihu/question.ts +31 -26
- package/src/commanderAdapter.test.ts +51 -0
- package/src/commanderAdapter.ts +8 -4
- package/src/completion.test.ts +30 -0
- package/src/completion.ts +3 -1
- package/src/doctor.ts +1 -1
- package/src/electron-apps.ts +9 -1
- package/src/errors.ts +1 -1
- package/src/execution.ts +26 -30
- package/src/explore.ts +1 -1
- package/src/launcher.test.ts +121 -7
- package/src/launcher.ts +87 -9
- package/src/output.test.ts +50 -90
- package/src/output.ts +10 -1
- package/src/pipeline/executor.test.ts +0 -2
- package/src/pipeline/steps/download.test.ts +0 -2
- package/src/registry.ts +2 -0
- package/src/serialization.ts +2 -0
- package/src/types.ts +9 -2
- package/tests/e2e/browser-auth.test.ts +9 -0
- package/CLI-EXPLORER.md +0 -724
- package/CLI-ONESHOT.md +0 -216
- package/SKILL.md +0 -59
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { getHupuThreadUrl, readHupuNextData, stripHtml } from './utils.js';
|
|
3
|
+
|
|
4
|
+
// JSON数据结构(对应Next.js的__NEXT_DATA__)
|
|
5
|
+
interface NextData {
|
|
6
|
+
props: Props;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
pageProps: PageProps;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface PageProps {
|
|
14
|
+
detail?: Detail;
|
|
15
|
+
detail_error_info?: DetailError;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DetailError {
|
|
19
|
+
code: number;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface Detail {
|
|
24
|
+
thread?: Thread;
|
|
25
|
+
lights?: ReplyData[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface Thread {
|
|
29
|
+
tid: string;
|
|
30
|
+
title: string;
|
|
31
|
+
content: string;
|
|
32
|
+
lights?: number;
|
|
33
|
+
replies?: number;
|
|
34
|
+
author?: Author;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface Author {
|
|
38
|
+
puname?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface ReplyData {
|
|
42
|
+
pid: string;
|
|
43
|
+
author?: Author;
|
|
44
|
+
content: string;
|
|
45
|
+
allLightCount?: number; // 修复:正确的字段名
|
|
46
|
+
created_at_format?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
cli({
|
|
50
|
+
site: 'hupu',
|
|
51
|
+
name: 'detail',
|
|
52
|
+
description: '获取虎扑帖子详情 (使用Next.js JSON数据)',
|
|
53
|
+
domain: 'bbs.hupu.com',
|
|
54
|
+
strategy: Strategy.PUBLIC,
|
|
55
|
+
browser: true,
|
|
56
|
+
navigateBefore: false,
|
|
57
|
+
args: [
|
|
58
|
+
{
|
|
59
|
+
name: 'tid',
|
|
60
|
+
required: true,
|
|
61
|
+
positional: true,
|
|
62
|
+
help: '帖子ID(9位数字)'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'replies',
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
default: false,
|
|
68
|
+
help: '是否包含热门回复'
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
columns: ['title', 'author', 'content', 'replies', 'lights', 'url'],
|
|
72
|
+
func: async (page, kwargs) => {
|
|
73
|
+
const { tid, replies: includeReplies = false } = kwargs;
|
|
74
|
+
|
|
75
|
+
const url = getHupuThreadUrl(tid).replace(/-1\.html$/, '.html');
|
|
76
|
+
const data = await readHupuNextData<NextData>(page, url, 'Read Hupu thread detail', {
|
|
77
|
+
expectedTid: String(tid),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// 检查错误信息(只有当code不是200时才报错)
|
|
81
|
+
const errorInfo = data.props.pageProps.detail_error_info;
|
|
82
|
+
if (errorInfo && errorInfo.code !== 200) {
|
|
83
|
+
throw new Error(`帖子访问失败: ${errorInfo.message} (code: ${errorInfo.code})`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 获取帖子信息
|
|
87
|
+
const thread = data.props.pageProps.detail?.thread;
|
|
88
|
+
if (!thread) {
|
|
89
|
+
throw new Error('帖子不存在或已被删除');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const authorName = thread.author?.puname || '未知作者';
|
|
93
|
+
const content = stripHtml(thread.content);
|
|
94
|
+
const contentPreview = content.length > 300 ? content.substring(0, 300) + '...' : content;
|
|
95
|
+
|
|
96
|
+
// 构建结果
|
|
97
|
+
const result: any = {
|
|
98
|
+
title: thread.title,
|
|
99
|
+
author: authorName,
|
|
100
|
+
content: contentPreview,
|
|
101
|
+
replies: thread.replies || 0,
|
|
102
|
+
lights: thread.lights || 0,
|
|
103
|
+
url: `https://bbs.hupu.com/${tid}.html`
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// 如果需要包含回复,添加回复信息到内容中
|
|
107
|
+
if (includeReplies) {
|
|
108
|
+
const replyList = data.props.pageProps.detail?.lights || [];
|
|
109
|
+
const topReplies = replyList.slice(0, 3);
|
|
110
|
+
|
|
111
|
+
if (topReplies.length > 0) {
|
|
112
|
+
let replyText = '\n\n【热门回复】\n';
|
|
113
|
+
topReplies.forEach((reply, index) => {
|
|
114
|
+
const userName = reply.author?.puname || '未知用户';
|
|
115
|
+
const replyContent = stripHtml(reply.content).substring(0, 100);
|
|
116
|
+
const replyLights = reply.allLightCount || 0; // 修复:使用正确的字段名
|
|
117
|
+
const replyTime = reply.created_at_format || '未知时间';
|
|
118
|
+
replyText += `${index + 1}. ${userName} (亮${replyLights} ${replyTime}):\n ${replyContent}\n\n`;
|
|
119
|
+
});
|
|
120
|
+
result.content = contentPreview + replyText;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return [result];
|
|
125
|
+
},
|
|
126
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
site: hupu
|
|
2
|
+
name: hot
|
|
3
|
+
description: 虎扑热门帖子
|
|
4
|
+
domain: bbs.hupu.com
|
|
5
|
+
|
|
6
|
+
args:
|
|
7
|
+
limit:
|
|
8
|
+
type: int
|
|
9
|
+
default: 20
|
|
10
|
+
description: Number of hot posts
|
|
11
|
+
|
|
12
|
+
pipeline:
|
|
13
|
+
- navigate: https://bbs.hupu.com/
|
|
14
|
+
|
|
15
|
+
- evaluate: |
|
|
16
|
+
(async () => {
|
|
17
|
+
// 从HTML中提取帖子信息(适配新的HTML结构)
|
|
18
|
+
const html = document.documentElement.outerHTML;
|
|
19
|
+
const posts = [];
|
|
20
|
+
|
|
21
|
+
// 匹配当前虎扑页面结构的正则表达式
|
|
22
|
+
// 结构: <a href="/638249612.html"...><span class="t-title">标题</span></a>
|
|
23
|
+
const regex = /<a[^>]*href="\/(\d{9})\.html"[^>]*><span[^>]*class="t-title"[^>]*>([^<]+)<\/span><\/a>/g;
|
|
24
|
+
let match;
|
|
25
|
+
|
|
26
|
+
while ((match = regex.exec(html)) !== null && posts.length < ${{ args.limit }}) {
|
|
27
|
+
posts.push({
|
|
28
|
+
tid: match[1],
|
|
29
|
+
title: match[2].trim()
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return posts;
|
|
34
|
+
})()
|
|
35
|
+
|
|
36
|
+
- map:
|
|
37
|
+
rank: ${{ index + 1 }}
|
|
38
|
+
title: ${{ item.title }}
|
|
39
|
+
url: https://bbs.hupu.com/${{ item.tid }}.html
|
|
40
|
+
|
|
41
|
+
- limit: ${{ args.limit }}
|
|
42
|
+
|
|
43
|
+
columns: [rank, title, url]
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CliError } from '../../errors.js';
|
|
2
|
+
import { cli, Strategy } from '../../registry.js';
|
|
3
|
+
import { postHupuJson } from './utils.js';
|
|
4
|
+
|
|
5
|
+
cli({
|
|
6
|
+
site: 'hupu',
|
|
7
|
+
name: 'like',
|
|
8
|
+
description: '点赞虎扑回复 (需要登录)',
|
|
9
|
+
domain: 'bbs.hupu.com',
|
|
10
|
+
strategy: Strategy.COOKIE, // 需要Cookie认证
|
|
11
|
+
navigateBefore: false,
|
|
12
|
+
args: [
|
|
13
|
+
{
|
|
14
|
+
name: 'tid',
|
|
15
|
+
required: true,
|
|
16
|
+
positional: true,
|
|
17
|
+
help: '帖子ID(9位数字)'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'pid',
|
|
21
|
+
required: true,
|
|
22
|
+
positional: true,
|
|
23
|
+
help: '回复ID'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'fid',
|
|
27
|
+
required: true,
|
|
28
|
+
help: '板块ID(如278汽车区)'
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
columns: ['status', 'message'],
|
|
32
|
+
func: async (page, kwargs) => {
|
|
33
|
+
const { tid, pid, fid } = kwargs;
|
|
34
|
+
|
|
35
|
+
const url = 'https://bbs.hupu.com/pcmapi/pc/bbs/v1/reply/light';
|
|
36
|
+
|
|
37
|
+
// 构建请求体
|
|
38
|
+
const body = {
|
|
39
|
+
tid,
|
|
40
|
+
pid,
|
|
41
|
+
puid: '',
|
|
42
|
+
fid,
|
|
43
|
+
shumei_id: '',
|
|
44
|
+
deviceid: ''
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const result = await postHupuJson(page, tid, url, body, 'Like Hupu reply');
|
|
49
|
+
|
|
50
|
+
// 处理响应
|
|
51
|
+
if (result.code === 1) {
|
|
52
|
+
return [{
|
|
53
|
+
status: '✅ 点赞成功',
|
|
54
|
+
message: ''
|
|
55
|
+
}];
|
|
56
|
+
} else if (result.code === 0 && result.msg === '你已经点亮过这个回帖了') {
|
|
57
|
+
return [{
|
|
58
|
+
status: '⚠️ 已经点赞过了',
|
|
59
|
+
message: result.msg || ''
|
|
60
|
+
}];
|
|
61
|
+
} else if (result.code === 0) {
|
|
62
|
+
return [{
|
|
63
|
+
status: '⚠️ 操作未执行',
|
|
64
|
+
message: result.msg || result.message || ''
|
|
65
|
+
}];
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error(`接口错误 code=${result.code}: ${result.msg || result.message}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error instanceof CliError) throw error;
|
|
72
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
73
|
+
throw new Error(`点赞失败: ${errorMessage}`);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CliError } from '../../errors.js';
|
|
2
|
+
import { cli, Strategy } from '../../registry.js';
|
|
3
|
+
import { postHupuJson } from './utils.js';
|
|
4
|
+
|
|
5
|
+
cli({
|
|
6
|
+
site: 'hupu',
|
|
7
|
+
name: 'reply',
|
|
8
|
+
description: '回复虎扑帖子 (需要登录)',
|
|
9
|
+
domain: 'bbs.hupu.com',
|
|
10
|
+
strategy: Strategy.COOKIE, // 需要Cookie认证
|
|
11
|
+
navigateBefore: false,
|
|
12
|
+
args: [
|
|
13
|
+
{
|
|
14
|
+
name: 'tid',
|
|
15
|
+
required: true,
|
|
16
|
+
positional: true,
|
|
17
|
+
help: '帖子ID(9位数字)'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'topic_id',
|
|
21
|
+
required: true,
|
|
22
|
+
help: '板块ID,即接口中的 topicId(如 502 篮球资讯)'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'text',
|
|
26
|
+
required: true,
|
|
27
|
+
positional: true,
|
|
28
|
+
help: '回复内容'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'quote_id',
|
|
32
|
+
help: '被引用回复的 pid;填写后会以“回复某条热门回复”的方式发言'
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
columns: ['status', 'message'],
|
|
36
|
+
func: async (page, kwargs) => {
|
|
37
|
+
const { tid, topic_id, text, quote_id } = kwargs;
|
|
38
|
+
|
|
39
|
+
const url = 'https://bbs.hupu.com/pcmapi/pc/bbs/v1/createReply';
|
|
40
|
+
|
|
41
|
+
// 虎扑内容用 <p> 包裹
|
|
42
|
+
const content = `<p>${text}</p>`;
|
|
43
|
+
|
|
44
|
+
// 构建请求体
|
|
45
|
+
const body: Record<string, unknown> = {
|
|
46
|
+
topicId: topic_id,
|
|
47
|
+
content,
|
|
48
|
+
shumeiId: '',
|
|
49
|
+
deviceid: '',
|
|
50
|
+
tid
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// 如果有引用回复ID,添加到请求体
|
|
54
|
+
if (quote_id) {
|
|
55
|
+
body.quoteId = quote_id;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const result = await postHupuJson(page, tid, url, body, 'Reply to Hupu thread', 'reply');
|
|
60
|
+
|
|
61
|
+
if (result.code === 1) {
|
|
62
|
+
return [{
|
|
63
|
+
status: '✅ 回复成功',
|
|
64
|
+
message: result.msg || result.message || ''
|
|
65
|
+
}];
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error(`接口错误 code=${result.code}: ${result.msg || result.message}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error instanceof CliError) throw error;
|
|
72
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
73
|
+
throw new Error(`回复失败: ${errorMessage}`);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { cli, Strategy } from '../../registry.js';
|
|
2
|
+
import { decodeHtmlEntities, getHupuSearchUrl, readHupuSearchData, stripHtml } from './utils.js';
|
|
3
|
+
|
|
4
|
+
// 搜索结果数据结构
|
|
5
|
+
interface SearchResult {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
username?: string;
|
|
10
|
+
addTimeDisplay?: string;
|
|
11
|
+
replies?: string;
|
|
12
|
+
lights?: string;
|
|
13
|
+
recNum?: string;
|
|
14
|
+
forum_name?: string;
|
|
15
|
+
fid?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 虎扑搜索响应数据结构
|
|
19
|
+
interface HupuSearchResponse {
|
|
20
|
+
init?: {
|
|
21
|
+
redirect?: string;
|
|
22
|
+
};
|
|
23
|
+
env?: string;
|
|
24
|
+
query?: {
|
|
25
|
+
q?: string;
|
|
26
|
+
page?: string;
|
|
27
|
+
};
|
|
28
|
+
searchRes?: {
|
|
29
|
+
count: number;
|
|
30
|
+
totalPage: number;
|
|
31
|
+
type?: string;
|
|
32
|
+
data: SearchResult[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
cli({
|
|
37
|
+
site: 'hupu',
|
|
38
|
+
name: 'search',
|
|
39
|
+
description: '搜索虎扑帖子 (使用官方API)',
|
|
40
|
+
domain: 'bbs.hupu.com',
|
|
41
|
+
strategy: Strategy.PUBLIC, // 公开API,不需要Cookie
|
|
42
|
+
browser: true,
|
|
43
|
+
navigateBefore: false,
|
|
44
|
+
args: [
|
|
45
|
+
{
|
|
46
|
+
name: 'query',
|
|
47
|
+
required: true,
|
|
48
|
+
positional: true,
|
|
49
|
+
help: '搜索关键词'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'page',
|
|
53
|
+
type: 'int',
|
|
54
|
+
default: 1,
|
|
55
|
+
help: '结果页码'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'limit',
|
|
59
|
+
type: 'int',
|
|
60
|
+
default: 20,
|
|
61
|
+
help: '返回结果数量'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'forum',
|
|
65
|
+
help: '板块ID过滤 (可选)'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'sort',
|
|
69
|
+
default: 'general',
|
|
70
|
+
help: '排序方式: general/createtime/replytime/light/reply'
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
columns: ['rank', 'title', 'author', 'replies', 'lights', 'forum', 'url'],
|
|
74
|
+
func: async (page, kwargs) => {
|
|
75
|
+
const { query, page: pageNum = 1, limit = 20, forum, sort = 'general' } = kwargs;
|
|
76
|
+
const searchUrl = getHupuSearchUrl(query, pageNum, forum, sort);
|
|
77
|
+
const data = await readHupuSearchData<HupuSearchResponse>(page, searchUrl, 'Search Hupu threads');
|
|
78
|
+
|
|
79
|
+
// 提取搜索结果
|
|
80
|
+
const results = data.searchRes?.data || [];
|
|
81
|
+
|
|
82
|
+
// 处理结果:清理HTML标签,解码HTML实体
|
|
83
|
+
const processedResults = results.slice(0, Number(limit)).map((item, index) => ({
|
|
84
|
+
rank: index + 1,
|
|
85
|
+
title: decodeHtmlEntities(stripHtml(item.title)),
|
|
86
|
+
author: item.username || '未知用户',
|
|
87
|
+
replies: item.replies || '0',
|
|
88
|
+
lights: item.lights || '0',
|
|
89
|
+
forum: item.forum_name || '未知板块',
|
|
90
|
+
url: `https://bbs.hupu.com/${item.id}.html`
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
return processedResults;
|
|
94
|
+
},
|
|
95
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CliError } from '../../errors.js';
|
|
2
|
+
import { cli, Strategy } from '../../registry.js';
|
|
3
|
+
import { postHupuJson } from './utils.js';
|
|
4
|
+
|
|
5
|
+
cli({
|
|
6
|
+
site: 'hupu',
|
|
7
|
+
name: 'unlike',
|
|
8
|
+
description: '取消点赞虎扑回复 (需要登录)',
|
|
9
|
+
domain: 'bbs.hupu.com',
|
|
10
|
+
strategy: Strategy.COOKIE, // 需要Cookie认证
|
|
11
|
+
navigateBefore: false,
|
|
12
|
+
args: [
|
|
13
|
+
{
|
|
14
|
+
name: 'tid',
|
|
15
|
+
required: true,
|
|
16
|
+
positional: true,
|
|
17
|
+
help: '帖子ID(9位数字)'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'pid',
|
|
21
|
+
required: true,
|
|
22
|
+
positional: true,
|
|
23
|
+
help: '回复ID'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'fid',
|
|
27
|
+
required: true,
|
|
28
|
+
help: '板块ID(如278汽车区)'
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
columns: ['status', 'message'],
|
|
32
|
+
func: async (page, kwargs) => {
|
|
33
|
+
const { tid, pid, fid } = kwargs;
|
|
34
|
+
|
|
35
|
+
const url = 'https://bbs.hupu.com/pcmapi/pc/bbs/v1/reply/cancelLight';
|
|
36
|
+
|
|
37
|
+
// 构建请求体(与点赞相同)
|
|
38
|
+
const body = {
|
|
39
|
+
tid,
|
|
40
|
+
pid,
|
|
41
|
+
puid: '',
|
|
42
|
+
fid,
|
|
43
|
+
shumei_id: '',
|
|
44
|
+
deviceid: ''
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const result = await postHupuJson(page, tid, url, body, 'Unlike Hupu reply');
|
|
49
|
+
|
|
50
|
+
// 处理响应
|
|
51
|
+
if (result.code === 1) {
|
|
52
|
+
return [{
|
|
53
|
+
status: '✅ 取消点赞成功',
|
|
54
|
+
message: ''
|
|
55
|
+
}];
|
|
56
|
+
} else if (result.code === 0 && result.msg === '你还没有点亮过这个回帖') {
|
|
57
|
+
return [{
|
|
58
|
+
status: '⚠️ 你还没点赞过',
|
|
59
|
+
message: result.msg || ''
|
|
60
|
+
}];
|
|
61
|
+
} else if (result.code === 0) {
|
|
62
|
+
return [{
|
|
63
|
+
status: '⚠️ 操作未执行',
|
|
64
|
+
message: result.msg || result.message || ''
|
|
65
|
+
}];
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error(`接口错误 code=${result.code}: ${result.msg || result.message}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error instanceof CliError) throw error;
|
|
72
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
73
|
+
throw new Error(`取消点赞失败: ${errorMessage}`);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
});
|