Python से TripAdvisor स्क्रैप करें (बिना ब्लॉक हुए)

अंतिम अपडेट:April 17, 2026
Python से TripAdvisor स्क्रैप करें (बिना ब्लॉक हुए)

पिछले हफ्ते मैंने TripAdvisor से तीन यूरोपीय शहरों के करीब 200 होटलों की रेटिंग और रिव्यू काउंट निकालने की कोशिश की। मेरा पहला स्क्रिप्ट — एक बेसिक requests.get() जिसमें डिफ़ॉल्ट हेडर्स थे — हर रिक्वेस्ट पर 403 Forbidden लौटा। एक भी काम का बाइट डेटा नहीं मिला।

ट्रैवल इंडस्ट्री में TripAdvisor सबसे समृद्ध पब्लिक डेटा सोर्सेज़ में से एक है: 1 बिलियन से ज्यादा रिव्यू, 8+ मिलियन बिज़नेस लिस्टिंग्स, और लगभग 460 मिलियन यूनिक मासिक विज़िटर। यह सालाना ट्रैवल खर्च के 60 बिलियन डॉलर से भी ज़्यादा पर असर डालता है। लेकिन इसे प्रोग्रामेटिक तरीके से निकालना? यहीं बात मुश्किल हो जाती है। TripAdvisor में DataDome bot detection, Cloudflare WAF, TLS fingerprinting, और JavaScript challenges की मल्टी-लेयर सुरक्षा है, जो ज़्यादातर साधारण स्क्रैपिंग कोशिशों को शुरू होने से पहले ही रोक देती है। यह गाइड वही एक रिसोर्स है जो काश मुझे पहले मिला होता: तीन Python scraping approaches की सीधी तुलना (साथ में एक no-code विकल्प), हर तरीके का पूरा code, structured anti-bot troubleshooting सेक्शन, और reusable patterns जो hotels, restaurants, और attractions — सब पर काम आते हैं। चाहे आप Python beginner हों या अनुभवी developer, इससे आपके बहुत सारे बेकार 403 बचेंगे।

कोड नहीं लिखना चाहते? TripAdvisor स्क्रैप करने का आसान तरीका

मैं एक बात साफ़-साफ़ कहना चाहता हूँ। जो लोग "scrape TripAdvisor with Python" खोजते हैं, उनमें से बहुत से लोग सच में code लिखने के लिए तैयार नहीं होते। उन्हें बस डेटा चाहिए — होटल के नाम, रेटिंग, review count, prices — वो भी तेज़ी से spreadsheet में। अगर आप भी ऐसे हैं, तो आपके लिए इससे छोटा रास्ता है।

Thunderbit एक AI-powered Chrome extension है जिसे हमने बनाया है, जो किसी भी TripAdvisor page को पढ़ सकता है और अपने-आप सही columns सुझा सकता है। इसका workflow सच में सिर्फ दो clicks का है:

  1. TripAdvisor की listing page खोलें (जैसे "Hotels in Paris" search results)।
  2. Thunderbit sidebar में "AI Suggest Fields" पर क्लिक करें। AI page को scan करके Hotel Name, Rating, Review Count, Price, और Location जैसे columns सुझाता है।
  3. "Scrape" पर क्लिक करें। Thunderbit page पर मौजूद हर listing से डेटा निकालता है — और ज़रूरत हो तो pagination भी अपने-आप संभालता है।
  4. Excel, Google Sheets, Airtable, या Notion में export करें। हर plan में exports free हैं।

Thunderbit hotels, restaurants, और attractions — तीनों पर बिना किसी configuration change के काम करता है; AI page के हिसाब से अपने-आप adapt हो जाता है। Paginated results के लिए यह "Next" buttons और infinite scroll को auto-detect करता है। और क्योंकि यह आपके असली Chrome browser में चलता है, यह आपके session cookies और browser fingerprint को inherit करता है, जिससे bot detection के सामने इसे प्राकृतिक बढ़त मिलती है।

आप इसे Thunderbit Chrome Extension से आज़मा सकते हैं — free tier में 6 pages/month मिलते हैं, जो workflow test करने के लिए काफी है।

अगर आपको programmatic control, custom parsing logic, या 10,000+ pages scrape करने की योजना चाहिए, तो Python बेहतर विकल्प है। आगे पढ़ते रहिए।

TripAdvisor को Python से क्यों स्क्रैप करें?

TripAdvisor data का सीधा और measurable business impact होता है। Cornell University study के अनुसार, hotel के 100-point Global Review Index में 1-point की बढ़ोतरी average daily rate में 0.89% और Revenue Per Available Room में 1.42% की बढ़ोतरी लाती है। एक अलग ScienceDirect study में दिखाया गया कि TripAdvisor rating में exogenous 1-star बढ़ोतरी average hotel के लिए सालाना $55,000–$75,000 अतिरिक्त revenue में बदल सकती है। यानी reviews सिर्फ़ दिखावे के metrics नहीं हैं — वे revenue driver हैं।

अलग-अलग टीमें TripAdvisor data का इस तरह इस्तेमाल करती हैं:

Use Caseकिसे फायदाज़रूरी डेटा
होटल competitor analysisHotel chains, revenue managersRatings, prices, review volume, amenities
Restaurant market researchRestaurant groups, food brandsCuisine types, price ranges, review sentiment
Attraction trend trackingTour operators, tourism boardsPopularity rankings, seasonal patterns
Sentiment analysisResearchers, data analystsFull review text, star ratings, dates
Lead generationSales teams, travel agenciesBusiness names, contact info, locations

Python ही क्यों? तीन वजहें। पहली, इसका ecosystem: BeautifulSoup, Selenium, Playwright, Scrapy, httpx, pandas — scraping और data analysis के लिए Python की libraries सबसे mature हैं। दूसरी, 71.7% web scraping developers Python का इस्तेमाल करते हैं, यानी community support ज़्यादा, StackOverflow answers ज़्यादा, और up-to-date guides भी ज़्यादा। तीसरी, pipeline advantage: आप BeautifulSoup से scrape कर सकते हैं, pandas से clean कर सकते हैं, Hugging Face Transformers से sentiment analysis चला सकते हैं, और dashboards बना सकते हैं — सब एक ही भाषा में। Context switching नहीं।

