Data extraction

Tell us which fields you want, and the answer contains them as clean JSON next to the page. No parser on your side, no extra request.

Start with 50 free creditsOpen playground

You send

POST /v1/requests
{
  "url": "https://shop.example/product/42",
  "extract": {
    "name": "h1",
    "price": {
      "selector": ".price",
      "type": "number",
      "regex": "([0-9.,]+)"
    },
    "images": {
      "selector": ".gallery img",
      "attr": "src",
      "all": true
    }
  }
}
Endpoint
POST /v1/requests
Cost
No extra credits
Plans
All plans, Free included
Failed requests
Not charged
Documentation
Step-by-step guide

Every scraper ends up with the same parsing code: selectors, string cleanup, number conversion, missing fields. It is repetitive, and it runs on your servers for every page.

How VirginProxy helps

  • Fields by CSS selector, XPath or JSON path, as text, attribute or HTML, one value or all of them.
  • Types and cleanup built in: numbers, integers, booleans, a regular expression and a default value.
  • Nested lists: products with name, price and link come back as one array of objects.
  • "auto_extract" reads a product, article, job, review list, recipe, event or organisation as one fixed record without selectors; "parse" adds metadata, links, tables and JSON-LD.

How it works, step by step

  1. Name the fields

    Up to 50 named fields per request: price, title, rating, images …

  2. Point to the values

    A CSS selector, an XPath expression, or a JSON path for JSON answers.

  3. Set the type

    string, number, integer or boolean – optionally with a regular expression and a default.

  4. Get JSON back

    The values come back in extracted, next to the full page.

Example request

A product page: name, price as a number and all gallery images as a list.

curl https://api.virginproxy.com/v1/requests \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example/product/42",
    "extract": {
      "name": "h1",
      "price": {
        "selector": ".price",
        "type": "number",
        "regex": "([0-9.,]+)"
      },
      "images": {
        "selector": ".gallery img",
        "attr": "src",
        "all": true
      }
    }
  }'
import os, requests

r = requests.post(
    "https://api.virginproxy.com/v1/requests",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    json={
        "url": "https://shop.example/product/42",
        "extract": {
            "name": "h1",
            "price": {
                "selector": ".price",
                "type": "number",
                "regex": "([0-9.,]+)"
            },
            "images": {
                "selector": ".gallery img",
                "attr": "src",
                "all": True
            }
        }
    },
    timeout=150,
)
data = r.json()
print(data["status"], data["exit"]["ip"], data["cost"]["credits"])
const res = await fetch("https://api.virginproxy.com/v1/requests", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.VP_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "url": "https://shop.example/product/42",
    "extract": {
      "name": "h1",
      "price": {
        "selector": ".price",
        "type": "number",
        "regex": "([0-9.,]+)"
      },
      "images": {
        "selector": ".gallery img",
        "attr": "src",
        "all": true
      }
    }
  }),
});
const data = await res.json();
console.log(data.status, data.exit.ip, data.cost.credits);
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://shop.example/product/42",
        "extract" => [
            "name" => "h1",
            "price" => [
                "selector" => ".price",
                "type" => "number",
                "regex" => "([0-9.,]+)",
            ],
            "images" => [
                "selector" => ".gallery img",
                "attr" => "src",
                "all" => true,
            ],
        ],
    ]),
    CURLOPT_TIMEOUT => 150,
]);
$data = json_decode(curl_exec($ch), true);
echo $data["status"], " ", $data["exit"]["ip"], " ", $data["cost"]["credits"];
body := strings.NewReader(`{
  "url": "https://shop.example/product/42",
  "extract": {
    "name": "h1",
    "price": {
      "selector": ".price",
      "type": "number",
      "regex": "([0-9.,]+)"
    },
    "images": {
      "selector": ".gallery img",
      "attr": "src",
      "all": true
    }
  }
}`)
req, _ := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
if err != nil {
	log.Fatal(err)
}
defer res.Body.Close()
var data map[string]any
json.NewDecoder(res.Body).Decode(&data)
fmt.Println(data["status"], data["exit"].(map[string]any)["ip"], data["cost"].(map[string]any)["credits"])

Documentation for this feature · Automatic extraction · API reference

What comes back

Typed values, nested lists included:

{
  "status": 200,
  "extracted": {
    "name": "Trail Runner 3",
    "price": 129.0,
    "images": [ "https://shop.example/img/1.jpg", "https://shop.example/img/2.jpg" ]
  },
  "cost": { "credits": 1 }
}

What it costs

Extraction costs nothing extra. You pay for the page as usual: 1 credit up to 1 MB, also when you only need three values from it.

Pricing and cost examples

Good to know

  • Use all: true for lists, and fields for a list of objects – products with name, price and link.
  • Pick a default that cannot occur on the page, so missing values stay easy to spot.
  • parse returns metadata, links, tables and JSON-LD without any selector.
  • Test your selectors in the dashboard’s playground before you run them at scale.
  • auto_extract needs no selectors at all: it reads a product, article, job, review list, recipe, event or organisation from the page’s structured data and its layout.

Questions

Does extraction cost extra?

No. Extraction and parsing are included in the price of the request.

What if a field is not on the page?

The field comes back as null, or with the default you set. You can also retry the request automatically when an important element is missing.

CSS or XPath?

Whatever you prefer – exactly one per field. XPath helps when you need the text next to a label.

Does it work on rendered pages?

Yes. With render the fields are read from the page after its scripts ran.

How many matches can a list have?

Up to 1,000 per field, up to 3 levels of nested fields.

What if I do not want to write selectors?

Send "auto_extract": "product" (or article, job, review_list, recipe, event, organization). You get one record with fixed field names – name, price, currency, availability and more for a product – plus where it was found and how sure the result is. Missing fields are null.

Try it with 50 free credits

Pick up where you left off

No card needed. Your first request takes two minutes.

Your credits, keys and recent requests are waiting in the dashboard.

Start with 50 free creditsGo to dashboard