Skip to content
SCRAWL

CSS & XPath Extractor: Custom HTML Rules

Paste up to 10 URLs and up to 10 rules (CSS, XPath, or safe regex). Match table with url, rule, type, index, value, and attribute, plus CSV. Raw HTML only — use the H1/H2 Extractor for fixed headings across more URLs.

  • Add URLs and rules
  • Run extraction
  • Export matches
  • Browser-based — no install
  • Instant results

By Faisal YUpdated

Step-by-step guide
Custom Extraction with CSS Selectors and XPath: A Practical Guide

Template audits rarely fail on headings alone. They fail on the boring fields buried in HTML: a canonical pointing at staging, a meta robots left on by mistake, a product ID in a data-* attribute, or JSON-LD that still references the old brand name. View Source on ten URLs is workable. On thirty template variants after a CMS deploy, it is not. The CSS & XPath Extractor on Scrawl fetches up to 10 URLs and runs up to 10 rules you define: CSS (cheerio), XPath (cheerio to well-formed XHTML, then a safe evaluator with limits), or regex with the same guards as Source Code Search . Output is a match table plus CSV. Raw HTML only. No JavaScript rendering. When custom rules beat fixed heading tools Use the H1/H2 Extractor when the question is strictly heading hierarchy across up to 100 URLs. It is faster and opinionated for that job. Use custom CSS or XPath when: You need canonical URLs ( link[rel=canonical] or //link[@rel='canonical']/@href ) You are sampling meta robots or description tags across a launch batch You want one CSS class of links, not every anchor ( Link Extractor is the full inventory tool) You are hunting a string pattern in HTML with safe regex After you locate JSON-LD script blocks, validate them with the Schema Checker . Extraction finds the block; schema validation checks whether it parses. CSS selectors: start here CSS is the fastest path for most SEO fields: | Goal | Example rule | Attribute column | |------|----------------|------------------| | Canonical href | link[rel='canonical'] | href | | Meta description | meta[name='description'] | content | | OG title | meta[property='og:title'] | content | | JSON-LD body | script[type='application/ld+json'] | leave empty (text) | Run the same rules on every URL in your list. The tool does not…

Read the full guide

Set up a run

Paste up to 10 URLs, one per line, and add up to 10 rules. Every rule runs against every URL. Choose CSS, XPath, or regex for each rule. The tool fetches the initial HTML (capped at 1.5 MB per page) and does not execute JavaScript, so a value that appears only after a client render will not be in the table.

Read the match table

Each row is one match: the URL, the rule that hit, the rule type, the match index, the extracted value, and an attribute name when the rule asked for one. Index 0 is the first match of that rule on that URL. An empty value with a hit usually means the element exists and its text is blank — request the attribute (href, content) instead of the text node. A rule error is a syntax or safety rejection for that rule, not a missing element. No rows for a rule means the selector matched nothing in the initial HTML.

Which rule type for which field

CSS is the default for meta tags, canonicals, and classes: meta[name="description"], link[rel="canonical"], script[type="application/ld+json"]. XPath fits when you need an attribute axis, for example //link[@rel='canonical']/@href. Expressions are length-capped and evaluated in a worker with a hard timeout; invalid XPath returns an error on that rule. Regex is for a literal token in the HTML, with the same guards as Source Code Search: 200 characters, nested quantifiers rejected.

Use the H1/H2 Extractor when the only question is heading text across more than 10 URLs. Use the Link Extractor when you want every anchor, not one class. After a JSON-LD script shows up in the table, validate that block in the Schema Checker.

Export

CSV columns are url, rule, type, index, value, and attribute. Values that look like spreadsheet formulas are escaped. The file is this run only. Private and localhost targets are blocked, and each URL fetch is rate limited.

Frequently Asked Questions

Does this tool render JavaScript?

No. Only the initial HTML from the server is parsed. Client-rendered content is out of scope unless you paste HTML that already includes it.

How is this different from the H1/H2 Extractor?

The H1/H2 Extractor pulls fixed heading tags across up to 100 URLs. This tool runs custom CSS, XPath, or regex rules you define on up to 10 URLs.

How many URLs and rules can I use?

Up to 10 URLs and 10 rules per run. Each rule runs against every URL in the list.

Is XPath safe?

Expressions are length-capped. Evaluation runs in a worker thread with a hard timeout (about 2.5 seconds) and node caps before matches are collected. Invalid XPath returns an error. The tool never uses eval.

Can I export results?

Yes. Download CSV with url, rule, type, index, value, and attribute columns. Formula-like cell values are escaped for spreadsheet safety.