Python से TripAdvisor स्क्रैप करने के तीन तरीके (तुलना सहित)

अधिकतर प्रतिस्पर्धी गाइड सिर्फ़ एक तरीका चुनते हैं और उसी पर टिक जाते हैं। लेकिन जब आप code लिखने से पहले फैसला कर रहे हों, तब यह मददगार नहीं होता। यह है वो comparison table जो काश किसी ने मुझे पहले दी होती:

ApproachSpeedJS SupportAnti-Bot ResistanceComplexityBest For
requests + BeautifulSoup⚡ तेज़ (~120–200 pages/min raw)❌ नहीं⚠️ कमआसानStatic listing pages, छोटे projects
Selenium / Headless Browser🐢 धीमा (~8–20 pages/min)✅ पूरा⚠️ मध्यममध्यमDynamic content, "Read more" clicks, cookie banners
Hidden JSON / GraphQL API⚡⚡ सबसे तेज़ (~200–600 pages/min raw)N/A✅ बेहतरकठिनबड़े पैमाने पर review/hotel extraction
No-code (Thunderbit)⚡ तेज़✅ built-in✅ built-inसबसे आसानNon-devs, quick one-off exports

कुछ ज़रूरी caveats। ये raw speeds theoretical हैं — TripAdvisor की rate limits (~10–15 requests per minute per IP) असल throughput को किसी भी approach में लगभग 10 pages/minute per IP तक सीमित कर देती हैं। Hidden JSON method हर request में सबसे ज़्यादा data देती है, इसलिए total requests कम होते हैं और rate limiting का जोखिम भी कम रहता है। Selenium, real-world benchmarks में request-based approaches से 5x धीमा है, लेकिन जब buttons click करने हों या JavaScript render करनी हो, तब यही विकल्प काम आता है।

इस गाइड का बाकी हिस्सा इन तीनों Python methods को complete code के साथ समझाता है। जो आपकी स्थिति से मेल खाए, उसे चुनिए — या इन्हें मिलाकर इस्तेमाल कीजिए (मैं अक्सर listing pages के लिए requests+BS4 और detail pages के लिए hidden JSON use करता हूँ)।

अपना Python Environment तैयार करना

आगे बढ़ने से पहले environment तैयार कर लेते हैं। आपको Python 3.10+ चाहिए होगा (मैं 3.12 या 3.13 recommend करूँगा — सभी major packages इन्हें support करते हैं और कोई known issue नहीं है)।

सब कुछ एक साथ install करें:

pip install requests beautifulsoup4 selenium httpx parsel pandas curl-cffi

Package notes:

  • requests (2.33.1) — HTTP requests, Python 3.10+ चाहिए
  • beautifulsoup4 (4.14.3) — HTML parsing
  • selenium (4.43.0) — Browser automation, Python 3.10+ चाहिए
  • httpx (0.28.1) — Async HTTP client
  • parsel (1.11.0) — CSS/XPath selectors (BS4 से हल्का)
  • pandas (3.0.2) — Data export, Python 3.11+ चाहिए
  • curl_cffi (0.15.0) — TLS fingerprint impersonation (Cloudflare bypass के लिए अहम)

ChromeDriver: अगर आप Selenium इस्तेमाल कर रहे हैं, तो अच्छी खबर — Selenium 4.6+ के बाद Selenium Manager सही ChromeDriver binary अपने-आप download और cache कर देता है। Manual installation की ज़रूरत नहीं। Version matching भी dynamically resolve हो जाता है, इसलिए Chrome version mismatch की चिंता नहीं करनी पड़ती।

Virtual environment (recommended):

python -m venv tripadvisor-scraper
source tripadvisor-scraper/bin/activate  # macOS/Linux
tripadvisor-scraper\Scripts\activate     # Windows

Approach 1: Requests और BeautifulSoup से TripAdvisor स्क्रैप करें

यह सबसे आसान तरीका है। यह listing pages (hotel search results, restaurant lists) के लिए अच्छा काम करता है, जहाँ आपको चाहिए डेटा static HTML में मौजूद होता है। Browser नहीं, JavaScript rendering नहीं, और resource usage भी कम।

TripAdvisor URL Patterns समझना

TripAdvisor URLs category के हिसाब से predictable patterns follow करते हैं:

  • Hotels: https://www.tripadvisor.com/Hotels-g{locationId}-{Location_Name}-Hotels.html
  • Restaurants: https://www.tripadvisor.com/Restaurants-g{locationId}-{Location_Name}.html
  • Attractions: https://www.tripadvisor.com/Attractions-g{locationId}-Activities-{Location_Name}.html

Pagination में oa (offset anchors) parameter इस्तेमाल होता है, जो URL में जोड़ा जाता है। हर page पर 30 results दिखते हैं:

  • Page 1: base URL (कोई oa parameter नहीं)
  • Page 2: Hotels-g187768-oa30-Italy-Hotels.html
  • Page 3: Hotels-g187768-oa60-Italy-Hotels.html

Review pages के लिए offset parameter or होता है, और बढ़ोतरी 10 की होती है:

  • Page 1: Reviews-or0-Hotel_Name.html
  • Page 2: Reviews-or10-Hotel_Name.html

सभी भाषाओं के reviews पाने के लिए URL में ?filterLang=ALL जोड़ दें।

Realistic Headers के साथ Requests भेजना

TripAdvisor headers को काफी सख़्ती से check करता है। Default Python headers वाली request तुरंत block हो जाती है। आपको real Chrome browser की नकल करनी होगी:

import requests
import time
import random

session = requests.Session()

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
    "Accept-Language": "en-US,en;q=0.9",
    "Accept-Encoding": "gzip, deflate, br",
    "Referer": "https://www.tripadvisor.com/",
    "Sec-Fetch-Dest": "document",
    "Sec-Fetch-Mode": "navigate",
    "Sec-Fetch-Site": "none",
    "Sec-CH-UA": '"Google Chrome";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
    "Sec-CH-UA-Mobile": "?0",
    "Sec-CH-UA-Platform": '"Windows"',
}

session.headers.update(headers)

url = "https://www.tripadvisor.com/Hotels-g187147-Paris_Ile_de_France-Hotels.html"
response = session.get(url)

