返回顶部
b

browser-scraper真实浏览器抓取

Scrape websites using a real Chrome browser with the user's Chrome profile — shares cookies, auth, and fingerprint to bypass bot detection (Cloudflare, Reddit, etc.). Use when scraping sites that block headless browsers or require login, or when asked to "open a browser and scrape", "take a screenshot of a page", "get data from a site that blocks bots", or "scrape with a specific Chrome profile".

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
130
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

browser-scraper

浏览器抓取工具

使用Playwright配合真实的Chrome/Chromium二进制文件和现有用户配置文件来抓取网页。通过共享现有cookies、指纹和会话来绕过机器人检测。

配置文件

该抓取工具支持多个Chrome配置文件:

  • - 默认(不带--profile参数): 使用系统的默认Chrome配置文件
- macOS:~/Library/Application Support/Google/Chrome/Default - Linux:~/.config/google-chrome/Default - Windows:%LOCALAPPDATA%\Google\Chrome\User Data\Default
  • - 命名配置文件(--profile <名称>): 使用技能目录下的profiles/<名称>/文件夹
- 通过使用--profile-directory=Profile 1或类似参数启动Chrome来创建配置文件,然后将抓取工具指向该文件夹 - 用途:隔离登录信息、避免与主Chrome会话冲突、无需认证即可抓取

脚本

bash

默认配置文件(系统Chrome)


node scripts/scrape.mjs <网址> [css选择器]

命名配置文件(profiles/<名称>/)

node scripts/scrape.mjs <网址> [css选择器] --profile <名称>

无头模式(更快,但被拦截风险更高)

node scripts/scrape.mjs <网址> --headless --profile <名称>

抓取后保持浏览器打开(用于交互式使用)

node scripts/scrape.mjs <网址> --profile <名称> --keep-open

额外等待懒加载内容(默认:3000ms)

node scripts/scrape.mjs <网址> --profile <名称> --wait 6000

从技能目录运行:
bash
cd ~/.openclaw-yekeen/workspace/skills/browser-scraper/
node scripts/scrape.mjs https://www.reddit.com/

输出

  • - JSON输出到stdout:匹配的元素或页面预览
  • 截图保存到/tmp/browser-scraper-last.png

关键设计

  • - channel: chrome — 可用时启动真实Chrome,否则回退到系统Chromium
  • 使用配置文件目录的launchPersistentContext
  • --disable-blink-features=AutomationControlled + navigator.webdriver补丁
  • 默认headless: false以避免SingletonLock冲突

要求

  • - 已安装Playwright:npm install playwright
  • 系统上已安装Chrome或Chromium
  • 在macOS/Linux上:channel: chrome选项需要安装Chrome(而非Chromium)

提示

  • - Chrome不能已经以目标配置文件打开(会出现SingletonLock错误)。先关闭Chrome,或使用命名配置文件避免冲突。
  • 如果使用命名配置文件时出现SingletonLock错误,请删除该配置文件目录中的SingletonLock文件,然后重试。
  • 使用--keep-open在抓取后保持浏览器打开以便交互使用 — 按Ctrl+C关闭。
  • 对于有懒加载内容的网站:使用--wait <毫秒>参数或修改脚本增加waitForTimeout
  • 对于Reddit:使用选择器shreddit-post并读取属性(post-title、author、score、permalink)
  • 要创建全新的隔离配置文件:在终端中使用--profile-directory=Profile X运行Chrome并登录,然后将抓取工具指向该目录

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 browser-scraper-1775936265 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 browser-scraper-1775936265 技能

通过命令行安装

skillhub install browser-scraper-1775936265

下载

⬇ 下载 browser-scraper v1.0.0(免费)

文件大小: 6.37 KB | 发布时间: 2026-4-12 09:14

v1.0.0 最新 2026-4-12 09:14
Initial release of browser-scraper.

- Enables scraping of websites using a real Chrome browser and user Chrome profile to bypass bot detection and access authenticated content.
- Supports both default system Chrome profiles and custom named profiles for isolated sessions.
- Offers optional features: headless mode, adjustable wait times for dynamic content, and interactive mode keeping the browser open.
- Outputs extracted data as JSON and saves page screenshots.
- Requires Playwright and a local Chrome/Chromium installation.
- Includes troubleshooting and usage tips for avoiding profile/lock conflicts and improving scrape results.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部