css_extractor and Zenrows returns those values as JSON. For common data such as tables, links, emails or headings, outputs does it with no selectors at all. And when you’d rather keep your own parser, fetch the HTML and run BeautifulSoup or Cheerio on it.
Uses: Fetch with css_extractor, outputs and Adaptive Stealth Mode (mode=auto)
Ask your AI agent
With the Zenrows MCP server connected to Claude, Cursor or any MCP client, paste this prompt. Your agent picks the right Zenrows tools and settings on its own.Extract elements with css_extractor
Sendcss_extractor as a JSON object: each key is the name you want in the output, each value is a CSS selector. Fetch applies the selectors to the rendered page and returns JSON instead of HTML.
zenrows extract --css sends css_extractor and --outputs sends outputs.
Example output
Trimmed to three products:How selectors map to JSON
Any CSS selector works: attribute filters such as
a[href*='/product/'], combinators such as .product .price, and pseudo-classes such as li:first-child. Test a selector in your browser’s console with document.querySelectorAll(...) before you send it.
Get common data with outputs
For data every site shares, skip selectors.outputs takes a comma-separated list of filters: emails, phone_numbers, headings, images, audios, videos, links, menus, hashtags, metadata, tables and favicon, or * for all of them. Tables come back as rows keyed by their column headings.
Output (trimmed)
Using external libraries
When you need parsing logic of your own, such as reading one product card at a time so each name stays paired with its price, request the HTML and parse it with your favorite library. Zenrows still handles rendering and anti-bot protection.Python with BeautifulSoup
Python (Requests)
Output
JavaScript with Cheerio
Node.js
Which method to choose
Customize it
Troubleshooting
- A key comes back as an empty string: the selector matched nothing in the final HTML. Check it against the page with your browser’s console, and if the element loads late, switch to
js_render=truewithwait_forset to that selector. - You get HTML instead of JSON: the
css_extractorvalue isn’t valid JSON or isn’t encoded. Build it withjson.dumpsorJSON.stringify, and URL-encode it in cURL. - Values from different products don’t line up: separate arrays lose the grouping when one card lacks a field. Parse one card at a time with BeautifulSoup or Cheerio.
413response: the page is very large.css_extractororoutputsreturns just the data you ask for and keeps responses small.
Related recipes
Get structured JSON from any page
Let Extract find the fields for you, no selectors needed.
Crawl a website from a start URL
Collect every product URL, then extract each page.
Scrape a list of URLs
Apply the same selectors to thousands of pages in one job.
Turn any web page into LLM-ready markdown
Hand a whole page to an LLM as clean markdown.