wechat-search-collector

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

微信视频号搜索

WeChat Channels Search

约定

Agreements

统一安装与执行目录:
~/.agents/skills/wechat-search-collector/
。执行前先进入该目录:
bash
cd ~/.agents/skills/wechat-search-collector
  • 使用
    android-adb
    执行设备操作;使用
    ai-vision
    从截图定位元素(不要用
    dump-ui
    )。
  • 优先复用
    references/commands.md
    的函数封装(
    ADB
    /
    VISION
    /
    TASK
    /
    REPORT
    ),避免
    cd
    漂移。
  • 产物目录:
    TASK_ID
    存在则写
    ~/.eval/<TASK_ID>/
    ,否则写
    ~/.eval/debug/
    (文件名带时间戳)。
  • 结果采集与上报:使用
    result-bitable-reporter
    ;进入微信流程前必须
    collect-start
    ,结束时必须
    collect-stop
    +
    report
Unified installation and execution directory:
~/.agents/skills/wechat-search-collector/
. Navigate to this directory before execution:
bash
cd ~/.agents/skills/wechat-search-collector
  • Use
    android-adb
    to perform device operations; use
    ai-vision
    to locate elements from screenshots (do not use
    dump-ui
    ).
  • Prioritize reusing function encapsulations in
    references/commands.md
    (
    ADB
    /
    VISION
    /
    TASK
    /
    REPORT
    ) to avoid
    cd
    drift.
  • Output directory: If
    TASK_ID
    exists, write to
    ~/.eval/<TASK_ID>/
    ; otherwise, write to
    ~/.eval/debug/
    (filename with timestamp).
  • Result collection and reporting: Use
    result-bitable-reporter
    ; must execute
    collect-start
    before entering the WeChat process, and must execute
    collect-stop
    +
    report
    upon completion.

前置处理

Preprocessing

  • 读取设备序列号:使用环境变量
    SerialNumber
    (或
    ADB devices
    自行确认)。
  • 准备输出目录:
    TASK_ID
    必须为数字;创建
    ~/.eval/<TASK_ID>/
  • 启动采集:执行
    REPORT collect-start --task-id <TASK_ID> --db-path ~/.eval/records.sqlite --table capture_results
    (见
    references/commands.md
    )。
  • 可选拉取任务:用
    TASK claim
    从飞书领取任务;按
    Scene
    选择流程(综合页搜索 / 个人页搜索)。
  • Read device serial number: Use the environment variable
    SerialNumber
    (or confirm via
    ADB devices
    ).
  • Prepare output directory:
    TASK_ID
    must be a number; create
    ~/.eval/<TASK_ID>/
    .
  • Start collection: Execute
    REPORT collect-start --task-id <TASK_ID> --db-path ~/.eval/records.sqlite --table capture_results
    (see
    references/commands.md
    ).
  • Optional task retrieval: Use
    TASK claim
    to retrieve tasks from Feishu; select the process based on
    Scene
    (Comprehensive Page Search / Personal Page Search).

共享子流程:滚动结果到触底(每滑动 5 次检测一次)

Shared Subprocess: Scroll Results to Bottom (Check every 5 swipes)

目标:避免视觉误判,优先用 sqlite
capture_results
增量判断是否还有新增。
  1. 进入某个关键词结果页后,记录基线
    LAST_COUNT
    LAST_COUNT="$(REPORT stat --task-id <TASK_ID>)"
  2. 循环执行直到触底:
    • 滑动 5 次:
      ADB -s <SERIAL> swipe 540 1800 540 400 --duration-ms 800
      (循环 5 次;每次滑动后随机等待 500~1000ms)
    • 查询当前总行数:
      CUR_COUNT="$(REPORT stat --task-id <TASK_ID>)"
    • CUR_COUNT == LAST_COUNT
      连续出现
      N
      次(建议
      N=3
      ),判定触底;否则更新
      LAST_COUNT=CUR_COUNT
      并继续。
  3. sqlite 判定不可用时,用
    ai-vision assert
    二值兜底(不确定必须判定为否),见
    references/commands.md
Goal: Avoid visual misjudgment; prioritize using sqlite
capture_results
to incrementally determine if there are new entries.
  1. After entering a keyword result page, record the baseline
    LAST_COUNT
    :
    LAST_COUNT="$(REPORT stat --task-id <TASK_ID>)"
  2. Loop until reaching the bottom:
    • Swipe 5 times:
      ADB -s <SERIAL> swipe 540 1800 540 400 --duration-ms 800
      (loop 5 times; wait randomly for 500~1000ms after each swipe)
    • Query current total count:
      CUR_COUNT="$(REPORT stat --task-id <TASK_ID>)"
    • If
      CUR_COUNT == LAST_COUNT
      occurs
      N
      consecutive times (recommended
      N=3
      ), judge as bottom reached; otherwise, update
      LAST_COUNT=CUR_COUNT
      and continue.
  3. If sqlite judgment is unavailable, use
    ai-vision assert
    as a binary fallback (must judge as no if uncertain), see
    references/commands.md
    .

综合页搜索流程

Comprehensive Page Search Process

适用于“在视频号综合页搜索单个或多个关键词并遍历结果”的需求。
Applicable to the requirement of "searching for single or multiple keywords on the WeChat Channels comprehensive page and traversing results."

1. 任务参数校验

1. Task Parameter Validation

  • 任务信息必须提供搜索关键词(以逗号拆分为
    KEYWORDS
  • Task information must provide search keywords (split into
    KEYWORDS
    by commas)

2. 启动微信

2. Launch WeChat

  • 若当前已在微信内,先使用
    android-adb
    back-home
    命令返回手机桌面。
  • 回到桌面后再启动微信。
  • If currently in WeChat, first use the
    back-home
    command of
    android-adb
    to return to the phone's home screen.
  • Launch WeChat after returning to the home screen.

3. 进入 发现 -> 视频号

3. Enter Discover -> WeChat Channels

  • 通过截图 + ai-vision 定位并点击
    发现
    视频号
    入口。
  • Locate and click the
    Discover
    and
    WeChat Channels
    entries via screenshot + ai-vision.

4. 进入搜索界面

4. Enter Search Interface

  • 通过截图 + ai-vision 点击搜索框/放大镜进入搜索页;若被遮挡则先滑动后再定位。
  • Click the search box/magnifying glass to enter the search page via screenshot + ai-vision; if blocked, swipe first then locate.

5. 依次输入关键词并触发搜索

5. Enter Keywords in Sequence and Trigger Search

  • 对关键词列表
    KEYWORDS
    逐个执行:清空输入框 -> 输入关键词 -> 触发搜索。
  • 若未进入结果页,重试触发直到进入结果页。
  • Execute for each keyword in the
    KEYWORDS
    list: Clear input box -> Enter keyword -> Trigger search.
  • If not entering the result page, retry triggering until entering the result page.

6. 结果滚动到底并切换下一个关键词

6. Scroll Results to Bottom and Switch to Next Keyword

  • 每个关键词的结果页都执行“结果滚动到底”的滑动循环。
  • 对每个关键词执行“共享子流程:滚动结果到触底(每滑动 5 次检测一次)”。
  • 确认触底后:点击搜索框确保输入框激活 -> 清空 -> 输入下一个关键词 -> 触发搜索,直到完成所有关键词的遍历。
  • Execute the "scroll results to bottom" swipe loop for each keyword's result page.
  • Execute the "Shared Subprocess: Scroll Results to Bottom (Check every 5 swipes)" for each keyword.
  • After confirming reaching the bottom: Click the search box to ensure it's activated -> Clear -> Enter next keyword -> Trigger search, until all keywords are traversed.

7. 场景后置处理

7. Scene Post-Processing

  • 当综合页搜索任务成功完成后,调用
    piracy-handler
    ,实现盗版聚类筛查、子任务创建与 webhook 推送计划创建。
  • 若综合页搜索流程失败或中断,不调用该编排器。
  • After the comprehensive page search task is successfully completed, call
    piracy-handler
    to implement piracy clustering screening, subtask creation, and webhook push plan creation.
  • If the comprehensive page search process fails or is interrupted, do not call this orchestrator.

个人页搜索流程

Personal Page Search Process

适用于“先进入某账号个人页,再在个人页内检索多个关键词并遍历结果”的需求。
Applicable to the requirement of "first entering an account's personal page, then searching for multiple keywords within the personal page and traversing results."

1. 任务参数校验

1. Task Parameter Validation

  • 任务信息必须提供:账号名称(
    ACCOUNT_NAME
    )和搜索关键词(以逗号拆分为
    KEYWORDS
  • Task information must provide: Account name (
    ACCOUNT_NAME
    ) and search keywords (split into
    KEYWORDS
    by commas)

2. 启动微信

2. Launch WeChat

  • 若当前已在微信内,先使用
    android-adb
    back-home
    命令返回手机桌面。
  • 回到桌面后再启动微信。
  • If currently in WeChat, first use the
    back-home
    command of
    android-adb
    to return to the phone's home screen.
  • Launch WeChat after returning to the home screen.

3. 进入 发现 -> 视频号

3. Enter Discover -> WeChat Channels

  • 通过截图 + ai-vision 定位并点击
    发现
    视频号
    入口。
  • Locate and click the
    Discover
    and
    WeChat Channels
    entries via screenshot + ai-vision.

4. 进入搜索界面

4. Enter Search Interface

  • 通过截图 + ai-vision 点击搜索框/放大镜进入搜索页;若被遮挡则先滑动后再定位。
  • Click the search box/magnifying glass to enter the search page via screenshot + ai-vision; if blocked, swipe first then locate.

5. 搜索账号并进入个人页

5. Search Account and Enter Personal Page

  • 输入账号名称
    ACCOUNT_NAME
    并触发搜索
  • 进入搜索结果后,若有目标账号则直接点击进入个人页
  • 否则可先点击
    账号
    Tab,然后在账号列表中点击目标账号进入个人页
  • Enter the account name
    ACCOUNT_NAME
    and trigger the search
  • After entering the search results, if the target account exists, click directly to enter its personal page
  • Otherwise, click the
    Accounts
    tab first, then click the target account in the account list to enter its personal page

6. 在个人页依次搜索关键词

6. Search Keywords in Sequence on Personal Page

  • 对关键词列表
    KEYWORDS
    逐个执行:先点击个人页搜索框确保输入框激活 -> 清空 -> 输入关键词 -> 触发搜索 -> 滑动结果到底。
  • 每个关键词的结果页都执行“结果滚动到底”的滑动循环。
  • 对每个关键词执行“共享子流程:滚动结果到触底(每滑动 5 次检测一次)”。
  • 每个关键词搜索前确认仍在该账号个人页;若误退出则重进个人页后继续。
  • Execute for each keyword in the
    KEYWORDS
    list: First click the personal page search box to ensure it's activated -> Clear -> Enter keyword -> Trigger search -> Scroll results to bottom.
  • Execute the "scroll results to bottom" swipe loop for each keyword's result page.
  • Execute the "Shared Subprocess: Scroll Results to Bottom (Check every 5 swipes)" for each keyword.
  • Confirm being on the account's personal page before searching each keyword; if accidentally exited, re-enter the personal page then continue.

7. 场景后置处理

7. Scene Post-Processing

  • 个人页任务结束并进入终态(
    success/error
    )后,若任务存在
    GroupID
    ,调用
    group-webhook-dispatch
    做“是否就绪 + webhook 推送”。
  • After the personal page task ends and enters the final state (
    success/error
    ), if the task has a
    GroupID
    , call
    group-webhook-dispatch
    to perform "readiness check + webhook push".

任务结束后的收尾逻辑

Post-Task Cleanup Logic

  • claim
    未获取任务,直接结束不做收尾。
  • 所有关键词遍历完成后,使用
    android-adb
    back-home
    命令返回手机桌面
  • 无论任务成功、失败或中断,都必须执行以下动作(finally 语义):
    • 调用
      result-bitable-reporter
      collect-stop
      结束当前设备采集,并打印采集统计。
    • 调用
      result-bitable-reporter
      report
      ,并带
      --task-id <TASK_ID>
      ,仅上报当前任务在
      capture_results
      reported in (0,-1)
      的数据到飞书多维表格采集结果表。
  • 调用
    feishu-bitable-task-manager
    更新该
    TaskID
    的字段:
    Status
    ->
    success/failed/error
    (基于任务执行结果)、
    EndAt
    ->
    now
  • If no task is retrieved via
    claim
    , end directly without cleanup.
  • After all keywords are traversed, use the
    back-home
    command of
    android-adb
    to return to the phone's home screen
  • Regardless of whether the task succeeds, fails, or is interrupted, the following actions must be executed (finally semantics):
    • Call
      collect-stop
      of
      result-bitable-reporter
      to end current device collection, and print collection statistics.
    • Call
      report
      of
      result-bitable-reporter
      with
      --task-id <TASK_ID>
      , and only report data where
      reported in (0,-1)
      in
      capture_results
      of the current task to the Feishu Bitable collection results table.
  • Call
    feishu-bitable-task-manager
    to update the fields of this
    TaskID
    :
    Status
    ->
    success/failed/error
    (based on task execution result),
    EndAt
    ->
    now

备注与排障

Notes and Troubleshooting

  • 点击不准:重新截图,让 ai-vision 提供更精确坐标(不要改用
    dump-ui
    )。
  • 异常流程(弹窗遮挡或步骤卡住):先识别弹窗并关闭,再继续原步骤。处理命令见
    references/commands.md
  • 任务超时限制:若单个任务执行时长超过 30 分钟,则终止执行,任务状态更新为 failed。
  • Inaccurate clicks: Take a new screenshot to let ai-vision provide more precise coordinates (do not switch to
    dump-ui
    ).
  • Abnormal processes (pop-up blockage or step stuck): First identify and close the pop-up, then continue with the original step. See
    references/commands.md
    for processing commands.
  • Task timeout limit: If the execution time of a single task exceeds 30 minutes, terminate execution and update the task status to failed.