Skip to content

PRO100CHOK/tripadvisor-hotels-reviews-scraper-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TripAdvisor Hotels, Restaurants, Attractions & Reviews Scraper — Python Example

Pull hotels, restaurants, attractions, and customer reviews from TripAdvisor in Python — by city, search keyword, or direct URL. Built for hospitality competitive intelligence, travel-tech ingestion, restaurant analytics, and review-sentiment research.

Apify Actor Python 3.10+ License: MIT

Working Python project around the TripAdvisor All-in-One Scraper Apify actor — three discovery modes (by direct URL, by free-text search keyword, or by city + category), and one unified output schema across hotels, restaurants, and attractions. Add includeReviews: true to embed up to N reviews per place. Pay-per-event pricing: $3.50 per 1,000 places, $0.50 per 1,000 reviews.

What this does

TripAdvisor sells access to its Content API for $1,500+/month with strict per-call quotas; the API doesn't return individual reviews, only aggregated ratings. The public-facing UI shows everything but is JavaScript-rendered and gated behind a heavy bot-detection layer. Generic scrapers get blocked within ~50 requests.

This actor handles the TripAdvisor bot bypass via residential proxies + rotating session fingerprints, paginates the listing/detail endpoints, and returns one flat record per place with everything — name, address, geolocation, ratings, star class (hotels), price range, photos, hours, and optionally a configurable number of recent reviews per place. Single unified schema for hotels, restaurants, and attractions makes downstream ETL trivial.

Use cases

  • Hotel competitive set monitoring — daily snapshot of every hotel in your market with their TripAdvisor ranking, score, and review count.
  • Restaurant analytics platforms — bulk ingest of new restaurant listings + reviews for cities you cover.
  • OTA / metasearch QA — verify your inventory matches TripAdvisor's canonical listings.
  • Hospitality M&A diligence — pull every hotel in a target portfolio's markets with historical review velocity.
  • Travel-content sites — generate "Top 25 hotels in [city]" pages from fresh TripAdvisor data.
  • Review-sentiment research — pull thousands of reviews for sentiment analysis or NLP training datasets.
  • Tourism-board analytics — count POIs by category across destinations for tourism strategy.

Requirements

  • Python 3.10+
  • A free Apify account
  • No TripAdvisor Content API key required

Quick start

git clone https://github.com/pro100chok/tripadvisor-hotels-reviews-scraper-python.git
cd tripadvisor-hotels-reviews-scraper-python
pip install -r requirements.txt
cp .env.example .env
# paste your APIFY_API_TOKEN
python main.py

main.py pulls 50 Paris hotels with 10 reviews each, sorted by rating × review count. Edit the constants at the top of main.py to point at a different city or category.

Three discovery modes

mode Inputs Behavior
locations locations[] (city names or numeric TripAdvisor geo IDs) Walks the city's category listing — every hotel / restaurant / attraction. Best for bulk runs.
searchTerms searchTerms[] (free text) Resolves keyword via TripAdvisor typeahead, then walks each matched location.
startUrls startUrls[] (any TripAdvisor URL) Directly scrapes URLs you supply — hotel detail, attraction detail, listing pages, etc.

For locations and searchTerms, category chooses what to scrape inside each location: hotels, restaurants, attractions, or all.

How it works

  1. The actor takes your mode + inputs and resolves them through TripAdvisor's internal typeahead and listing endpoints.
  2. For each POI it visits the detail page and parses the unified record schema — name, address, lat/lng, rating, review count, ranking position, star class (hotels only), price range, photos, hours.
  3. If includeReviews: true, the actor paginates the place's review feed and embeds up to maxReviewsPerPoi reviews per record.
  4. All requests run through residential IPs with per-session fingerprint rotation. Block rate stays under 1% even at 10 parallel workers.

Example: Paris hotel competitive set

import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_API_TOKEN"])

run = client.actor("pro100chok/tripadvisor-all-in-one").call(run_input={
    "mode": "locations",
    "locations": ["Paris"],
    "category": "hotels",
    "includeReviews": True,
    "maxReviewsPerPoi": 5,
    "maxPois": 50,
})

for hotel in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{hotel['name']:<45}{hotel['rating']} ({hotel['reviewsCount']:,} reviews)")

Example output (hotel record)

