首页 全部提示词 Automations

GitHub Stars 抓取器与 Agent Browser

GitHub Stars Fetcher with Agent Browser

文本 @xiaostore 2,512 字符 在 prompts.chat 查看 译文有问题?

中文译文

使用 Agent Browser 获取 GitHub 星标项目

目标

使用 Agent Browser 技能登录 GitHub,并获取当前登录用户的星标项目,按星标数量排序。

执行步骤(按顺序执行)

  1. 启动浏览器并打开 GitHub 首页

    agent-browser --headed --profile "%HOMEPATH%\.agent-browser\chrome-win64\chrome-profiles\github" open https://github.com && agent-browser wait --load networkidle
    
  2. 获取当前登录用户信息

    agent-browser snapshot -i
    # Find the user avatar or username link in the top-right corner to confirm login status
    # Extract the username of the currently logged-in user from the page
    
  3. 导航到当前用户的 Stars 标签页

    # Construct URL: https://github.com/{username}?tab=stars
    agent-browser open https://github.com/{username}?tab=stars && agent-browser wait --load networkidle
    
  4. 按星标数排序(星标最多的排在最前)

    agent-browser snapshot -i  # First get the latest snapshot to find the sort button
    agent-browser click @e_sort_button  # Click the sort button
    agent-browser wait --load networkidle
    # Select "Most stars" from the dropdown options
    
  5. 检索并记录项目信息

    agent-browser snapshot -i
    # Extract project name, description, stars, and forks information
    

关键注意事项

1. 守护进程问题

  • 如果看到 "daemon already running",说明浏览器已在运行
  • 重要: 当守护进程已在运行时,--headed 和 --profile 参数会被忽略,浏览器会继续以当前运行模式运行
  • 你可以直接继续执行后续命令,无需重新打开
  • 若要以有头模式重启,必须先执行:agent-browser close,然后使用 --headed 参数重新打开

2. 引用的动态性

  • 元素引用(@e1、@e2 等)在每次页面修改后都会变化
  • 每次交互前都必须执行 snapshot -i 以获取最新引用
  • 绝不假设引用是固定不变的

3. 命令执行模式

  • 使用 && 串联多条命令,避免重复启动进程
  • 每条命令后等待页面加载:wait --load networkidle

4. 登录状态

  • 使用 --profile 参数指定配置文件目录,以保持登录状态
  • 如果登录过期,手动登录一次以保存状态

5. Windows 环境变量展开

  • 重要: 在 Windows 上,%HOMEPATH% 等环境变量必须先展开为实际路径再使用
  • 错误: agent-browser --profile "%HOMEPATH%\.agent-browser\chrome-win64\chrome-profiles\github"
  • 正确: 先执行 echo $HOME 获取实际路径,然后使用展开后的路径
    # Get HOME path (e.g., /c/Users/xxx)
    echo $HOME
    # Use the expanded absolute path
    agent-browser --profile "/c/Users/xxx/.agent-browser/chrome-win64/chrome-profiles/github" --headed open https://github.com
    
  • 如果不展开环境变量,就会遇到连接错误(例如 os error 10060)

6. 排序配置

  • 点击 "Sort by: Recently starred" 按钮(通常引用为 e44)
  • 选择 "Most stars" 选项
  • 再次获取页面内容

常见问题排查

问题 解决方案
守护进程已在运行 直接执行后续命令,或关闭后重新打开
无效的元素引用 执行 snapshot -i 获取最新引用
页面未完全加载 添加 wait --load networkidle
需要重新登录 使用 --headed 模式手动登录一次并保存状态
排序未生效 确认你点击了正确的排序选项

结果输出格式

  • 项目名称和链接
  • Stars 数量(按降序排列)
  • Forks 数量
  • 项目描述(如有)

English original

Using Agent Browser to Fetch GitHub Starred Projects

Objective

Use the Agent Browser skill to log into GitHub and retrieve the starred projects of the currently logged-in user, sorted by the number of stars.

Execution Steps (Follow in Order)

  1. Launch Browser and Open GitHub Homepage

    agent-browser --headed --profile "%HOMEPATH%\.agent-browser\chrome-win64\chrome-profiles\github" open https://github.com && agent-browser wait --load networkidle
    
  2. Get Current Logged-in User Information

    agent-browser snapshot -i
    # Find the user avatar or username link in the top-right corner to confirm login status
    # Extract the username of the currently logged-in user from the page
    
  3. Navigate to Current User's Stars Tab

    # Construct URL: https://github.com/{username}?tab=stars
    agent-browser open https://github.com/{username}?tab=stars && agent-browser wait --load networkidle
    
  4. Sort by Stars Count (Most Stars First)

    agent-browser snapshot -i  # First get the latest snapshot to find the sort button
    agent-browser click @e_sort_button  # Click the sort button
    agent-browser wait --load networkidle
    # Select "Most stars" from the dropdown options
    
  5. Retrieve and Record Project Information

    agent-browser snapshot -i
    # Extract project name, description, stars, and forks information
    

Critical Notes

1. Daemon Process Issues

  • If you see "daemon already running", the browser is already running
  • Important: When the daemon is already running, --headed and --profile parameters are ignored, and the browser continues in its current running mode
  • You can proceed with subsequent commands without reopening
  • To restart in headed mode, you must first execute: agent-browser close, then use the --headed parameter to reopen

2. Dynamic Nature of References

  • Element references (@e1, @e2, etc.) change after each page modification
  • You must execute snapshot -i before each interaction to get the latest references
  • Never assume references are fixed

3. Command Execution Pattern

  • Use && to chain multiple commands, avoiding repeated process launches
  • Wait for page load after each command: wait --load networkidle

4. Login Status

  • Use the --profile parameter to specify a profile directory, maintaining login state
  • If login expires, manually log in once to save the state

5. Windows Environment Variable Expansion

  • Important: On Windows, environment variables like %HOMEPATH% must be expanded to actual paths before use
  • Incorrect: agent-browser --profile "%HOMEPATH%\.agent-browser\chrome-win64\chrome-profiles\github"
  • Correct: First execute echo $HOME to get the actual path, then use the expanded path
    # Get HOME path (e.g., /c/Users/xxx)
    echo $HOME
    # Use the expanded absolute path
    agent-browser --profile "/c/Users/xxx/.agent-browser/chrome-win64/chrome-profiles/github" --headed open https://github.com
    
  • Without expanding environment variables, you'll encounter connection errors (e.g., os error 10060)

6. Sorting Configuration

  • Click the "Sort by: Recently starred" button (typically reference e44)
  • Select the "Most stars" option
  • Retrieve page content again

Troubleshooting Common Issues

Issue Solution
daemon already running Execute subsequent commands directly, or close then reopen
Invalid element reference Execute snapshot -i to get latest references
Page not fully loaded Add wait --load networkidle
Need to re-login Use --headed mode to manually login once and save state
Sorting not applied Confirm you clicked the correct sorting option

Result Output Format

  • Project name and link
  • Stars count (sorted in descending order)
  • Forks count
  • Project description (if available)