{"id":51026802,"url":"https://github.com/gitstq/webpilot-automation","last_synced_at":"2026-06-21T20:02:22.072Z","repository":{"id":364071135,"uuid":"1266277278","full_name":"gitstq/webpilot-automation","owner":"gitstq","description":"新一代CDP浏览器自动化引擎 - AI驱动、反检测增强、国内平台适配","archived":false,"fork":false,"pushed_at":"2026-06-11T13:27:27.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-11T15:17:29.114Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitstq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-11T13:23:23.000Z","updated_at":"2026-06-11T13:32:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gitstq/webpilot-automation","commit_stats":null,"previous_names":["gitstq/webpilot-automation"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gitstq/webpilot-automation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fwebpilot-automation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fwebpilot-automation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fwebpilot-automation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fwebpilot-automation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitstq","download_url":"https://codeload.github.com/gitstq/webpilot-automation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fwebpilot-automation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34623906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-21T20:02:21.295Z","updated_at":"2026-06-21T20:02:22.055Z","avatar_url":"https://github.com/gitstq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 WebPilot\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Python-3.10%2B-blue?logo=python\" alt=\"Python 3.10+\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-green.svg\" alt=\"License: MIT\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/CDP-Chrome%20DevTools-orange?logo=google-chrome\" alt=\"CDP\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/AI-GLM--5.1%20%7C%20GPT-purple?logo=openai\" alt=\"AI\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003e新一代CDP浏览器自动化引擎\u003c/b\u003e\u003cbr\u003e\n  AI驱动 · 反检测增强 · 国内平台适配\n\u003c/p\u003e\n\n---\n\n## 🎉 项目介绍\n\nWebPilot 是一个基于 **Chrome DevTools Protocol (CDP)** 的浏览器自动化引擎，无需 WebDriver 即可实现强大的浏览器控制。相比传统 Selenium/Playwright，WebPilot 具有以下独特优势：\n\n- 🧠 **AI智能驱动** — 集成大语言模型，支持自然语言操作规划、智能元素识别、自动数据提取\n- 🛡️ **反检测增强** — 内置指纹随机化、Canvas/WebGL噪声、时区语言模拟等反检测技术\n- 🇨🇳 **国内平台适配** — 提供微信、抖音、小红书、B站等国内主流平台的专用API\n- 📹 **录制回放系统** — 类似Playwright codegen，支持操作录制和代码生成\n- ⚡ **纯异步架构** — 基于asyncio，支持高并发操作\n\n## ✨ 核心特性\n\n| 特性 | 描述 | 状态 |\n|------|------|------|\n| CDP驱动 | 直接通过Chrome DevTools Protocol控制浏览器，无需WebDriver | ✅ |\n| AI Agent | 支持OpenAI/智谱AI，自然语言驱动浏览器操作 | ✅ |\n| 反检测 | 指纹随机化、Canvas噪声、WebGL伪装、时区模拟 | ✅ |\n| 国内适配 | 微信、抖音、小红书、B站专用API | ✅ |\n| 录制回放 | 操作录制、Python代码生成、JSON脚本导出 | ✅ |\n| 结构化提取 | Pydantic模型驱动的数据提取 | ✅ |\n| 截图/PDF | 页面截图、元素截图、完整页面、PDF生成 | ✅ |\n| 智能等待 | 元素等待、可见性检查、超时处理 | ✅ |\n\n## 🚀 快速开始\n\n### 安装\n\n```bash\n# 基础安装\npip install webpilot\n\n# 包含AI功能\npip install webpilot[ai]\n\n# 开发安装\npip install webpilot[all]\n```\n\n### 基础用法\n\n```python\nimport asyncio\nfrom webpilot import Browser\n\nasync def main():\n    # 启动浏览器\n    browser = await Browser.launch(headless=True)\n    page = await browser.new_page()\n    \n    # 导航到网页\n    await page.goto(\"https://example.com\")\n    \n    # 获取标题\n    title = await page.title()\n    print(f\"标题: {title}\")\n    \n    # 截图\n    await page.screenshot(\"example.png\")\n    \n    # 关闭浏览器\n    await browser.close()\n\nasyncio.run(main())\n```\n\n### 反检测模式\n\n```python\n# 启用反检测，绕过大多数反爬虫检测\nbrowser = await Browser.launch(\n    headless=True,\n    anti_detect=True,\n)\n```\n\n### AI智能操作\n\n```python\nfrom webpilot import AIAgent\n\nagent = AIAgent(api_key=\"your-api-key\", model=\"glm-5.1\")\n\n# AI规划操作步骤\nactions = await agent.plan_actions(\n    goal=\"在百度上搜索'Python教程'，点击第一个结果\"\n)\n```\n\n### 国内平台适配\n\n```python\nfrom webpilot.adapters import DouyinAdapter\n\n# 抖音搜索\ndouyin = DouyinAdapter(page)\nvideos = await douyin.search(\"Python教程\")\n```\n\n## 📖 详细使用指南\n\n### 浏览器管理\n\n```python\nfrom webpilot import Browser\n\n# 启动配置\nbrowser = await Browser.launch(\n    executable_path=\"/usr/bin/google-chrome\",  # 自定义Chrome路径\n    headless=True,                              # 无头模式\n    proxy=\"http://proxy:8080\",                 # 代理设置\n    window_size=(1920, 1080),                  # 窗口大小\n    anti_detect=True,                          # 启用反检测\n)\n\n# 多页面管理\npage1 = await browser.new_page()\npage2 = await browser.new_page()\npages = await browser.pages()\n\n# 关闭\nawait browser.close()\n```\n\n### 页面操作\n\n```python\n# 导航\nawait page.goto(\"https://example.com\", wait_until=\"networkidle\")\n\n# 元素查找\nelement = await page.query_selector(\"#button\")\nelements = await page.query_selector_all(\".item\")\n\n# 等待元素\nawait page.wait_for_selector(\"#loading\", timeout=30)\n\n# 点击和输入\nawait page.click(\"#submit\")\nawait page.type(\"#input\", \"hello world\", delay=0.1)\n\n# JavaScript执行\nresult = await page.evaluate(\"document.title\")\n\n# 截图和PDF\nawait page.screenshot(\"page.png\", full_page=True)\nawait page.pdf(\"page.pdf\")\n```\n\n### 元素操作\n\n```python\nelement = await page.query_selector(\"#button\")\n\n# 点击\nawait element.click()\n\n# 输入文本\nawait element.type(\"hello\", delay=0.05)\n\n# 获取属性\ntext = await element.text_content()\nhtml = await element.inner_html()\nhref = await element.get_attribute(\"href\")\n\n# 滚动到视图\nawait element.scroll_into_view()\n\n# 悬停\nawait element.hover()\n```\n\n### 反检测配置\n\n```python\nfrom webpilot.anti_detect import AntiDetectConfig\n\n# 使用随机配置\nconfig = AntiDetectConfig.random()\n\n# 自定义配置\nconfig = AntiDetectConfig(\n    user_agent=\"Mozilla/5.0 ...\",\n    screen_width=1920,\n    screen_height=1080,\n    timezone=\"Asia/Shanghai\",\n    webgl_vendor=\"Intel Inc.\",\n    canvas_noise=True,\n)\n```\n\n### 录制回放\n\n```python\nfrom webpilot.recorder import Recorder\n\nrecorder = Recorder()\nrecorder.start()\n\n# 记录操作\nrecorder.record_goto(\"https://example.com\")\nrecorder.record_click(\"#button\")\nrecorder.record_type(\"#input\", \"hello\")\n\n# 生成代码\ncode = recorder.to_python_code()\nrecorder.save(\"recording.json\")\n\n# 回放\nfrom webpilot.recorder import Player\nplayer = Player(page)\nawait player.play(actions)\n```\n\n## 💡 设计思路与迭代规划\n\n### 架构设计\n\n```\nWebPilot\n├── CDP Client (WebSocket通信)\n├── Browser Manager (进程管理)\n├── Page Controller (页面操作)\n├── Element Handler (元素交互)\n├── Anti-Detect Engine (反检测)\n├── AI Agent (智能驱动)\n├── Recorder/Player (录制回放)\n└── Platform Adapters (平台适配)\n```\n\n### 迭代规划\n\n- [x] v1.0.0 - 核心CDP驱动、基础操作、反检测\n- [ ] v1.1.0 - 移动端H5支持、触屏事件模拟\n- [ ] v1.2.0 - 可视化调试面板、实时CDP监控\n- [ ] v1.3.0 - 更多国内平台适配（淘宝、京东、知乎）\n- [ ] v2.0.0 - 多Agent协作、分布式浏览器集群\n\n## 📦 打包与部署\n\n### 本地开发\n\n```bash\n# 克隆仓库\ngit clone https://github.com/gitstq/webpilot-automation.git\ncd webpilot-automation\n\n# 安装依赖\npip install -e \".[dev]\"\n\n# 运行测试\npytest\n\n# 代码检查\nblack src tests\nruff check src tests\nmypy src\n```\n\n### 构建发布\n\n```bash\n# 构建包\npython -m build\n\n# 上传到PyPI\npython -m twine upload dist/*\n```\n\n## 🤝 贡献指南\n\n我们欢迎所有形式的贡献！请查看 [CONTRIBUTING.md](CONTRIBUTING.md) 了解详情。\n\n## 📄 开源协议\n\n本项目采用 [MIT License](LICENSE) 开源协议。\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ by WebPilot Team\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Fwebpilot-automation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitstq%2Fwebpilot-automation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Fwebpilot-automation/lists"}