@duanz/pi-d-reach 0.0.0-stage → 1.0.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.
@@ -0,0 +1,76 @@
1
+ # 社交媒体 & 社区
2
+
3
+ 微博、V2EX、Reddit。其余平台各有归属:
4
+
5
+ | 平台 | 去哪 |
6
+ |------|------|
7
+ | 国内版 XHS | fanout 默认社交搜索:可选 `xhs` CLI;缺少 CLI 时标记未配置并跳过。笔记和评论读取见 `../extensions/d-reach-xhs/SKILL.md` |
8
+ | Twitter/X | `../extensions/d-reach-twitter/SKILL.md`(**本机 `twitter` 是 npm 同名假货,静默 exit 0** → 先用 `browser_use`) |
9
+ | B站 | `SKILL.md` 的「B站 / 国内版 XHS」+ `video.md` |
10
+ | 微信公众号 | 本文件下方「微信公众号」小节 |
11
+ | 豆瓣 | 本文件下方「豆瓣」小节 |
12
+ | 抖音 | 无可用通道(原 mcporter douyin 未配置)→ `browser_use` |
13
+
14
+ ## 微信公众号(✅ 免登录入口)
15
+
16
+ ```bash
17
+ UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/131.0 Safari/537.36"
18
+
19
+ # 搜狗微信 —— 免登录搜公众号文章(本环境 200 可达)
20
+ curl -s -A "$UA" "https://weixin.sogou.com/weixin?type=2&query=关键词"
21
+ # type=1 搜公众号,type=2 搜文章
22
+ # ⚠️ 列表页是 JS 拼装,HTML 里拿不到完整标题/链接 → 用 browser_use 打开该 URL 再 get_readable
23
+ ```
24
+
25
+ - 拿到真实 `mp.weixin.qq.com/s/xxx` 链接后,**正文用 BrightData 抓**(Jina 读不了公众号,会被 CAPTCHA 拦,见 `scrape.md`)。
26
+ - 另一条路:Exa 限定 `includeDomains: ["mp.weixin.qq.com"]` 搜(见 `scrape.md`),但覆盖不如搜狗微信全。
27
+
28
+ ## 豆瓣(✅ 免 Key,书影音评分)
29
+
30
+ ```bash
31
+ UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/131.0 Safari/537.36"
32
+ curl -s -A "$UA" "https://search.douban.com/book/subject_search?search_text=关键词"
33
+ # 结果在页面里的 window.__DATA__ = {"items":[...]} → 正则截出 JSON 再解析
34
+ # movie 换 /movie/subject_search,music 换 /music/subject_search
35
+ ```
36
+
37
+ 用途:书/影/音评分与短评(选书选片)。**注意豆瓣评分是社区主观值,不是事实源。**
38
+
39
+ ## 知乎 / 贴吧
40
+
41
+ 知乎站内搜索走 **`zhihu` 通道**(开放平台官方 API,`scripts/fanout.sh "<query>" --on zhihu`),
42
+ 返回标题/摘要/赞同数/评论数/发布时间,无需绕反爬。
43
+ `www.zhihu.com` 裸抓与 `/api/v4/search_v3` 仍 **403**,只有直连页面时才需要 `browser_use`。
44
+ `tieba.baidu.com` 仍 403 → 千帆快照或 browser_use。
45
+
46
+ ## 微博
47
+
48
+ ```bash
49
+ curl -s "https://r.jina.ai/https://weibo.com/USER_ID/POST_ID"
50
+ ```
51
+
52
+ ## V2EX(公开 API,无需认证)
53
+
54
+ ```bash
55
+ UA="Mozilla/5.0 (X11; Linux x86_64)"
56
+ curl -s -A "$UA" "https://www.v2ex.com/api/topics/hot.json" # 热门
57
+ curl -s -A "$UA" "https://www.v2ex.com/api/topics/show.json?node_name=python&page=1" # 节点
58
+ curl -s -A "$UA" "https://www.v2ex.com/api/topics/show.json?id=TOPIC_ID" # 主题
59
+ curl -s -A "$UA" "https://www.v2ex.com/api/replies/show.json?topic_id=TOPIC_ID" # 回复
60
+ curl -s -A "$UA" "https://www.v2ex.com/api/members/show.json?username=USERNAME" # 用户
61
+ ```
62
+
63
+ 节点列表:https://www.v2ex.com/planes
64
+
65
+ ## Reddit(公开 JSON,无需登录)
66
+
67
+ ```bash
68
+ UA="Mozilla/5.0 (X11; Linux x86_64)"
69
+ curl -s -A "$UA" "https://www.reddit.com/search.json?q=QUERY&limit=10" # 搜索
70
+ curl -s -A "$UA" "https://www.reddit.com/r/SUB/hot.json?limit=20" # 版块热门
71
+ curl -s -A "$UA" "https://www.reddit.com/r/SUB/comments/ID.json" # 帖子+评论
72
+ ```
73
+
74
+ > 本机没有 `rdt` CLI。**2026-09-05 实测:数据中心 IP 被拉黑,返回 200 + 一个 "Blocked" HTML 页**
75
+ > (不是 403,别当成"搜索无结果")→ 换 `browser_use` 或 BrightData 抓。
76
+ > 能通时用 jq 取字段:`| jq '.data.children[].data | {title,url,num_comments,selftext:(.selftext[:200])}'`
@@ -0,0 +1,82 @@
1
+ # 视频 / 播客
2
+
3
+ YouTube 用 yt-dlp,B站用 bili-cli(**B站不要用 yt-dlp,风控全面 412 拦,直连/代理/带 cookie 都试过**)。
4
+ B站取证铁律(字幕 + 评论区必须都看)见顶层 `SKILL.md`。
5
+
6
+ ## YouTube (yt-dlp)
7
+
8
+ > **本机现状(2026-09-05 实测,未跑通)**:直连 `www.youtube.com` 连接超时(沙箱出口在国内 IP,被墙);
9
+ > 走 ug 隧道(`ssh -N -D 127.0.0.1:1080 ug` + `--proxy socks5h://127.0.0.1:1080`,需 `pip install pysocks`)
10
+ > 能打到 player API,但 yt-dlp 卡在 `The page needs to be reloaded`(YouTube SSAB 实验,要浏览器 cookie),
11
+ > `web_embedded` 客户端则回 `This video is unavailable`。
12
+ > **要 YouTube 内容:优先 `browser_use` 打开页面取字幕轨,或让用户提供 cookies.txt。**
13
+ > 下面的命令在能直连 YouTube 的机器上是对的。
14
+
15
+ ```bash
16
+ yt-dlp --dump-json "URL" # 元数据
17
+ yt-dlp --dump-json "ytsearch5:query" # 搜索
18
+
19
+ # 字幕(不下视频)→ 读 /tmp/<id>.vtt
20
+ yt-dlp --write-sub --write-auto-sub --sub-lang "zh-Hans,zh,en" \
21
+ --skip-download -o "/tmp/%(id)s" "URL"
22
+
23
+ # 评论(在 .info.json 的 comments 字段)
24
+ yt-dlp --write-comments --skip-download --write-info-json \
25
+ --extractor-args "youtube:max_comments=20" -o "/tmp/%(id)s" "URL"
26
+ ```
27
+
28
+ - 手动上传字幕可靠;自动字幕常行间重复,需后处理。
29
+ - `--write-comments` 是网页抓取(非 Data API),部分评论会丢。
30
+
31
+ ## B站 (bili-cli)
32
+
33
+ ```bash
34
+ bili search "query" --type video -n 5
35
+ bili video BVxxx # 详情/时长/互动数据/字幕可用性
36
+ bili hot -n 10 ; bili rank -n 10
37
+ bili video BVxxx -s --yaml # 字幕
38
+ bili video BVxxx --ai # AI 总结
39
+ bili video BVxxx -c --yaml # 评论(字段 message)
40
+ bili audio BVxxx # 导出 ASR-ready 分段 WAV
41
+ ```
42
+
43
+ 本机已 `bili login`,只读操作无需再登录。安装:`pipx install bilibili-cli`。
44
+ 弹幕:bili-cli 没有弹幕命令,proto 接口易 412 —— 信息量低于评论区,可跳过。
45
+
46
+ ### 无字幕视频转写
47
+
48
+ `bili audio BVxxx` 出分段 WAV → 再转写(本机**未装** whisper,需要时先
49
+ `pipx install faster-whisper` 或改用 `browser_use` 拿平台自带 AI 摘要)。
50
+ (原小宇宙 `transcribe.sh` 依赖 `~/.agent-reach/tools/`,本机不存在,已删。)
51
+
52
+ ### 备查:Get笔记 API 转写(未接入,先用前评估)
53
+
54
+ 不需自建 ASR,把链接丢给它,它建任务、转写、返全文。一个接口覆盖小宇宙 / 喜马拉雅 / B站,
55
+ 把「whisper 没装 + yt-dlp 未跑通」这一大块缺口一次补上。**目前只记在这里,代码未接。**
56
+
57
+ 流程(来自 `qiaomu-anything-to-notebooklm/scripts/get_podcast_transcript.py`):
58
+
59
+ 1. 建链接笔记:`POST https://openapi.biji.com/open/api/v1/resource/note/save`
60
+ 体 `{"note_type":"link","link_url":"<URL>"}` → 回 `task_id`
61
+ 头需要 `Authorization: <GETNOTE_API_KEY>` + `X-Client-ID: <GETNOTE_CLIENT_ID>`
62
+ 2. 轮询:`POST .../note/task/progress` 体 `{"task_id":...}` → `status` 为 `success` / `failed` / 进行中
63
+ 原脚本是 **30 秒一轮、最多 40 轮**(最长 20 分钟)
64
+ 3. 取全文:`GET https://get-notes.luojilab.com/voicenotes/web/notes/<note_id>/links/detail`
65
+ 这一步用的是 **从浏览器抓的 JWT**(`Authorization: Bearer`),不是上面的 API key
66
+
67
+ 代价与坑:
68
+
69
+ - 要两个凭据 + 一次浏览器 JWT;refresh_token **90 天过期**,过期后得重新从浏览器抓
70
+ - 转写是异步的,不适合「马上要」的场景;先告诉用户要等
71
+ - 有平台配额 / 计费,用前先确认
72
+ - 只要字幕不要全文时,先试平台自带的(`bili video BVxxx -s --yaml`、`bili video BVxxx --ai`),
73
+ 比走转写快且免费
74
+
75
+ ### 零配置兜底:B站搜索 API 直连
76
+
77
+ ```bash
78
+ UA="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"
79
+ curl -s -c /tmp/bili_ck.txt -o /dev/null -A "$UA" "https://www.bilibili.com/"
80
+ curl -s -b /tmp/bili_ck.txt -A "$UA" -e "https://www.bilibili.com/" \
81
+ "https://api.bilibili.com/x/web-interface/search/all/v2?keyword=QUERY&page=1"
82
+ ```