Skip to content

模型爬虫指导#1

Open
PI-33 wants to merge 3 commits intomainfrom
cursor/-bc-bd72964f-9583-4d93-b1a0-f4cd4c2143c0-08b7
Open

模型爬虫指导#1
PI-33 wants to merge 3 commits intomainfrom
cursor/-bc-bd72964f-9583-4d93-b1a0-f4cd4c2143c0-08b7

Conversation

@PI-33
Copy link
Copy Markdown
Owner

@PI-33 PI-33 commented Feb 25, 2026

Add a comprehensive web crawler skill document to guide the model in interactive web scraping code generation.


Open in Web Open in Cursor 

基于项目教学文档和源代码示例,创建了一个全面的爬虫开发 Skill,
用于指导大模型在多种场景下编写爬虫代码。

主要内容:
- 交互式工作流程:需求分析 → 技术评估 → 信息收集 → 代码生成
- 四种核心代码模板:API爬取、HTML页面爬取、浏览器自动化、高并发批量爬取
- 工程化项目结构:配置管理、模型定义、存储抽象、异常处理
- 12项关键技术详解:
  - cURL转Python代码
  - 请求头伪装与UA轮换
  - 速率控制(令牌桶算法)
  - 代理IP使用
  - Cookie管理与持久化
  - 数据存储(工厂模式:CSV/JSON/DB)
  - Pydantic数据模型
  - 数据清洗与标准化
  - 重试与异常处理(tenacity)
  - 登录认证(Cookie注入/扫码登录)
  - 验证码处理(OCR/滑块轨迹模拟)
  - Playwright反检测(stealth.js注入)
- 场景判断决策树
- 引导话术模板

Co-authored-by: L TANG <[email protected]>
@cursor
Copy link
Copy Markdown

cursor bot commented Feb 25, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 2 commits February 28, 2026 15:41
参考 anthropics/skills 规范,将单文件 web-crawler-skill.md 重构为
完整的 Skill 文件夹结构:

.cursor/skills/web-crawler/
├── SKILL.md                  # 技能定义(YAML frontmatter + 工作流程 + 决策树)
├── scripts/
│   ├── curl_to_config.py     # cURL 命令解析为 Python 配置
│   ├── generate_crawler.py   # 根据配置生成爬虫代码
│   └── run_crawler.py        # 通用爬虫执行器(API/HTML 双模式)
├── templates/
│   ├── api_crawler.py        # API 数据爬取模板
│   ├── html_crawler.py       # HTML 页面解析模板
│   └── browser_crawler.py    # Playwright 浏览器自动化模板
└── references/
    ├── headers_reference.md  # 请求头伪装完整指南
    └── anti_detection_reference.md  # 反爬对抗技术参考

主要特性:
- 所有脚本经过实际测试,可直接调用
- run_crawler.py 支持 API 和 HTML 双模式,一条命令即可爬取并输出 CSV
- curl_to_config.py 自动解析 cURL 命令为结构化配置和 Python 代码
- 三套完整模板覆盖 API/HTML/Browser 三种爬取场景
- SKILL.md 包含交互式工作流程和场景判断决策树

Co-authored-by: L TANG <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants