Free SEO audit for new clients — claim yours
Home/Blog/Technical SEO/Custom Extraction: Scrape Any On-Page Element Wi…
Technical SEO

Custom Extraction: Scrape Any On-Page Element With Your SEO Crawler

Custom Extraction: Scrape Any On-Page Element With Your SEO Crawler
Table of contents
  1. What custom extraction does that standard crawl reports cannot
  2. XPath, CSS selectors and regex in plain language
    1. Output types matter as much as the selector
    2. Raw HTML versus rendered HTML
    3. Getting a selector without writing it
    4. Making patterns survive theme and plugin updates
  3. Recipe: auditing publish dates and authors across a blog
  4. Recipe: finding missing schema, prices and other product data
  5. Recipe: checking product stock status at scale
  6. More extraction recipes worth saving
  7. Turning extraction results into an action list
  8. Questions SEOs ask about extraction rules
    1. Is XPath or a CSS selector better for SEO custom extraction?
    2. Why does my extraction rule return blank values?
    3. Can custom extraction read JSON-LD structured data?
    4. How many extractors can I run in one Screaming Frog crawl?
    5. Will custom extraction slow down my crawl?
  9. Building your first extraction audit this week
  10. Further reading on custom extraction
  11. Sources for this custom extraction guide

Standard crawl reports answer standard questions: which pages are 404, which titles are too long, which images lack alt text. The questions that actually drive SEO decisions are usually more specific. Which blog posts have no named author? Which product pages say "Sold out" but still sit in the XML sitemap? Which templates forgot the Product schema after the last theme update? Which articles have not been updated since 2021?

No off-the-shelf report answers those, but your crawler can, if you tell it exactly what to pull from each page. That feature is called custom extraction, and it turns a crawler into a lightweight scraper that runs across every URL on a site in one pass.

This guide explains the three selector languages you will use, gives tested patterns for the most common audit jobs (dates and authors, schema and prices, stock status and more), and shows how to turn thousands of extracted values into a short, prioritised action list.

What custom extraction does that standard crawl reports cannot

Screaming Frog's documentation describes the feature in one sentence:

“The custom extraction feature allows you to scrape any data from the HTML of a web page using XPath, CSSPath and regex.”

— Screaming Frog, Web scraping and data extraction using the SEO Spider

In practice you define one or more rules, each with a name, a selector and an output type. As the crawler fetches each page it applies the rules and records the result in extra columns. Screaming Frog allows up to 100 extractors per crawl and shows results in a Custom Extraction tab as the crawl runs. Sitebulb offers the same idea with a point-and-click selector that generates CSS selectors for you, plus a content search feature for finding words or phrases in page HTML (Sitebulb content extraction).

Typical uses include:

  • Auditing editorial signals: author names, publish and modified dates, word counts, number of internal links in the body.
  • Verifying structured data at scale: which pages carry Product, Article, LocalBusiness or Breadcrumb markup, and with which values.
  • Ecommerce checks: prices, stock status, SKU, review counts, variant counts.
  • Migration QA: confirming that titles, H1s, canonicals and tracking IDs carried over to the new templates.
  • Thin and duplicate archive detection, as Semrush showed for category and tag pages, by extracting article or product counts per listing page.
  • Tracking and compliance: finding pages missing the analytics tag, consent banner or a required disclaimer.

XPath, CSS selectors and regex in plain language

Each selector language suits a different job. You do not need to master all three; you need to know which to reach for.

LanguageBest forExampleWhat it returns
XPathAttributes, conditions, counting, navigating up and down the HTML tree//meta[@property='article:published_time']/@contentThe publish date from the Open Graph meta tag
CSS selector (CSSPath)Elements by class or ID, familiar to front-end developers.product-price .moneyThe element or its text, depending on output type
RegexAnything not in an HTML element, especially JSON-LD and inline scripts"datePublished":\s*"([^"]+)"The captured group, here the date string

Screaming Frog's guide explains when regex becomes unavoidable:

“Regex is required for anything that is not part of a HTML element, for example any JSON found in the code.”

— Screaming Frog, Web scraping and data extraction using the SEO Spider

Output types matter as much as the selector

For XPath and CSS selectors, Screaming Frog offers four outputs: Extract HTML Element (the full tag), Extract Inner HTML (what is inside the tag), Extract Text (visible text only) and Function Value (the result of an expression such as count(//h2)). Choosing "Extract Text" when you wanted an attribute value is the most common reason a rule returns blanks.

Raw HTML versus rendered HTML

By default crawlers extract from the raw HTML the server sends. If a value is injected by JavaScript (prices from an API, reviews from a widget, schema added by a tag manager), it will be missing unless you switch to JavaScript rendering mode. That difference is itself a useful audit: Google renders pages, but its JavaScript SEO guidance still prefers critical content and links in the HTML, and its troubleshooting guide recommends checking the rendered HTML for anything missing. Run one crawl in each mode and compare the columns.

Getting a selector without writing it

  1. Open a representative page in Chrome and right-click the element, then choose Inspect.
  2. In the Elements panel, right-click the highlighted node and choose Copy then Copy XPath or Copy selector.
  3. Simplify it. Auto-generated paths like /html/body/div[3]/main/div[2]/span break when layout changes; prefer anchors on stable classes, IDs or attributes, such as //span[@class='posted-on']//time/@datetime.
  4. Test it in the DevTools Console with $x("your-xpath") or document.querySelectorAll("your-css") on two or three different templates.
  5. Use the crawler's test or preview feature on a handful of URLs before running the full crawl.

Making patterns survive theme and plugin updates

Extraction rules break when markup changes, and a broken rule looks exactly like a missing value. Three habits keep them reliable. First, allow for optional whitespace and quotes in regex (the \s* and "? parts in the patterns above exist because different plugins format JSON-LD differently, some minified and some pretty-printed). Second, anchor XPath and CSS on semantic attributes such as itemprop, rel, name or datetime rather than layout classes that designers rename. Third, add a control extractor that should always return a value, such as the page title or count(//h1). If the control column is populated but a rule is blank across a whole template, the rule is broken, not the pages.

Recipe: auditing publish dates and authors across a blog

Dates and bylines feed both reader trust and your content maintenance schedule. Most themes expose them in three places: visible HTML, meta tags and JSON-LD. Extract all three, because mismatches are themselves findings.

Extractor nameTypeSelectorOutput
og_publishedXPath//meta[@property='article:published_time']/@contentExtract Text (attribute value)
og_modifiedXPath//meta[@property='article:modified_time']/@contentExtract Text
ld_datePublishedRegex"datePublished"\s*:\s*"([^"]+)"Captured group
ld_dateModifiedRegex"dateModified"\s*:\s*"([^"]+)"Captured group
visible_dateXPath//article//time/@datetimeExtract Text
bylineCSS.author-name (adjust to theme)Extract Text
author_linkXPath//a[@rel='author']/@hrefExtract Text

Restrict the crawl to post URLs with an include pattern (for example /blog/.*) so you are not scraping category pages. Then, in a spreadsheet:

  • Filter blank bylines: posts with no named author, a gap our guide to author pages and bylines explains how to fix.
  • Count posts per author with a pivot table, a technique Salt Agency describes for author audits (custom extraction using Sitebulb and Screaming Frog). An "admin" or "staff" author on 300 posts is a finding.
  • Compare visible dates with dateModified. A visible date of 2024 alongside a JSON-LD modified date from yesterday often means a plugin updates the timestamp on trivial saves.
  • Sort by modified date to build a refresh queue of the oldest posts that still earn impressions.

Article markup itself is covered in our Article schema guide.

Recipe: finding missing schema, prices and other product data

Schema plugins and theme updates break quietly. Extraction tells you which templates are affected.

  • Count JSON-LD blocks: XPath count(//script[@type='application/ld+json']) with Function Value. Zero on a product page is an immediate flag.
  • List schema types: regex "@type"\s*:\s*"([^"]+)". Screaming Frog can return multiple matches per page, so you see "Product, Offer, BreadcrumbList" side by side.
  • Microdata types: XPath //*[@itemtype]/@itemtype, the example Screaming Frog uses.
  • Schema price: regex "price"\s*:\s*"?([0-9.,]+).
  • Visible price: CSS selector for your theme's price element, such as .price__current, with Extract Text.
  • Review data: regex "ratingValue"\s*:\s*"?([0-9.]+) and "reviewCount"\s*:\s*"?([0-9]+).

Join the schema price and the visible price in a sheet and flag rows where they differ. A mismatch between structured data and what shoppers see is one of the causes of Merchant Center and rich result problems; see our guide to Product schema and merchant listings.

The same technique works for any schema type. For a recipe site you might extract "cookTime" and "recipeYield" to find incomplete markup, an approach that pairs with our recipe schema guide. For software pages, extract "applicationCategory" and "operatingSystem" (see SoftwareApplication schema).

Recipe: checking product stock status at scale

