For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Parser

See the steps for a quick start with Oxylabs Custom Parser.

Custom Parser is a free Web Scraper API feature that lets you create parsing and data processing logic that’s executed on a raw HTML result. You can automatically generate parsers using AI or write them manually for advanced scenarios.

For in-depth instructions and examples, refer to these pages:

Getting started Generating parsers via API Parser Presets

Writing instructions manually List of parsing functions


Quick start

1. Generate a parser

We recommend starting out with our AI-powered OxyCopilot tool that lets you generate scrapers and parsers without writing any code.

Follow the steps shown in the video to generate a parser:

Here are the same steps shown in the video:

  1. Enter the URL(s) you want to scrape and parse

  2. Specify any parameters such as JavaScript rendering

  3. Write a prompt that describes what you want to parse

  4. Run OxyCopilot

Once you’re happy with the generated parser, load the instructions.

2. Save the parser as a preset

You can easily save your generated parsers through OxyCopilot for later use. See the steps below:

  1. Assign the preset to a specific API user

  2. Click Save

  3. Enter the preset name and the description (optional)

After saving the preset, you can use it with API requests.

A newly created preset can take up to about a minute to become available to scraping jobs on both Realtime and Push-Pull. Until then, requests that reference it are rejected with 400 - Provided parser_preset does not exist.

3. Use the parser with API requests

To use your preset with Web Scraper API, send a payload with the parser_preset parameter set to your preset name. In the code samples below, we're reusing the example_parser preset created in previous steps.

Output sample

Getting the HTML content of a parsed job

A parsed job can also return the raw HTML it was parsed from: add the type query parameter with raw (or parsed,raw for both) to the Realtime endpoint or to the Push-Pull result URL. See Multi-format Output.

Last updated

Was this helpful?