web-scraping-automation▌
aaaaqwq/claude-code-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
此技能专门用于自动化网站数据爬取和 API 接口调用,包括:
网站爬取与 API 自动化
功能说明
此技能专门用于自动化网站数据爬取和 API 接口调用,包括:
- 分析和爬取网站结构
- 调用和测试 REST/GraphQL API
- 创建自动化爬虫脚本
- 数据解析和清洗
- 处理反爬虫机制
- 定时任务和数据存储
使用场景
- "爬取这个网站的产品信息"
- "帮我调用这个 API 并解析返回数据"
- "创建一个脚本定时抓取新闻"
- "分析这个网站的 API 接口文档"
- "绕过这个网站的反爬虫限制"
技术栈
⚠️ 资源清理原则(强制)
所有涉及浏览器的爬取任务完成后,必须自动关闭 Chrome/Selenium 进程!
# Playwright 示例
from playwright.sync_api import sync_playwright
def scrape_website():
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
# ... 爬取逻辑 ...
browser.close()
# ⚠️ 强制清理残留进程
import subprocess
subprocess.run(['pkill', '-f', 'chrome'], capture_output=True)
# Selenium 示例
from selenium import webdriver
driver = webdriver.Chrome()
try:
# ... 爬取逻辑 ...
pass
finally:
driver.quit()
# ⚠️ 确保清理
import subprocess
subprocess.run(['pkill', '-f', 'chrome'], capture_output=True)
原因: 避免内存泄漏和资源占用,防止 Gateway CPU 100% 过载
Python 爬虫
- requests:HTTP 请求库
- BeautifulSoup4:HTML 解析
- Scrapy:专业爬虫框架
- Selenium:浏览器自动化
- Playwright:现代浏览器自动化
JavaScript 爬虫
- axios:HTTP 客户端
- cheerio:服务端 jQuery
- puppeteer:Chrome 自动化
- node-fetch:Fetch API
工作流程
-
目标分析:
- 检查网站结构和数据位置
- 分析 API 接口和认证方式
- 评估反爬虫机制
-
方案设计:
- 选择合适的技术栈
- 设计数据提取策略
- 规划错误处理和重试机制
-
脚本开发:
- 编写爬虫代码
- 实现数据解析逻辑
- 添加日志和监控
-
测试优化:
- 验证数据准确性
- 优化性能和稳定性
- 处理边界情况
最佳实践
- 遵守 robots.txt 规则
- 设置合理的请求间隔
- 使用 User-Agent 和请求头
- 实现错误重试机制
- 数据去重和验证
- 使用代理池(如需要)
- 保存原始数据和日志
常见场景示例
1. 简单网页爬取
import requests
from bs4 import BeautifulSoup
def scrape_website(url):
headers = {'User-Agent': 'Mozilla/5.0'}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')
# 提取数据
data = []
for item in soup.select('.product'):
data.append({
'title': item.select_one('.title').text,
'price': item.select_one('.price').text
})
return data
2. API 调用
import requests
def call_api(endpoint, params=None):
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
response = requests.get(endpoint, headers=headers, params=params)
return response.json()
3. 动态网页爬取
from selenium import webdriver
from selenium.webdriver.common.by import By
def scrape_dynamic_page(url):
driver = webdriver.Chrome()
driver.get(url)
# 等待页面加载
driver.implicitly_wait(10)
# 提取数据
elements = driver.find_elements(By.CLASS_NAME, 'item')
data = [elem.text for elem in elements]
driver.quit()
return data
反爬虫应对策略
- 请求头伪装:模拟真实浏览器
- 代理轮换:使用代理池
- 验证码处理:OCR 或第三方服务
- Cookie 管理:维护会话状态
- 请求频率控制:避免触发限制
- JavaScript 渲染:使用 Selenium/Playwright
数据存储方案
- CSV/Excel:简单数据导出
- JSON:结构化数据存储
- 数据库:MySQL、PostgreSQL、MongoDB
- 云存储:S3、OSS
- 数据仓库:用于大规模数据分析
How to use web-scraping-automation on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add web-scraping-automation
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches web-scraping-automation from GitHub repository aaaaqwq/claude-code-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate web-scraping-automation. Access the skill through slash commands (e.g., /web-scraping-automation) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.4★★★★★39 reviews- ★★★★★Amelia Khan· Dec 20, 2024
I recommend web-scraping-automation for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Dhruvi Jain· Dec 12, 2024
web-scraping-automation fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Isabella Martinez· Dec 4, 2024
web-scraping-automation is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Advait Sanchez· Nov 23, 2024
Useful defaults in web-scraping-automation — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Arya Okafor· Nov 19, 2024
web-scraping-automation has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Arjun Khanna· Nov 11, 2024
Keeps context tight: web-scraping-automation is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Oshnikdeep· Nov 3, 2024
Registry listing for web-scraping-automation matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Ganesh Mohane· Oct 22, 2024
web-scraping-automation reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Advait Gupta· Oct 14, 2024
I recommend web-scraping-automation for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Daniel Bansal· Oct 10, 2024
Solid pick for teams standardizing on skills: web-scraping-automation is focused, and the summary matches what you get after install.
showing 1-10 of 39