print(f"Status: {response.status_code}")
print(f"Content length: {len(response.text)} characters")

Key detail: TripAdvisor आपके User-Agent और Sec-CH-UA Client Hints headers की consistency validate करता है। अगर आप User-Agent में Chrome 135 बताकर Sec-CH-UA में Chrome 120 लिखेंगे, तो आप flag हो सकते हैं। हमेशा individual headers नहीं, पूरे header set को एक साथ rotate करें।

BeautifulSoup से Listings parse करना

सफल response मिलने के बाद BeautifulSoup से data निकालें। TripAdvisor data-automation और data-test-attribute attributes इस्तेमाल करता है, जो CSS class names से ज़्यादा stable होते हैं (class names अक्सर बदलते रहते हैं):

from bs4 import BeautifulSoup

soup = BeautifulSoup(response.text, "html.parser")

# सभी hotel listing cards ढूँढें
cards = soup.select('div[data-test-attribute="location-results-card"]')

hotels = []
for card in cards:
    # Hotel name
    title_el = card.select_one('div[data-automation="hotel-card-title"]')
    name = title_el.get_text(strip=True) if title_el else None

    # Detail page link
    link_el = card.select_one('div[data-automation="hotel-card-title"] a')
    link = "https://www.tripadvisor.com" + link_el["href"] if link_el else None

    # Rating
    rating_el = card.select_one('[data-automation="bubbleRatingValue"]')
    rating = rating_el.get_text(strip=True) if rating_el else None

    # Review count
    review_el = card.select_one('[data-automation="bubbleReviewCount"]')
    review_count = review_el.get_text(strip=True).replace(",", "").split()[0] if review_el else None

    hotels.append({
        "name": name,
        "rating": rating,
        "review_count": review_count,
        "url": link,
    })

print(f"इस page पर {len(hotels)} hotels मिले")
for h in hotels[:3]:
    print(h)

Selectors पर एक नोट: TripAdvisor obfuscated CSS class names (जैसे FGwzt, yyzcQ) इस्तेमाल करता है, जो site update के साथ बदल जाते हैं। data-automation और data-test-target attributes कहीं ज़्यादा स्थिर होते हैं। हमेशा class names की बजाय data attributes को प्राथमिकता दें।

Pagination को संभालना

कई pages scrape करने के लिए requests के बीच polite delay रखते हुए offset parameter पर loop चलाएँ:

import pandas as pd

all_hotels = []
base_url = "https://www.tripadvisor.com/Hotels-g187147-oa{offset}-Paris_Ile_de_France-Hotels.html"

for page in range(5):  # पहले 5 pages
    offset = page * 30
    url = base_url.format(offset=offset) if page > 0 else "https://www.tripadvisor.com/Hotels-g187147-Paris_Ile_de_France-Hotels.html"

    response = session.get(url)
    if response.status_code != 200:
        print(f"Page {page + 1}: status {response.status_code} मिला, रुक रहे हैं।")
        break

    soup = BeautifulSoup(response.text, "html.parser")
    cards = soup.select('div[data-test-attribute="location-results-card"]')

    for card in cards:
        title_el = card.select_one('div[data-automation="hotel-card-title"]')
        name = title_el.get_text(strip=True) if title_el else None
        rating_el = card.select_one('[data-automation="bubbleRatingValue"]')
        rating = rating_el.get_text(strip=True) if rating_el else None
        review_el = card.select_one('[data-automation="bubbleReviewCount"]')
        review_count = review_el.get_text(strip=True).replace(",", "").split()[0] if review_el else None

        all_hotels.append({"name": name, "rating": rating, "review_count": review_count})

    print(f"Page {page + 1}: {len(cards)} hotels मिले")
    time.sleep(random.uniform(3, 7))  # Rate limiting से बचने के लिए random delay

df = pd.DataFrame(all_hotels)
print(f"\nकुल scraped hotels: {len(df)}")

time.sleep(random.uniform(3, 7)) बहुत ज़रूरी है। TripAdvisor की rate limit threshold लगभग 10–15 requests per minute per IP है। इससे तेज़ जाने पर CAPTCHA या 429 errors आ सकती हैं।

इस Approach की सीमाएँ

यह तरीका कहाँ fail करता है? Requests+BS4 तब टूटता है जब:

  • TripAdvisor JavaScript-rendered content भेजता है (कुछ search result pages JS मांगती हैं)
  • Review text "Read more" buttons के पीछे truncated होता है
  • Anti-bot protection JavaScript challenges या CAPTCHAs तक escalate हो जाती है
  • आपको ऐसा डेटा चाहिए जो केवल client-side rendering के बाद दिखाई देता है (prices, availability)

इन मामलों में आपको या तो Selenium (Approach 2) चाहिए या hidden JSON method (Approach 3)।

Approach 2: Selenium से TripAdvisor स्क्रैप करें (Headless Browser)

Selenium एक असली browser launch करता है, इसलिए यह JavaScript render कर सकता है, buttons click कर सकता है, cookie consent banners handle कर सकता है, और dynamic content के साथ interact कर सकता है। कीमत: यह लगभग 5x धीमा है और हर browser instance के लिए 300–500MB RAM लेता है।

Anti-Detection Settings के साथ Selenium configure करना

Out of the box Selenium आसानी से detect हो जाता है। TripAdvisor की fingerprinting इसे तुरंत पकड़ लेती है। आपको automation flags disable करने होंगे:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

options = Options()
options.add_argument("--headless=new")  # नया headless mode इस्तेमाल करें (Chrome 112+)
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--window-size=1920,1080")
options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)

driver = webdriver.Chrome(options=options)

# navigator से webdriver property हटाएँ
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
    "source": "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})"
})

क्या यह TripAdvisor के लिए पर्याप्त है? छोटे पैमाने की scraping (50 pages से कम) के लिए, यह setup residential proxies के साथ आमतौर पर काम करता है। बड़े volumes के लिए आपको undetected-chromedriver या nodriver की ज़रूरत पड़ सकती है — TripAdvisor का DataDome protection प्रति request 1,000 से ज़्यादा signals analyze करता है, जिनमें TLS fingerprints भी शामिल हैं जिन्हें vanilla Selenium spoof नहीं कर पाता।

Selenium से Hotel Search Results scrape करना

import time
import random

