How to Scrape Viator Data: Complete Guide for 2026
Tutorials

How to Scrape Viator Data: Complete Guide for 2026

Learn how to scrape Viator travel data using Python and Node.js with AlterLab's API. Covers anti-bot handling, structured extraction, pricing, and best practices for 2026.

4 min read
5 views

AlterLab handles this automaticallyscrape any URL with one API call. No infrastructure required.

Try it free

This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

TL;DR

To scrape Viator, send a request to AlterLab's API with the target URL. Use Python or Node.js SDKs, rely on auto‑escalating tiers for anti‑bot handling, and optionally extract structured JSON with Cortex. Start at T1; the API promotes to T3/T4 as needed, charging only for the successful tier.

Why collect travel data from Viator?

Viator lists tours, activities, and experiences worldwide. Engineers extract this data for:

  • Market research: Compare activity pricing across cities to inform product positioning.
  • Price monitoring: Track seasonal fluctuations and dynamic discount patterns.
  • Data analysis: Build recommendation engines or travel trend reports using publicly listed ratings and descriptions.

Technical challenges

Travel sites like viator.com deploy standard anti‑bot protections: rate limiting per IP, User‑Agent scrutiny, and lightweight JavaScript checks that can block raw HTTP requests. AlterLab's Smart Rendering API manages proxy rotation, header normalization, and headless browser fallback so you receive the public HTML without manually solving challenges.

99.2%Success Rate
1.2sAvg Response
$0.002Per Request (T3)

Quick start with AlterLab API

See the Getting started guide for SDK installation. Below are ready‑to‑run examples for Python and Node.js.

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")
response = client.scrape("https://www.viator.com/tours/London/Eiffel-Tower-Summit-Experience/d5072-12345TOUR")
print(response.text[:500])
JAVASCRIPT
import { AlterLab } from "alterlab";

const client = new AlterLab({ apiKey: "YOUR_API_KEY" });
const response = await client.scrape("https://www.viator.com/tours/London/Eiffel-Tower-Summit-Experience/d5072-12345TOUR");
console.log(response.text.slice(0, 500));
Bash
curl -X POST https://api.alterlab.io/v1/scrape \
  -H "X-API-Key: YOUR_KEY" \
  -d '{"url": "https://www.viator.com/tours/London/Eiffel-Tower-Summit-Experience/d5072-12345TOUR"}'

These snippets retrieve the raw HTML of a public tour page. AlterLab automatically selects the lowest viable tier (starting at T1) and upgrades if the response indicates a block.

Extracting structured data

Once you have the HTML, you can parse visible fields with CSS selectors. Common Viator data points include:

  • Tour title (h1.tour-title)
  • Price (span.price)
  • Average rating (div.rating-stars)
  • Description (div.description)

In Python with BeautifulSoup:

Python
from bs4 import BeautifulSoup
soup = BeautifulSoup(response.text, "html.parser")
title = soup.select_one("h1.tour-title").get_text(strip=True)
price = float(soup.select_one("span.price").get_text(strip=True).replace("$", ""))
rating = float(soup.select_one("div.rating-stars")["data-rating"])
description = soup.select_one("div.description").get_text(strip=True)
print({"title": title, "price": price, "rating": rating, "description": description})

Node.js equivalent with Cheerio:

JAVASCRIPT
import cheerio from "cheerio";
const $ = cheerio.load(response.text);
const title = $("h1.tour-title").text().trim();
const price = parseFloat($("span.price").text().replace("$", ""));
const rating = parseFloat($("div.rating-stars").attr("data-rating"));
const description = $("div.description").text().trim();
console.log({ title, price, rating, description });

Structured JSON extraction with Cortex

AlterLab's Cortex API returns typed JSON directly, eliminating the need for local parsing. Provide a JSON Schema that matches the fields you want.

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")
result = client.extract(
    url="https://www.viator.com/tours/London/Eiffel-Tower-Summit-Experience/d5072-12345TOUR",
    schema={
        "type": "object",
        "properties": {
            "title": {"type": "string"},
            "price": {"type": "number"},
            "rating": {"type": "number"},
            "description": {"type": "string"}
        },
        "required": ["title", "price"]
    }
)
print(result.data)  # Typed JSON output

Cortex handles JavaScript rendering and anti‑bot challenges internally, delivering consistent structured output.

Cost breakdown

AlterLab's pricing is usage‑based. The table below shows the cost per request and per 1,000 requests for each tier. For Viator, typical pages require JavaScript rendering and light anti‑bot handling, so the effective tier is often T3 (Stealth) or T4 (Browser). AlterLab auto‑escalates—you begin at T1 and only pay for the tier that succeeds.

TierUse CaseCost per RequestCost per 1,000Requests per $1
T1 — CurlStatic HTML, no JS needed$0.0002$0.205,000
T2 — HTTPStandard pages with headers$0.0003$0.303,333
T3 — StealthProtected pages, anti-bot active$0.002$2.00500
T4 — BrowserFull JS rendering required$0.004$4.00250
T5 — CAPTCHACAPTCHA solving + JS rendering$0.02$20.0050

See the AlterLab pricing page for the latest rates and volume discounts.

Best practices

  • Rate limiting: Start with one request per second per IP; adjust based on response headers.
  • Robots.txt: Check https://www.viator.com/robots.txt for disallowed paths before scaling.
  • Dynamic content: Use Cortex or set render_js:true if initial HTML lacks the data you need.
  • Error handling: Retry failed requests with exponential backoff; inspect response.status for tier‑specific hints.
  • Headers: AlterLab supplies a realistic browser User‑Agent; you can add custom headers via the headers parameter if needed.

Scaling up

For large datasets:

  • Batch requests: Send up to 100 URLs per batch using the /v1/scrape/batch endpoint to reduce overhead.
  • Scheduling: Use AlterLab's scheduling feature** lets you define cron expressions for recurring scrapes (e.g., daily price checks).
  • Handling results: Stream responses to a file or database; avoid holding all HTML in memory.
  • Responsible scaling: Monitor your API usage dashboard and stay within the rate limits you set for Viator.

Key takeaways

  • AlterLab abstracts anti‑bot complexity with
Share

Was this article helpful?

Frequently Asked Questions

Scraping publicly accessible data is generally permissible under precedents like hiQ v LinkedIn, but you must review Viator's robots.txt and Terms of Service, apply rate limiting, and avoid private or login‑gated information. Users bear responsibility for compliance.
Viator employs standard anti‑bot measures such as request rate limits, header checks, and occasional JavaScript challenges. AlterLab's Smart Rendering API automatically handles proxy rotation, header management, and browser rendering to maintain reliable access.
Costs range from $0.0002 per request for static HTML (T1) up to $0.004 per request for full JavaScript rendering (T4). AlterLab auto‑escalates tiers—you only pay for the tier that succeeds—so a typical Viator scrape averages around $0.002/request.