{
  "name": "Hotel Example Paris",
  "type": "Hotel",
  "rating": 4.5,
  "reviewsCount": 1820,
  "rankingPosition": 32,
  "rankingString": "#32 of 1,853 hotels in Paris",
  "hotelClass": 4,
  "priceRange": "$220 - $480",
  "address": "12 Rue de Exemple, 75009 Paris, France",
  "location": { "lat": 48.8744, "lng": 2.3382 },
  "phone": "+33 1 23 45 67 89",
  "website": "https://hotel-example.example",
  "amenities": ["Free WiFi", "Restaurant", "Bar/Lounge", "24-hour front desk"],
  "reviews": [
    {
      "title": "Wonderful boutique stay",
      "rating": 5,
      "publishedDate": "2026-04-22",
      "userLocation": "London, UK",
      "text": "Charming hotel in a great Paris location..."
    }
  ]
}

Input parameters

Parameter Type Required Description
mode string yes locations, searchTerms, or startUrls.
locations string[] for locations City names or numeric TripAdvisor geo IDs.
searchTerms string[] for searchTerms Free-text keywords resolved via TripAdvisor's typeahead.
startUrls object[] for startUrls Direct TripAdvisor URLs.
category string for locations/searchTerms all, hotels, restaurants, attractions.
includeReviews boolean no Embed reviews per POI. Default false.
maxReviewsPerPoi integer no Cap on reviews per POI. Default 10.
maxPois integer no Cap on POIs pulled per location/keyword. Default 50.
maxItems integer no Hard cap on total dataset rows. 0 = unlimited. Default 10.
locale string no BCP-47 language tag (en-US, fr-FR, de-DE). Default en-US.
maxRetries integer no Retries per request. Default 5.
maxConcurrency integer no Parallel workers. Default 10.

More examples

File Demonstrates
examples/01_basic_usage.py Single-city attractions scrape.
examples/02_restaurants_with_reviews.py Rome restaurants with embedded reviews.
examples/03_specific_urls.py Direct-URL scrape of a hotel + an attraction.
examples/04_export_to_csv.py Multi-city hotel comp-set with pandas.
examples/05_export_to_google_sheets.py Daily ranking snapshot into a shared Sheet.

FAQ

How much does it cost? $3.50 per 1,000 POI records, $0.50 per 1,000 reviews. Apify's free $5 monthly covers ~1,400 POIs or ~10,000 reviews.

How is this different from the official TripAdvisor Content API? The Content API costs $1,500+/month with strict per-call limits, and it doesn't return individual reviews — only aggregated ratings. This actor returns the full place schema plus optional embedded reviews, with no monthly minimum.

Are reviews real and complete? Reviews are sorted by recency and paginated. You can pull up to ~hundreds per POI; TripAdvisor's UI exposes the full review history page-by-page, and the actor walks the pagination cursor. For very-high-traffic POIs (thousands of reviews), the actor will hit a practical timeout — consider running in batches with maxReviewsPerPoi: 100.

Can I get hotel availability + pricing? No. TripAdvisor doesn't publish real-time availability or pricing on its public site (that's served by partner OTAs through embedded widgets). For hotel rates, use an OTA scraper (Booking, Expedia) or a metasearch API.

Does it work in non-English locales? Yes. Set locale to your target language (fr-FR, de-DE, es-ES, ja-JP, pt-BR, etc.). The actor passes the locale to TripAdvisor for typeahead, listing labels, and review language.

What about Google's takeover of travel search — is TripAdvisor still relevant? TripAdvisor remains the dominant source for traveler reviews in many destinations (especially Europe) and has the deepest restaurant-review coverage outside the US. It's also still the canonical ranking source for hotels in many markets.

Can I monitor a single hotel's rank over time? Yes. Pin the hotel's TripAdvisor URL into startUrls and schedule daily/weekly runs. The actor stores rankingPosition and rankingString per snapshot — combine with Apify's scheduler.

Why use mode: "locations" over mode: "searchTerms"? locations resolves the city through typeahead and walks its dedicated category listing — cleaner pagination, more predictable POI counts. searchTerms is broader (matches both cities AND named POIs) but can produce mixed results.

Related actors

See all my actors at apify.com/pro100chok.

License

MIT — see LICENSE.


Built on top of the TripAdvisor All-in-One Scraper Apify actor.

Releases

No releases published

Packages

 
 
 

Contributors

Languages