url = "https://www.tripadvisor.com/Hotels-g187147-Paris_Ile_de_France-Hotels.html"
driver.get(url)

# Hotel cards load होने का इंतज़ार करें
wait = WebDriverWait(driver, 15)
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'div[data-test-attribute="location-results-card"]')))

# Cookie consent popup को handle करें (अगर दिखाई दे)
try:
    cookie_btn = driver.find_element(By.ID, "onetrust-accept-btn-handler")
    cookie_btn.click()
    time.sleep(1)
except:
    pass  # कोई cookie popup नहीं

# Hotel data निकालें
cards = driver.find_elements(By.CSS_SELECTOR, 'div[data-test-attribute="location-results-card"]')

hotels = []
for card in cards:
    try:
        name = card.find_element(By.CSS_SELECTOR, 'div[data-automation="hotel-card-title"]').text
    except:
        name = None
    try:
        rating = card.find_element(By.CSS_SELECTOR, '[data-automation="bubbleRatingValue"]').text
    except:
        rating = None
    try:
        reviews = card.find_element(By.CSS_SELECTOR, '[data-automation="bubbleReviewCount"]').text
    except:
        reviews = None

    hotels.append({"name": name, "rating": rating, "review_count": reviews})

print(f"{len(hotels)} hotels scraped हुए")
for h in hotels[:3]:
    print(h)

मेरी मशीन पर एक page के लिए इसमें लगभग 8 seconds लगे — जबकि requests+BS4 में 1 second से भी कम। जब आप सैकड़ों pages scrape कर रहे हों, तो यह 8x अंतर बहुत जल्दी बढ़ जाता है।

"Read More" खोलकर पूरी Reviews scrape करना

Review pages लंबी reviews को "Read more" button के पीछे truncate कर देती हैं। Selenium इसे click कर सकता है:

review_url = "https://www.tripadvisor.com/Hotel_Review-g187147-d188726-Reviews-Le_Marais_Hotel-Paris_Ile_de_France.html"
driver.get(review_url)

wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'div[data-reviewid]')))
time.sleep(2)

# सभी "Read more" buttons पर click करें
read_more_buttons = driver.find_elements(By.XPATH, '//button//*[contains(text(), "Read more")]/..')
for btn in read_more_buttons:
    try:
        driver.execute_script("arguments[0].click();", btn)
        time.sleep(0.3)
    except:
        pass

# Reviews निकालें
review_elements = driver.find_elements(By.CSS_SELECTOR, 'div[data-reviewid]')

reviews = []
for rev in review_elements:
    try:
        title = rev.find_element(By.CSS_SELECTOR, 'div[data-test-target="review-title"]').text
    except:
        title = None
    try:
        body = rev.find_element(By.CSS_SELECTOR, 'q.IRsGHoPm span').text
    except:
        try:
            body = rev.find_element(By.CSS_SELECTOR, 'p.partial_entry').text
        except:
            body = None
    try:
        rating_class = rev.find_element(By.CSS_SELECTOR, 'div[data-test-target="review-rating"] span').get_attribute("class")
        # Rating class में encode होता है, जैसे "ui_bubble_rating bubble_50" = 5.0
        rating_num = [c for c in rating_class.split() if "bubble_" in c][0].replace("bubble_", "")
        rating = int(rating_num) / 10
    except:
        rating = None

    reviews.append({"title": title, "body": body, "rating": rating})

print(f"{len(reviews)} reviews scraped हुईं")

Selenium में Proxy Rotation जोड़ना

लगातार scraping के लिए proxy rotation चाहिए होगी। क्योंकि selenium-wire जनवरी 2024 से deprecated है, Chrome की built-in proxy support इस्तेमाल करें:

# बिना authentication वाले proxy के साथ
proxy = "http://your-proxy-address:port"
options.add_argument(f"--proxy-server={proxy}")

# Authentication वाले proxies के लिए Chrome extension या Selenium 4 के BiDi protocol का इस्तेमाल करें

Programmatically rotating proxies के लिए हर batch of requests पर अलग proxy के साथ नया driver instance बनाइए। यह elegant नहीं है, लेकिन reliable है।

Approach 3: Hidden JSON Method (HTML Parsing को पूरी तरह छोड़ दें)

ज़्यादातर गाइड इस approach को पूरी तरह छोड़ देती हैं, जबकि यह तीनों में सबसे तेज़ और साफ़ तरीका है। TripAdvisor अपने HTML pages में structured data सीधे JSON के रूप में embed करता है — <script> tags के अंदर pageManifest और urqlCache जैसी JavaScript variables में। यह JSON निकालने से आपको cleaner data (जैसे ratings numbers में, dates ISO format में) मिलता है, requests भी कम लगती हैं, और JavaScript rendering की ज़रूरत नहीं पड़ती।

Page Source में Embedded JSON ढूँढना

मुख्य बात यह है: आप एक साधारण requests.get() से page fetch कर सकते हैं, फिर raw HTML से JSON निकाल सकते हैं — बिना JavaScript render किए।

import requests
import re
import json

headers = {
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
    "Accept-Language": "en-US,en;q=0.9",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    "Referer": "https://www.tripadvisor.com/",
    "Sec-CH-UA": '"Google Chrome";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
    "Sec-CH-UA-Mobile": "?0",
    "Sec-CH-UA-Platform": '"macOS"',
}

url = "https://www.tripadvisor.com/Hotel_Review-g188590-d194317-Reviews-NH_City_Centre_Amsterdam.html"
response = requests.get(url, headers=headers)

# pageManifest JSON blob निकालें
match = re.search(r"pageManifest:({.+?})};", response.text)
if match:
    page_data = json.loads(match.group(1))
    print("pageManifest data मिल गई")
    print(f"Keys: {list(page_data.keys())[:10]}")

Variable name खुद कैसे ढूँढें: किसी भी TripAdvisor hotel page को Chrome में खोलें, right-click → View Page Source, फिर pageManifest या urqlCache या aggregateRating के लिए Ctrl+F करें। डेटा वहीं मौजूद है, बस parse होने का इंतज़ार कर रहा है।

JSON parse करके Structured Data निकालना

TripAdvisor application/ld+json schema.org data भी embed करता है, और यह निकालना और भी आसान है:

from parsel import Selector

sel = Selector(text=response.text)

# JSON-LD structured data निकालें
json_ld_scripts = sel.xpath("//script[@type='application/ld+json']/text()").getall()

for script in json_ld_scripts:
    data = json.loads(script)
    if isinstance(data, dict) and data.get("@type") in ["Hotel", "Restaurant", "TouristAttraction"]:
        print(f"Name: {data.get('name')}")
        print(f"Rating: {data.get('aggregateRating', {}).get('ratingValue')}")
        print(f"Review Count: {data.get('aggregateRating', {}).get('reviewCount')}")
        print(f"Price Range: {data.get('priceRange')}")
        print(f"Address: {data.get('address', {}).get('streetAddress')}")
        print(f"Coordinates: {data.get('geo', {}).get('latitude')}, {data.get('geo', {}).get('longitude')}")
        break

JSON-LD data static HTML में embedded होता है और JavaScript rendering की ज़रूरत नहीं होती। इससे आपको property name, aggregate rating, review count, address, coordinates, price range, और photo URLs तक मिल जाते हैं — बिना एक भी HTML tag parse किए।

ज़्यादा rich data के लिए (individual reviews, rating breakdowns, amenity lists) आपको urqlCache object चाहिए:

# विस्तृत review data के लिए urqlCache निकालें
cache_match = re.search(r'"urqlCache"\s*:\s*({.+?})\s*,\s*"redux"', response.text)
if cache_match:
    cache_data = json.loads(cache_match.group(1))
    # review data ढूँढने के लिए cache traverse करें
    for key, value in cache_data.items():
        if "reviews" in str(value).lower()[:100]:
            reviews_data = json.loads(value.get("data", "{}")) if isinstance(value, dict) else None
            if reviews_data:
                print(f"Review cache entry मिली: {key[:50]}...")
                break

Exact JSON paths TripAdvisor frontend update के साथ कभी-कभी बदलते हैं, लेकिन सामान्य structure — summary data के लिए JSON-LD, detailed data के लिए urqlCache — वर्षों से काफ़ी स्थिर रहा है।

TripAdvisor के GraphQL API को Reverse-Engineer करना (Advanced)

बड़े पैमाने पर extraction के लिए TripAdvisor के GraphQL endpoints सीधे structured data लौटाते हैं। यह सबसे तेज़ तरीका है, लेकिन maintenance भी सबसे ज़्यादा माँगता है।

import httpx
import random
import string

def generate_request_id():
    """X-Requested-By header value generate करें"""
    random_chars = ''.join(random.choices(string.ascii_letters + string.digits, k=180))
    return f"TNI1625!{random_chars}"

# Paris में hotels खोजें
search_payload = [{
    "variables": {
        "request": {
            "query": "hotels in Paris",
            "limit": 10,
            "scope": "WORLDWIDE",
            "locale": "en-US",
            "scopeGeoId": 1,
            "searchCenter": None,
            "types": ["LOCATION", "QUERY_SUGGESTION", "RESCUE_RESULT"],
            "locationTypes": ["GEO", "AIRPORT", "ACCOMMODATION", "ATTRACTION", "EATERY", "NEIGHBORHOOD"]
        }
    },
    "extensions": {
        "preRegisteredQueryId": "84b17ed122fbdbd4"
    }
}]

graphql_headers = {
    "Content-Type": "application/json",
    "Accept": "*/*",
    "Accept-Language": "en-US,en;q=0.9",
    "Origin": "https://www.tripadvisor.com",
    "Referer": "https://www.tripadvisor.com/Hotels",
    "X-Requested-By": generate_request_id(),
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
}

with httpx.Client() as client:
    response = client.post(
        "https://www.tripadvisor.com/data/graphql/ids",
        json=search_payload,
        headers=graphql_headers
    )
    if response.status_code == 200:
        results = response.json()
        print(json.dumps(results, indent=2)[:1000])
    else:
        print(f"GraphQL request failed: {response.status_code}")

Reviews fetch करने के लिए GraphQL:

review_payload = [{
    "variables": {
        "locationId": 194317,  # NH City Centre Amsterdam
        "offset": 0,
        "limit": 20,
        "filters": {},
        "sortType": None,
        "sortBy": "date",
        "language": "en",
        "doMachineTranslation": False,
        "photosPerReviewLimit": 3
    },
    "extensions": {
        "preRegisteredQueryId": "ef1a9f94012220d3"
    }
}]

with httpx.Client() as client:
    response = client.post(
        "https://www.tripadvisor.com/data/graphql/ids",
        json=review_payload,
        headers=graphql_headers
    )
    if response.status_code == 200:
        data = response.json()
        reviews = data[0]["data"]["locations"][0]["reviewListPage"]["reviews"]
        total = data[0]["data"]["locations"][0]["reviewListPage"]["totalCount"]
        print(f"कुल reviews: {total}")
        for r in reviews[:3]:
            print(f"  [{r['rating']}/5] {r['title']} - {r['createdDate']}")

महत्वपूर्ण caveat: preRegisteredQueryId values (जैसे search के लिए 84b17ed122fbdbd4 और reviews के लिए ef1a9f94012220d3) TripAdvisor के redeploy करने पर टूट सकते हैं। तब आपकी requests चुपचाप fail हो जाएँगी। ऐसे में browser DevTools में network requests monitor करके query IDs फिर से ढूँढनी पड़ेंगी।

यह Method Proxies की ज़रूरत क्यों कम करता है

गणित आसान है। Requests+BS4 के साथ 100 hotel detail pages scrape करने के लिए 100 requests चाहिए। Hidden JSON method में हर request एक ही page load से ज़रूरी सारा data दे देती है — reviews expand करने या dynamic content लोड करने के लिए अलग requests नहीं लगतीं। GraphQL के साथ एक API call में 20 reviews तक मिल सकते हैं। कम requests = rate limiting का कम जोखिम = proxy rotation की कम ज़रूरत। छोटे से मध्यम projects (1,000 pages से कम) के लिए, sensible delays जोड़ दें तो proxies की ज़रूरत भी नहीं पड़ सकती।

एक Reusable Script से Hotels, Restaurants, और Attractions Scrape करें

पाँच में से चार competing guides सिर्फ़ hotels पर ही रुक जाती हैं। लेकिन TripAdvisor में तीन core content categories हैं, और URL patterns तथा data fields category के हिसाब से बदलते हैं। यहाँ एक ऐसा function है जो तीनों को संभाल सकता है।

हर Category में उपलब्ध Data Fields

FieldHotelsRestaurantsAttractions
Name
Rating
Review count
Price/Price rangeकभी-कभी
Address
Cuisine type
Duration/Tour type
Amenities
Coordinates

Reusable scrape_tripadvisor() Function बनाना

import requests
from bs4 import BeautifulSoup
import pandas as pd
import time
import random
import re
import json

def scrape_tripadvisor(category, location_id, location_name, num_pages=3):
    """
    TripAdvisor पर hotels, restaurants, या attractions scrape करें।

    Args:
        category: "hotels", "restaurants", या "attractions"
        location_id: TripAdvisor geo ID (जैसे Paris के लिए "187147")
        location_name: URL-friendly name (जैसे "Paris_Ile_de_France")
        num_pages: कितने pages scrape करने हैं
    """
    url_patterns = {
        "hotels": "https://www.tripadvisor.com/Hotels-g{geo}-oa{offset}-{name}-Hotels.html",
        "restaurants": "https://www.tripadvisor.com/Restaurants-g{geo}-oa{offset}-{name}.html",
        "attractions": "https://www.tripadvisor.com/Attractions-g{geo}-oa{offset}-Activities-{name}.html",
    }

    first_page_patterns = {
        "hotels": "https://www.tripadvisor.com/Hotels-g{geo}-{name}-Hotels.html",
        "restaurants": "https://www.tripadvisor.com/Restaurants-g{geo}-{name}.html",
        "attractions": "https://www.tripadvisor.com/Attractions-g{geo}-Activities-{name}.html",
    }

    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "Accept-Language": "en-US,en;q=0.9",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
        "Referer": "https://www.tripadvisor.com/",
        "Sec-CH-UA": '"Google Chrome";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
        "Sec-CH-UA-Mobile": "?0",
        "Sec-CH-UA-Platform": '"Windows"',
    }

    session = requests.Session()
    session.headers.update(headers)

    all_items = []

    for page in range(num_pages):
        offset = page * 30
        if page == 0:
            url = first_page_patterns[category].format(geo=location_id, name=location_name)
        else:
            url = url_patterns[category].format(geo=location_id, offset=offset, name=location_name)

        response = session.get(url)
        if response.status_code != 200:
            print(f"  Page {page + 1}: Status {response.status_code}, stopping.")
            break

        soup = BeautifulSoup(response.text, "html.parser")
        cards = soup.select('div[data-test-attribute="location-results-card"]')

        for card in cards:
            item = {"category": category}
            title_el = card.select_one('div[data-automation="hotel-card-title"]') or card.select_one('a[data-automation]')
            item["name"] = title_el.get_text(strip=True) if title_el else None
            rating_el = card.select_one('[data-automation="bubbleRatingValue"]')
            item["rating"] = rating_el.get_text(strip=True) if rating_el else None
            review_el = card.select_one('[data-automation="bubbleReviewCount"]')
            item["review_count"] = review_el.get_text(strip=True) if review_el else None
            all_items.append(item)

        print(f"  Page {page + 1}: {len(cards)} items मिले")
        time.sleep(random.uniform(3, 7))

    return pd.DataFrame(all_items)

# Usage examples
print("=== Paris में Hotels ===")
hotels_df = scrape_tripadvisor("hotels", "187147", "Paris_Ile_de_France", num_pages=2)
print(hotels_df.head())

print("\n=== Rome में Restaurants ===")
restaurants_df = scrape_tripadvisor("restaurants", "187791", "Rome_Lazio", num_pages=2)
print(restaurants_df.head())

print("\n=== Barcelona में Attractions ===")
attractions_df = scrape_tripadvisor("attractions", "187497", "Barcelona_Catalonia", num_pages=2)
print(attractions_df.head())

एक function, तीन categories, zero code duplication। अगर TripAdvisor कोई selector बदलता है, तो आपको सिर्फ़ एक ही जगह fix करना है।

TripAdvisor Block करे तो क्या करें (Anti-Bot Troubleshooting)

यह वह section है जिसकी मुझे सबसे ज़्यादा ज़रूरत थी जब मैंने TripAdvisor scraping शुरू की थी, और यही section competitive guides structured तरीके से नहीं देते। TripAdvisor DataDome (जो रोज़ 5+ ट्रिलियन data points analyze करता है) और Cloudflare WAF दोनों का इस्तेमाल करता है। सबसे आम failure modes के लिए यह diagnostic table देखें:

Symptomसंभावित कारणFix
HTTP 403 responseMissing या suspicious headers; Cloudflare JS challengeRealistic User-Agent, Accept-Language, Referer, और Sec-CH-UA headers सेट करें। Header consistency बनाए रखें।
CAPTCHA page instead of dataRate limiting या browser fingerprintingResidential proxies rotate करें, random delays जोड़ें (2–7 seconds between requests)
Empty HTML or blank page bodyrequests JavaScript render नहीं कर रहाSelenium पर जाएँ या page source में hidden JSON extract करें
Partial reviews / "Read more" not expandingContent click event पर load हो रहा हैSelenium .click() इस्तेमाल करें या embedded JSON blob से निकालें
Reviews only in one languageLanguage parameter missing हैReview URL में ?filterLang=ALL जोड़ें
Data stops loading after N pagesSession-based rate limitSessions rotate करें, batches के बीच cookies clear करें
HTTP 1020 Access DeniedIP/ASN Cloudflare द्वारा bannedDatacenter proxies से residential proxies पर जाएँ
Challenge loop (infinite CAPTCHA)Cookie persistence टूट गईपहले homepage visit करके session warm up करें; cookie jar maintain करें

Exponential Backoff के साथ Retry Logic

कोई प्रतिस्पर्धी article यह code सच में नहीं दिखाता। यह एक reusable retry function है:

import time
import random
import requests

def fetch_with_retry(session, url, max_retries=4, base_delay=2, max_delay=60):
    """
    Exponential backoff और jitter के साथ URL fetch करें।
    हर retry पर User-Agent rotate होता है।
    """
    user_agents = [
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
    ]

    for attempt in range(max_retries):
        # Retry पर User-Agent rotate करें
        if attempt > 0:
            session.headers["User-Agent"] = random.choice(user_agents)

        try:
            response = session.get(url, timeout=30)

            if response.status_code == 200:
                return response

            if response.status_code == 429:
                # अगर Retry-After header हो तो उसका सम्मान करें
                retry_after = int(response.headers.get("Retry-After", base_delay * (2 ** attempt)))
                print(f"  Rate limited (429). {retry_after}s इंतज़ार कर रहे हैं...")
                time.sleep(retry_after)
                continue

            if response.status_code in (403, 503):
                wait = min(base_delay * (2 ** attempt) + random.uniform(0, 1), max_delay)
                print(f"  {response.status_code} मिला। Retry {attempt + 1}/{max_retries} in {wait:.1f}s...")
                time.sleep(wait)
                continue

            # अन्य error codes — retry न करें
            print(f"  {url} के लिए unexpected status {response.status_code}")
            return response

        except requests.exceptions.Timeout:
            wait = min(base_delay * (2 ** attempt) + random.uniform(0, 1), max_delay)
            print(f"  Timeout। Retry {attempt + 1}/{max_retries} in {wait:.1f}s...")
            time.sleep(wait)

    print(f"  {url} के लिए सभी {max_retries} retries समाप्त")
    return None

Headers, Proxies, और Sessions rotate करना

लगातार scraping के लिए header sets की pool रखें और उन्हें एक साथ rotate करें:

import random

HEADER_SETS = [
    {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "Sec-CH-UA": '"Google Chrome";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
        "Sec-CH-UA-Platform": '"Windows"',
    },
    {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "Sec-CH-UA": '"Google Chrome";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
        "Sec-CH-UA-Platform": '"macOS"',
    },
    {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
        "Sec-CH-UA": '"Google Chrome";v="134", "Not-A.Brand";v="8", "Chromium";v="134"',
        "Sec-CH-UA-Platform": '"Windows"',
    },
]

PROXY_LIST = [
    "http://user:pass@residential-proxy-1:port",
    "http://user:pass@residential-proxy-2:port",
    # और proxies जोड़ें
]

def get_rotated_session():
    """Rotated headers और proxy के साथ नया session बनाएँ।"""
    session = requests.Session()

    # Random header set चुनें
    header_set = random.choice(HEADER_SETS)
    base_headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
        "Accept-Language": "en-US,en;q=0.9",
        "Accept-Encoding": "gzip, deflate, br",
        "Referer": "https://www.tripadvisor.com/",
        "Sec-Fetch-Dest": "document",
        "Sec-Fetch-Mode": "navigate",
        "Sec-CH-UA-Mobile": "?0",
    }
    base_headers.update(header_set)
    session.headers.update(base_headers)

    # Random proxy चुनें
    if PROXY_LIST:
        proxy = random.choice(PROXY_LIST)
        session.proxies = {"http": proxy, "https": proxy}

    return session

Proxy type मायने रखता है। Datacenter proxies TripAdvisor पर लगभग तुरंत block हो जाते हैं (HTTP 1020 Access Denied)। Sustained scraping के लिए residential proxies ज़रूरी हैं — ये consumer ISPs के रास्ते जाते हैं और असली users जैसे दिखते हैं। Provider के हिसाब से लगभग $2.50–$8.40/GB खर्च मानकर चलें।

Scraped TripAdvisor Data को Export और Store करना

डेटा मिल जाने के बाद उसे usable format में लाना आसान है।

CSV Export (सबसे आम)

import pandas as pd

df = pd.DataFrame(all_hotels)
df.to_csv("tripadvisor_hotels_paris.csv", index=False, encoding="utf-8-sig")
print(f"CSV में {len(df)} rows export की गईं")

encoding='utf-8-sig' बहुत ज़रूरी है — इससे Excel CSV खोलते समय non-Latin characters (French accents, Chinese characters, आदि) सही दिखाता है।

JSON Export (Nested Data के लिए)

जब reviews hotels के अंदर nested हों, JSON hierarchy को सुरक्षित रखता है:

# Hierarchical structure
hotel_data = {
    "property_id": "d194317",
    "name": "NH City Centre Amsterdam",
    "rating": 4.0,
    "reviews": [
        {"title": "Great location", "rating": 5, "date": "2025-03-15", "text": "..."},
        {"title": "Average stay", "rating": 3, "date": "2025-03-10", "text": "..."},
    ]
}

# Flat analysis के लिए json_normalize इस्तेमाल करें
flat_reviews = pd.json_normalize(
    hotel_data,
    record_path="reviews",
    meta=["property_id", "name"]
)
flat_reviews.to_csv("reviews_flat.csv", index=False)

Relational Data के लिए Two-File Approach

बड़े datasets के लिए मैं दो CSV files use करता हूँ:

  • hotels.csv — हर property के लिए एक row (flat)
  • reviews.csv — हर review के लिए एक row, जिसमें property_id foreign key होता है

इससे pandas में join करना, database में load करना, या BI tools में import करना आसान हो जाता है।

अगर आप export logic से नहीं जूझना चाहते, तो Thunderbit आपको scraped data सीधे export करने देता है — Excel, Google Sheets, Airtable, या Notion में — सब free, और बिना code के। जब आपको technical teammates के साथ results share करने हों, तब यह बहुत काम आता है।

Responsible और Efficient TripAdvisor Scraping के टिप्स

छह बिंदुओं में responsible scraping:

  • robots.txt देखें: TripAdvisor की robots.txt AI training bots (GPTBot, ClaudeBot, आदि) को पूरी तरह block करती है। Standard crawlers पर कुछ path restrictions लागू होती हैं। इसे tripadvisor.com/robots.txt पर देखें।
  • Delays जोड़ें: Requests के बीच 3–7 seconds सुरक्षित रेंज है। 10–15 requests per minute per IP से तेज़ जाने पर rate limiting शुरू हो जाती है।
  • सिर्फ public data scrape करें। Restricted content पाने के लिए login न करें।
  • Data securely store करें और अगर personal information (reviewer names, आदि) संभाल रहे हों तो GDPR/CCPA का पालन करें।
  • अगर commercial-scale data चाहिए, तो TripAdvisor का official API सोचें। Developer Portal business details के साथ हर location पर 5 reviews और 5 photos तक access देता है — सीमित है, लेकिन legal और stable है।
  • कानूनी संदर्भ समझें: EU Court Ryanair ruling (December 2025) ने EU में ToS-based scraping restrictions को और मज़बूत किया। TripAdvisor के Terms of Service स्पष्ट रूप से scraping पर रोक लगाते हैं। इसलिए जिम्मेदारी से scrape करें और अपने जोखिम पर करें।

