tian-ye1214/redlotus/web-scraping

Claude Code and agent skill by tian-ye1214/redlotus

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

网页数据抓取和解析。用于从网站提取结构化数据、自动化网页操作、处理动态页面内容。当需要从网页获取数据时使用此Skill。

Install

npx vskill@latest install tian-ye1214/redlotus/web-scraping

SKILL.md

网页抓取 Skill

本 Skill 提供网页数据抓取和解析能力,支持静态页面和动态渲染页面。

快速开始

静态页面抓取

使用 requests 和 BeautifulSoup 处理静态页面:

python
import requests
from bs4 import BeautifulSoup
def scrape_static_page(url: str) -> dict:
"""抓取静态网页内容"""
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
response = requests.get(url, headers=headers, timeout=10)
response.raise_for_status()
response.encoding = response.apparent_encoding
soup = BeautifulSoup(response.text, 'html.parser')
return {
'title': soup.title.string if soup.title else None,
'text': soup.get_text(separator='\n', strip=True),
'links': [a.get('href') for a in soup.find_all('a', href=True)],
'images': [img.get('src') for img in soup.find_all('img', src=True)]
}
提取特定元素
python
def extract_elements(html: str, selector: str) -> list:
"""使用 CSS 选择器提取元素"""
soup = BeautifulSoup(html, 'html.parser')
elements = soup.select(selector)
return [elem.get_text(strip=True) for elem in elements]

工作流程

  1. 分析目标页面: 确定页面是静态还是动态渲染
  2. 选择抓取方式:
  • 静态页面 → requests + BeautifulSoup
  • 动态页面 → Selenium 或 Playwright
  1. 定位目标数据: 使用 CSS 选择器或 XPath
  2. 提取并清洗数据: 去除无用内容,格式化输出
  3. 保存结果: 保存为 JSON、CSV 或其他格式

最佳实践

  • 设置合理的请求间隔,避免对目标服务器造成压力
  • 处理请求失败的情况,实现重试机制
  • 尊重 robots.txt 规则
  • 注意处理编码问题

常见选择器

选择器说明
#id选择指定 ID 的元素
.class选择指定类名的元素
tag选择指定标签的元素
[attr=value]选择指定属性值的元素

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/tian-ye1214/redlotus/web-scraping/badge)](https://verified-skill.com/skills/tian-ye1214/redlotus/web-scraping)

Something wrong with this skill or its page? Tell us.