Get an API key Your API keys

Parse pages

Some things every page has: a title, links, images, headings, maybe tables and structured data. parse reads them for you and returns them as clean JSON in parsed – no selectors needed.

curl https://api.virginproxy.com/v1/requests \
  -H "Authorization: Bearer $VP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example/product/42",
    "parse": [
      "metadata",
      "links",
      "tables",
      "json_ld"
    ]
  }'
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",
        "parse": ["metadata", "links", "tables", "json_ld"],
    },
    timeout=180,
)
data = r.json()
if not r.ok:
    raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["parsed"]["metadata"])
print(data["parsed"]["json_ld"])
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",
    parse: ["metadata", "links", "tables", "json_ld"],
  }),
  signal: AbortSignal.timeout(180_000),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error.code + ": " + data.error.message);
console.log(data.parsed.metadata);
console.log(data.parsed.json_ld);
from virginproxy import VirginProxy  # docs.virginproxy.com/sdk/virginproxy.py

vp = VirginProxy()  # reads VP_KEY
data = vp.request({
    "url": "https://shop.example/product/42",
    "parse": ["metadata", "links", "tables", "json_ld"],
})
print(data)
import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs

const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.request({
  url: "https://shop.example/product/42",
  parse: ["metadata", "links", "tables", "json_ld"],
});
console.log(data);
<?php
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 180,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("VP_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "url" => "https://shop.example/product/42",
        "parse" => ["metadata", "links", "tables", "json_ld"],
    ], JSON_UNESCAPED_SLASHES),
]);
$data = json_decode(curl_exec($ch), true);
if (isset($data["error"])) {
    exit($data["error"]["code"] . ": " . $data["error"]["message"] . PHP_EOL);
}
echo json_encode($data["parsed"]["metadata"], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), PHP_EOL;
echo json_encode($data["parsed"]["json_ld"], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), PHP_EOL;
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	payload := []byte(`{
  "url": "https://shop.example/product/42",
  "parse": [
    "metadata",
    "links",
    "tables",
    "json_ld"
  ]
}`)
	req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", bytes.NewReader(payload))
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{Timeout: 180 * time.Second}
	res, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer res.Body.Close()

	var data map[string]any
	if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
		log.Fatal(err)
	}
	if res.StatusCode >= 300 {
		e := data["error"].(map[string]any)
		log.Fatalf("%v: %v", e["code"], e["message"])
	}
	fmt.Println(data["parsed"].(map[string]any)["metadata"])
	fmt.Println(data["parsed"].(map[string]any)["json_ld"])
}
require "json"
require "net/http"

uri = URI("https://api.virginproxy.com/v1/requests")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({
  "url" => "https://shop.example/product/42",
  "parse" => ["metadata", "links", "tables", "json_ld"],
})

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 180) { |http| http.request(req) }
data = JSON.parse(res.body)
abort(data["error"]["code"] + ": " + data["error"]["message"]) unless res.is_a?(Net::HTTPSuccess)
puts JSON.pretty_generate(data["parsed"]["metadata"])
puts JSON.pretty_generate(data["parsed"]["json_ld"])
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class Main {
    public static void main(String[] args) throws Exception {
        String payload = """
            {
              "url": "https://shop.example/product/42",
              "parse": [
                "metadata",
                "links",
                "tables",
                "json_ld"
              ]
            }
            """;
        HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/requests"))
            .header("Authorization", "Bearer " + System.getenv("VP_KEY"))
            .header("Content-Type", "application/json")
            .timeout(Duration.ofSeconds(180))
            .POST(HttpRequest.BodyPublishers.ofString(payload))
            .build();
        HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
        if (res.statusCode() >= 300) {
            System.err.println(res.statusCode() + " " + res.body()); // the error object: code, message
            System.exit(1);
        }
        System.out.println(res.body()); // JSON: read it with the JSON library of your choice
    }
}
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;

using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(180) };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VP_KEY"));
var payload = """
    {
      "url": "https://shop.example/product/42",
      "parse": [
        "metadata",
        "links",
        "tables",
        "json_ld"
      ]
    }
    """;
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/requests");
req.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var res = await http.SendAsync(req);
using var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
if (!res.IsSuccessStatusCode)
{
    var e = data.RootElement.GetProperty("error");
    Console.Error.WriteLine(e.GetProperty("code") + ": " + e.GetProperty("message"));
    Environment.Exit(1);
}
Console.WriteLine(data.RootElement.GetProperty("parsed").GetProperty("metadata"));
Console.WriteLine(data.RootElement.GetProperty("parsed").GetProperty("json_ld"));

"parse": true returns everything. A list returns exactly the keys you asked for:

Response · 200 OK (shortened)
{
  "status": 200,
  "final_url": "https://shop.example/product/42",
  "parsed": {
    "metadata": {
      "title": "Trail Runner 2 – Shop Example",
      "description": "Light trail running shoe with a grippy sole.",
      "canonical": "https://shop.example/product/42",
      "lang": "en",
      "robots": "index, follow",
      "favicon": "https://shop.example/favicon.ico",
      "og": { "title": "Trail Runner 2", "type": "product", "image": "https://shop.example/img/42.jpg" },
      "twitter": { "card": "summary_large_image" },
      "hreflang": [{ "lang": "de", "url": "https://shop.example/de/product/42" }]
    },
    "links": [
      { "url": "https://shop.example/category/running", "text": "Running", "rel": null, "internal": true },
      { "url": "https://social.example/shopexample", "text": "Social profile", "rel": "noopener", "internal": false }
    ],
    "images": [
      { "url": "https://shop.example/img/42.jpg", "alt": "Trail Runner 2, side view", "width": 800, "height": 600 }
    ],
    "headings": [
      { "level": 1, "text": "Trail Runner 2" },
      { "level": 2, "text": "Details" }
    ],
    "emails": ["support@shop.example"],
    "phones": ["+493012345678"],
    "tables": [
      { "caption": "Sizes", "headers": ["EU", "UK", "US"], "rows": [["42", "8", "9"], ["43", "9", "10"]] }
    ],
    "json_ld": [
      { "@context": "https://schema.org", "@type": "Product", "name": "Trail Runner 2", "offers": { "@type": "Offer", "price": "129.00", "priceCurrency": "EUR" } }
    ]
  },
  "cost": { "credits": 1 }
}

What can be parsed

KeyResultLimit
metadata{title, description, canonical, lang, robots, favicon, og, twitter, hreflang}. og and twitter are objects of the Open Graph and Twitter tags without their prefix; hreflang is a list of {lang, url}. Missing values are null or empty.–
links[{url, text, rel, internal}], absolute, without javascript:, mailto: and tel: links, one entry per URL. internal is true when the link points to the host of final_url.2,000
images[{url, alt, width, height}] from src, otherwise data-src or the first srcset entry. Width and height are numbers or null.1,000
headings[{level, text}] for h1 to h6, in page order.500
emailsAddresses from mailto: links and from the text, each once.500
phonesNumbers from tel: links, reduced to + and digits. Numbers in running text are not guessed.500
tables[{caption, headers, rows}]. Headers come from thead th, otherwise from the first row of th cells; cells are trimmed.50 tables, 1,000 rows each
json_ldEvery <script type="application/ld+json">, parsed. A @graph is split into its objects; invalid JSON is skipped.100

How it behaves

Tip

Need a value that is not in this list, like a price in a specific element? Use extract, and combine both in one request.

Was this page helpful?

Last updated