Out-of-stock pages are not automatically a problem, but you need to know how many there are, how long they have been out of stock and whether you are still sending them traffic and ad spend. Extract stock signals from three angles:

  1. Schema availability: regex "availability"\s*:\s*"(?:https?://schema\.org/)?(\w+)" returns values such as InStock, OutOfStock or PreOrder.
  2. Buy button state: XPath //button[@name='add']/@disabled (Shopify's default add-to-cart button uses name="add" in many themes; adjust for yours). A value means the button is disabled.
  3. Visible sold-out text: XPath count(//*[contains(normalize-space(text()),'Sold out')]) with Function Value. Change the phrase to match your theme or language.

Then combine with data the crawler already has (indexability, inlinks, sitemap inclusion) and with Search Console clicks via the API connection. The result is a table you can act on:

Schema availabilityButton disabled?Clicks (90 days)Likely action
OutOfStockYesHighKeep page live, add back-in-stock signup and alternatives
OutOfStockYesNone, discontinued301 to closest replacement or category
InStockYesAnyData mismatch: fix schema or inventory sync
OutOfStockNoAnyShoppers can add an unavailable item: fix theme logic
BlankNoAnyMissing Offer markup: fix template

Our guide to out-of-stock and discontinued products covers the SEO decisions in detail, and our pre-orders and back-in-stock guide covers the merchandising side.

More extraction recipes worth saving

Audit questionSelectorType
Is the analytics tag on every page?G-[A-Z0-9]{6,12}Regex
Is Tag Manager present?GTM-[A-Z0-9]+Regex
Does og:url match the canonical?//meta[@property='og:url']/@contentXPath
How many hreflang alternates?count(//link[@rel='alternate'][@hreflang])XPath, Function Value
How many H2s in the article body?count(//article//h2)XPath, Function Value
Which pages embed YouTube?//iframe[contains(@src,'youtube')]/@srcXPath
Which links use hash routes?//a[contains(@href,'#/')]/@hrefXPath
Breadcrumb trail textnav[aria-label="breadcrumb"]CSS, Extract Text

The og:url check pairs naturally with canonical audits; Google treats rel="canonical" as a strong signal and recommends absolute URLs (Google’s canonicalisation guide), so mismatches between social and canonical tags are worth cleaning up. The hash-route check is explained in our guide to URL fragments and SEO. For images that matter in search, Google's image best practices note that CSS background images are not indexed; extracting //*[contains(@style,'background-image')]/@style finds hero images built that way.

Turning extraction results into an action list

A crawl with ten extractors on 20,000 URLs produces 200,000 data points. Nobody acts on that. The final step is reduction.

Hypothetical example for illustration. A retailer crawls 8,400 product URLs with the stock and schema extractors above. Results:

  • 6,950 InStock with an enabled button: no action.
  • 1,020 OutOfStock with a disabled button. Of these, 140 had Search Console clicks in the last 90 days.
  • 210 InStock with a disabled button: an inventory sync error affecting real sales.
  • 220 with no Offer markup at all, all from one legacy template.

That reduces to four tickets, in priority order: fix the sync error (210 pages losing sales now), fix the legacy template (220 pages, one code change), decide on the 140 out-of-stock pages that still earn clicks, and redirect or retire the 880 that do not.

A repeatable workflow:

  1. Export the Custom Extraction tab (or the Internal tab, which includes extraction columns) to a spreadsheet or BigQuery.
  2. Join with Search Console clicks and analytics revenue by URL so every row has business value attached.
  3. Classify each row with a formula into a small number of action buckets, as in the stock table above.
  4. Group by template, not URL. If 300 errors share a template, that is one ticket for developers.
  5. Save the configuration and re-run monthly or after every release. Salt Agency's observation holds: once a rule is written it is reliable, so the second crawl costs minutes.
  6. Automate with scheduled crawls, or script the analysis with the approach in our Python for SEO guide.

Questions SEOs ask about extraction rules

Is XPath or a CSS selector better for SEO custom extraction?

Use XPath when you need attributes, conditions or counts, and CSS selectors when you are targeting elements by class or ID. Use regex for JSON-LD and inline scripts, which are not HTML elements.

Why does my extraction rule return blank values?

The three usual causes are the wrong output type (Extract Text instead of an attribute), content injected by JavaScript while the crawl uses raw HTML, or a selector copied from one template that does not match others.

Can custom extraction read JSON-LD structured data?

Yes, with regex. A pattern such as "datePublished"\s*:\s*"([^"]+)" captures the value. Some crawlers also offer built-in structured data extraction as a separate option.

How many extractors can I run in one Screaming Frog crawl?

Screaming Frog supports up to 100 custom extractors per crawl. In practice, ten or fewer focused rules per audit are easier to analyse.

Will custom extraction slow down my crawl?

Slightly, and JavaScript rendering slows it much more. Limit rules to the URL patterns they apply to and use include patterns to keep the crawl focused.

Building your first extraction audit this week

Pick one question that standard reports cannot answer and that has money attached, such as product pages with a disabled buy button or blog posts with no author. Write two or three rules, test them on five URLs from different templates, crawl only the relevant section, and reduce the output to a ticket list grouped by template. Save the configuration so next month's audit takes minutes. If you are new to the crawler itself, start with our Screaming Frog guide.

Want us to build a reusable extraction audit for your site? Our technical SEO team does this for ecommerce and publishing sites, and our ecommerce SEO service includes stock and schema monitoring. Get a quote.

Further reading on custom extraction

Sources for this custom extraction guide

  1. Screaming Frog: Web scraping and data extraction using the SEO Spider
  2. Sitebulb: Content extraction and search
  3. Salt Agency: Custom extraction using Sitebulb and Screaming Frog (October 2020)
  4. Semrush Blog: Custom extraction for duplicate content (September 2019)
  5. Google Search Central: Fix Search-related JavaScript problems
  6. Google Search Central: Understand the JavaScript SEO basics
  7. Google Search Central: How to specify a canonical URL
  8. Google Search Central: Image SEO best practices
Rohit Choudhary
Written byRohit ChoudharyCo-Founder, My SEO Experts

Rohit Choudhary is the co-founder of My SEO Experts and has more than 14 years of hands-on experience in SEO, paid advertising and digital marketing. Since starting out in 2011 he has helped hundreds of businesses grow through practical, data-driven search strategies, and he also serves as a consulting Digital Marketing Director for several US-based companies.

Keep reading

Related articles

Ready to grow your business online?

Get a free, no-obligation proposal tailored to your goals and budget.

CallFree Quote