Web Scraping Toolkit: Agent Web Crawling Skill Implemented with the Standard Library

Introduction

When performing data collection or writing technical introductions, it is often necessary to extract titles, body text, or specific DOM blocks from public web pages. Common approaches involve writing temporary requests + BeautifulSoup scripts or using an Agent to call browser-based MCPs. The former requires installing dependencies and maintaining scripts; the latter is often overkill for pages that “only require static HTML.”

Below is an introduction to the Web Scraping Toolbox (@user_f28fdad8/oc-web-fetch) on SkillHub: it covers single-page scraping, batch scraping, conditional element extraction, and HTML-to-Markdown conversion using four executable Python scripts. It relies solely on the Python standard library. Once the Skill is installed, the Agent can invoke it directly using JSON input parameters.

What is this

The Web Scraping Toolbox is an Agent Skill published on SkillHub by the community publisher user_f28fdad8, with the coordinates @user_f28fdad8/oc-web-fetch. The current version is 1.0.0, categorized under data-analysis, with tags indicating requires_api_key=false (no API Key required).

It is positioned as a lightweight web content scraping and conversion tool: input a URL (or HTML string) and output structured JSON or Markdown text, facilitating summarization, data ingestion, or secondary processing by Agents.

Official pages:

  • SkillHub: https://www.skillhub.cn/skills/user_f28fdad8/oc-web-fetch
  • API Entry: https://api.skillhub.cn/user_f28fdad8/oc-web-fetch

Core Features

The SKILL.md and scripts/ directory within the Skill correspond to four capabilities. Both input and output are JSON, making it easy for Agent integration.

  1. Single URL Fetch (scripts/fetch.py)
    Requests the page, automatically handles encoding, parses HTML, and returns the title, body content, meta tags (such as description, keywords), and statistics like elapsed time.

  2. Batch Fetch (scripts/batch_fetch.py)
    Sends concurrent requests for a list of URLs, supports deduplication, and outputs a summary report of successes/failures. The concurrency count and request interval are adjustable by default.

  3. Specific Element Extraction (scripts/extract.py)
    Matches nodes using simplified selectors (tag, class, id, attr) and returns a list of content from the matched elements.

  4. HTML to Markdown (scripts/to_markdown.py)
    Converts from a URL or HTML string, filtering out noise tags like navigation and scripts, while preserving structures such as headings, paragraphs, lists, links, and images.

The implementation emphasizes: using only standard libraries like urllib, html.parser, json, and re; single-page fetching includes encoding detection (documentation states support for UTF-8, GBK, GB2312, etc.); and returning clear error messages instead of crashing directly upon failure.

Installation and Activation

Install via SkillHub CLI

First, check if skillhub is already on your machine:

command -v skillhub && skillhub --version

If not installed, you can follow the official SkillHub instructions to perform a full installation or install just the CLI (Documentation URL: https://skillhub.cn/install/skillhub.md):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

When installing the Skill, you must use --dir to point to the current Agent’s skills directory; otherwise, it may land in the default ./skills/ and not be recognized. Taking this Skill as an example:

skillhub install @user_f28fdad8/oc-web-fetch --dir ~/.cursor/skills/

Common client skills paths (excerpted from SkillHub installation documentation):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

The SkillHub page also provides a prompt: “Ask AI to install @user_f28fdad8/oc-web-fetch based on https://skillhub.cn/install/skillhub.md”. The effect is the same as the CLI installation above, except the Agent performs the steps.

After installation, when a conversation triggers an intent related to web scraping (such as “scrape webpage”, “HTML to Markdown”, “batch scrape”, etc., see the trigger field in the Skill metadata), the Agent should load this Skill and call the corresponding script according to SKILL.md.

Typical Usage

The following commands need to be executed in the Skill package root directory (the directory containing scripts/). The path depends on your local installation location.

1. Scrape a single webpage

python scripts/fetch.py --input '{"url": "https://example.com"}'

The optional field timeout defaults to 10 (seconds). On success, it returns a JSON with fields such as status, title, content, meta, and stats.

2. Batch scraping

python scripts/batch_fetch.py --input '{"urls": ["https://example.com/page1", "https://example.com/page2"]}'

Optional: concurrency defaults to 3, delay defaults to 1 (second). Outputs the result for each URL and a summary report.

3. Extract regions by selector

python scripts/extract.py --input '{"url": "https://example.com", "selector": {"tag": "div", "class": "article-content"}}'

selector supports tag, class, and id; attr can match by name:value or just the attribute name.

4. Convert webpage to Markdown

python scripts/to_markdown.py --input '{"url": "https://example.com"}'

You can also pass the html field instead of the URL. Outputs Markdown text and conversion statistics.

Use Cases and Notes

Who is it for

  • Those who need to quickly extract body text, meta tags, or local DOM from static HTML pages, and want zero pip dependencies with scripts that can be stably invoked by Agents.
  • Those who need to batch fetch several public URLs with simple concurrency, deduplication, and summarization.

Limitations and Notes

  • Based on urllib and html.parser, it does not execute JavaScript. For sites that rely heavily on frontend rendering, the body text may be incomplete; such scenarios still require a browser or specialized rendering solutions.
  • The selector in extract.py is a combination match of tag/class/id/attribute, not full CSS selector syntax; for complex pages, you may need to try conditions several times or switch to single-page fetching and let the Agent process the text.
  • For batch scraping, please set concurrency and delay reasonably, and obey the target site’s access frequency and robots conventions; this Skill does not provide advanced capabilities like proxies or Cookie logins.
  • This is a community Skill; behavior is subject to the SKILL.md and scripts within the package. The SkillHub page statistics (as of the data capture) show a rating of 100000 and 3025 downloads, for selection reference.

Conclusion

The Web Scraping Toolbox breaks down “single-page, batch, element extraction, and Markdown conversion” into four standard library scripts and unifies input/output parameters with JSON, making it suitable as a lightweight collection layer on the Agent side. If your environment is configured with SkillHub, you can install it into the skills directory of clients like Cursor using the commands above and start using it immediately.

More information and installation entry: https://www.skillhub.cn/skills/user_f28fdad8/oc-web-fetch

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye