ScrapeNinja
Tool / AI

Cheerio AI sandbox

Paste HTML, describe the data, and the model writes a Cheerio extractor. It runs right away in the ScrapeNinja sandbox; tell the model what to fix until the JSON is right.

1. HTML of the page
Get it from the scraper playground (HTML tab) or "View source" in your browser. Large pages are cleaned and cut to 64 KB before they reach the model.
3. Generated extractor
Result
// run the extractor to see JSON here

Why generate code instead of asking the LLM for the data?

The popular way to scrape with an LLM is to convert every page to Markdown and ask the model for the data. It works, but it is slow and expensive on 10,000 product pages, and the answers can drift from page to page. Here the model writes the extractor once, from one sample page; then the code runs on every similar page in milliseconds, for free and with the same result every time.

How it works

  1. The HTML is cleaned (scripts, styles and noise removed) and cut to 64 KB, so the model sees the structure that matters.
  2. The model writes a function extract(input, cheerio) for your request.
  3. The extractor runs in the same isolated sandbox as the ScrapeNinja API, and you see the JSON.
  4. If the result is off, describe what is wrong: the model gets its previous code and output and improves them.

Where to get the HTML

Run the page in the live sandbox and copy the HTML tab, or use "View page source" in your browser. Note that "View page source" shows the raw HTML the server sent, which may differ from what you see after JavaScript runs. Try the raw HTML first: it is what the fast /scrape engine gets, and scraping it is much faster and cheaper than rendering the page in a browser.

When it works, open it in the Cheerio playground to fine-tune by hand, or send it as the extractor parameter with any ScrapeNinja request.