निष्कर्ष

यही पूरी तस्वीर है।

  • Requests + BeautifulSoup सबसे सरल रास्ता है। यह static listing pages के लिए काम करता है, setup कम चाहिए, और तेज़ है। अगर आप 100 pages से कम scrape कर रहे हैं और JavaScript-rendered content की ज़रूरत नहीं है, तो यहीं से शुरू करें।
  • Selenium वह सब संभालता है जो requests नहीं कर पाता: dynamic content, "Read More" buttons, cookie banners। यह 5x धीमा और resource-heavy है, लेकिन page के साथ interact करने की ज़रूरत हो तो यही विकल्प है।
  • Hidden JSON / GraphQL सबसे साफ़ और तेज़ तरीका है। यह HTML parse किए बिना structured data देता है, requests की संख्या कम करता है (और इसलिए proxies की ज़रूरत भी कम होती है), और analysis-ready formats में data लौटाता है। लेकिन इसे शुरू में reverse-engineering और समय-समय पर maintenance की ज़रूरत पड़ती है जब TripAdvisor अपनी data structure बदलता है।

Reusable scrape_tripadvisor() function hotels, restaurants, और attractions — तीनों को cover करता है। आपको दूसरा tutorial नहीं चाहिए होना चाहिए।

और अगर tutorial के बीच में आपको लगे कि coding आपके लिए नहीं है — या बस दिन के अंत तक spreadsheet में 50 hotels चाहिए — तो Thunderbit का Chrome extension AI-powered field detection, automatic pagination, और Excel या Google Sheets में free export के साथ दो clicks में यह काम कर सकता है। Python की ज़रूरत नहीं।

अगर आप और गहराई में जाना चाहते हैं, तो Thunderbit blog और हमारे YouTube channel पर और scraping walkthroughs मौजूद हैं।

FAQs

1. क्या TripAdvisor scrape करना legal है?

TripAdvisor के Terms of Service स्पष्ट रूप से scraping को prohibit करते हैं। हालांकि, अदालतों ने आमतौर पर माना है कि public data (जो login के पीछे नहीं है) को scrape करना US में Computer Fraud and Abuse Act का उल्लंघन नहीं करता। फिर भी, 2025 EU Court Ryanair ruling ने Europe में ToS-based restrictions को कड़ा कर दिया। केवल public data scrape करें, robots.txt का सम्मान करें, copyrighted content दोबारा publish न करें, और अगर data को commercial use में ला रहे हैं तो legal counsel लें।

2. क्या मैं बिना Python के TripAdvisor scrape कर सकता हूँ?

हाँ। Thunderbit जैसे no-code tools आपके browser से ही AI-powered field detection और automatic pagination के साथ TripAdvisor scrape कर सकते हैं। आप browser extensions, Google Sheets add-ons, या commercial scraping APIs भी इस्तेमाल कर सकते हैं। Python सबसे ज़्यादा control और flexibility देता है, लेकिन वही एकमात्र विकल्प नहीं है।

3. TripAdvisor scrape करते समय block होने से कैसे बचूँ?

मुख्य tactics: realistic और consistent headers इस्तेमाल करें (खासकर User-Agent और Sec-CH-UA), residential proxies rotate करें (datacenter IPs तुरंत block हो जाते हैं), requests के बीच 3–7 seconds के random delays जोड़ें, total requests कम करने के लिए hidden JSON method अपनाएँ, exponential backoff के साथ retry logic लागू करें, और deep pages scrape करने से पहले homepage visit करके sessions warm up करें।

4. TripAdvisor से कौन-सा data scrape कर सकता हूँ?

Hotels, restaurants, और attractions — जिनमें names, ratings, review counts, price ranges, addresses, coordinates, amenities (hotels), cuisine types (restaurants), tour durations (attractions), और full review text के साथ individual ratings और dates शामिल हैं। Hidden JSON और GraphQL approaches प्रति request सबसे rich data देती हैं।

5. मैं TripAdvisor से एक दिन में कितने pages scrape कर सकता हूँ?

एक single IP और sensible delays के साथ: लगभग 600–1,000 pages/day। 20 rotating residential proxies के साथ: request-based approaches से लगभग 200,000–300,000 pages/day। Selenium धीमा है — प्रति proxy 8,000–12,000 pages/day का अनुमान रखें। Hidden JSON/GraphQL method प्रति request सबसे ज़्यादा data देती है, इसलिए वही amount of information पाने के लिए आपको कुल pages कम scrape करने पड़ सकते हैं।

Learn More

Ke
Ke
Thunderbit में CTO | वरिष्ठ डेटा वैज्ञानिक और एमएल विशेषज्ञ मशीन लर्निंग और डेटा साइंस में लगभग एक दशक के अनुभव के साथ, के शेन कोलंबिया विश्वविद्यालय के पूर्व छात्र हैं और Walmart Labs में पूर्व वरिष्ठ डेटा वैज्ञानिक रह चुके हैं। Python, R, Java और सांख्यिकी में उनकी गहरी, सहकर्मी-मान्य विशेषज्ञता है, और वे जटिल AI एल्गोरिद्म को सिद्धांत से उत्पादन-स्तरीय आर्किटेक्चर तक ले जाने पर व्यावहारिक, आजमाई हुई अंतर्दृष्टियाँ साझा करते हैं।

Thunderbit आज़माएं

लीड्स और अन्य डेटा सिर्फ 2 क्लिक में स्क्रैप करें। AI से संचालित।

Thunderbit पाएं यह मुफ्त है
AI का उपयोग करके डेटा निकालें
डेटा को Google Sheets, Airtable या Notion में आसानी से ट्रांसफर करें
Chrome Store Rating
PRODUCT HUNT#1 Product of the Week