<< All versions

Skill v1.0.0

currentAutomated scan100/100
bug-ops/zeph/web-scrape
──Details
PublishedOctober 28, 2026 at 05:42 PM
Content Hashsha256:dcdc65e0aae140e6...
Git SHAc68c5deee4d6
──Files
Files (1 file, 9.6 KB)
SKILL.md9.6 KBactive
SKILL.md · 292 lines · 9.6 KB

name: web-scrape category: web description: > Extract structured data from web pages using CSS selectors. Use when the user asks to scrape a website, extract text or links from a page, parse HTML content, get data from a table, read article content, collect image URLs, or pull structured information from any web page. Keywords: scrape, extract, parse, crawl, get page content, read website, pull data, HTML. license: MIT compatibility: Requires the scrape tool executor (built-in) metadata: author: zeph version: "1.0"


Web Page Data Extraction

Extract structured data from web pages by specifying a URL, a CSS selector to target elements, and an extraction mode.

Command Format

`scrape
{"url": "URL", "select": "CSS_SELECTOR", "extract": "MODE", "limit": N}

Parameters

ParameterRequiredDescription
urlYesFull URL of the page (use HTTPS)
selectYesCSS selector to target elements
extractNoExtraction mode: text (default), html, or attr:NAME
limitNoMaximum number of elements to return

Extract Modes

ModeDescriptionExample Output
textInner text content, stripped of HTML tagsHello World
htmlInner HTML markup<strong>Hello</strong> World
attr:hrefValue of the specified attributehttps://example.com
attr:srcValue of the src attribute/images/logo.png
attr:classValue of the class attributebtn btn-primary
attr:idValue of the id attributemain-content
attr:data-*Value of any data attribute42

CSS Selector Reference

Basic Selectors

SelectorDescriptionExample
elementAll elements of that typep, div, h1, table
.classElements with a specific class.article, .btn-primary
#idElement with a specific ID#content, #main
*All elements*
element.classElement with a specific classdiv.container, p.intro
element#idElement with a specific IDdiv#header

Attribute Selectors

SelectorDescriptionExample
[attr]Has the attribute[href], [data-id]
[attr=val]Attribute equals value exactly[type="text"], [lang="en"]
[attr~=val]Attribute contains word (space-separated)[class~="active"]
`[attr\=val]`Attribute starts with value or value followed by -`[lang\="en"]`
[attr^=val]Attribute starts with value[href^="https"]
[attr$=val]Attribute ends with value[href$=".pdf"]
[attr*=val]Attribute contains value anywhere[href*="example"]

Combinators

SelectorDescriptionExample
A BB is a descendant of A (any depth)article p
A > BB is a direct child of Aul > li
A + BB is the immediate next sibling of Ah2 + p
A ~ BB is any subsequent sibling of Ah2 ~ p
A, BEither A or B (selector list)h1, h2, h3

Pseudo-Classes

SelectorDescriptionExample
:first-childFirst child of its parentli:first-child
:last-childLast child of its parentli:last-child
:nth-child(n)Nth child (1-based)tr:nth-child(2)
:nth-child(odd)Odd-numbered childrentr:nth-child(odd)
:nth-child(even)Even-numbered childrentr:nth-child(even)
:nth-of-type(n)Nth element of its typep:nth-of-type(3)
:first-of-typeFirst element of its typep:first-of-type
:last-of-typeLast element of its typep:last-of-type
:not(sel)Elements that do not matchp:not(.ad)
:emptyElements with no childrentd:empty

Common Extraction Patterns

Page Title

scrape
{"url": "https://example.com", "select": "title", "extract": "text"}

Meta Description

scrape
{"url": "https://example.com", "select": "meta[name='description']", "extract": "attr:content"}

Open Graph Tags

scrape
{"url": "https://example.com", "select": "meta[property^='og:']", "extract": "attr:content"}

All Links on a Page

scrape
{"url": "https://example.com", "select": "a[href]", "extract": "attr:href", "limit": 50}

External Links Only

scrape
{"url": "https://example.com", "select": "a[href^='http']", "extract": "attr:href", "limit": 30}

All Images

scrape
{"url": "https://example.com", "select": "img", "extract": "attr:src", "limit": 20}

Images with Alt Text

scrape
{"url": "https://example.com", "select": "img[alt]", "extract": "attr:alt", "limit": 20}

Article / Main Content

scrape
{"url": "https://example.com/post", "select": "article p", "extract": "text"}
scrape
{"url": "https://example.com/post", "select": "main p", "extract": "text"}
scrape
{"url": "https://example.com/post", "select": ".content p, .post-body p", "extract": "text"}

Headings (Document Structure)

scrape
{"url": "https://example.com/post", "select": "h1, h2, h3", "extract": "text"}

Navigation Links

scrape
{"url": "https://example.com", "select": "nav a", "extract": "text", "limit": 20}

Table Data

scrape
{"url": "https://example.com/data", "select": "table thead th", "extract": "text"}
scrape
{"url": "https://example.com/data", "select": "table tbody td", "extract": "text", "limit": 100}
scrape
{"url": "https://example.com/data", "select": "table tbody tr", "extract": "text", "limit": 50}

Ordered / Unordered Lists

scrape
{"url": "https://example.com", "select": "ul.features li", "extract": "text"}
scrape
{"url": "https://example.com", "select": "ol li", "extract": "text"}

Definition Lists

scrape
{"url": "https://example.com", "select": "dl dt", "extract": "text"}
scrape
{"url": "https://example.com", "select": "dl dd", "extract": "text"}

Form Fields

scrape
{"url": "https://example.com/form", "select": "input[type='text'], input[type='email'], textarea", "extract": "attr:name"}

Code Blocks

scrape
{"url": "https://example.com/docs", "select": "pre code", "extract": "text", "limit": 10}

Specific Data Attributes

scrape
{"url": "https://example.com", "select": "[data-price]", "extract": "attr:data-price"}

Multi-Step Extraction Strategy

For complex pages, extract data in multiple steps:

  1. Discover structure — get headings and landmark elements first:

``scrape {"url": "https://example.com", "select": "h1, h2, h3, nav, main, article, section", "extract": "text", "limit": 30} ``

  1. Narrow down — once you know the page structure, target the specific container:

``scrape {"url": "https://example.com", "select": "#results .item .title", "extract": "text"} ``

  1. Extract details — get attributes or nested content from the targeted elements:

``scrape {"url": "https://example.com", "select": "#results .item a", "extract": "attr:href"} ``

Selector Construction Tips

Finding the Right Selector

  • Start broad (p, div, a) and narrow down based on results
  • Use class names when available — they are the most reliable selectors
  • Combine element + class for precision: div.product-card instead of .product-card
  • Use attribute selectors for pages that rely on data attributes: [data-testid="price"]
  • Chain selectors for nested content: div.product-card > h3 > a

Common Page Structures

Content TypeLikely Selectors
Article bodyarticle p, main p, .content p, .post-body p
Blog post titleh1, article h1, .post-title
Product name.product-name, .product-title, h1.title
Product price.price, .product-price, [data-price], span.amount
Search results.result, .search-result, .item
Navigationnav a, .nav-link, .menu a
Sidebaraside, .sidebar, #sidebar
Footerfooter, .footer, #footer
Breadcrumbs.breadcrumb a, nav[aria-label="breadcrumb"] a

Pagination

To scrape multiple pages, modify the URL for each page:

scrape
{"url": "https://example.com/items?page=1", "select": ".item-title", "extract": "text", "limit": 25}
scrape
{"url": "https://example.com/items?page=2", "select": ".item-title", "extract": "text", "limit": 25}

Look for pagination patterns in the page:

scrape
{"url": "https://example.com/items", "select": ".pagination a", "extract": "attr:href"}

Important Notes

  • Always use HTTPS URLs when possible
  • Set a reasonable limit to avoid overwhelming output — start with 10-20 and increase if needed
  • If a selector returns no results, the page may use JavaScript rendering (SPA). Try broader selectors or a different approach
  • Some sites block automated access — if a request fails, the site may require authentication or have anti-scraping measures
  • Respect robots.txt and site terms of service
  • For tables, extract headers (thead th) and data (tbody td) separately for cleaner results
  • When extracting links with attr:href, relative URLs (starting with /) need the base domain prepended
  • Use extract: "html" when you need to preserve formatting (bold, links, lists) within elements
  • If the initial selector is too broad and returns noise, add parent context: instead of p, try article p or main p
  • For sites with dynamic class names (React/Next.js), use attribute selectors: [data-testid="..."], [role="..."], [aria-label="..."]
All versions