2026 में Python से Walmart को कैसे Scrape करें (और Block न हों)

अंतिम अपडेट: April 28, 2026
2026 में Python से Walmart को कैसे Scrape करें (और Block न हों)

Walmart कुछ items की कीमतें दिन में कई बार बदलता है। अगर आपने कभी इसे programmatically track करने की कोशिश की है, तो परेशानी समझ में आती है: आपका script 20 मिनट तक चलता है, फिर चुपचाप CAPTCHA pages लौटाने लगता है, जो normal 200 OK responses की तरह disguise किए गए होते हैं।

Thunderbit में data extraction work के दौरान मैंने Walmart की anti-bot defenses पर काफी समय लगाया है, और मैं वही सब साझा करना चाहता हूँ जो मैंने सीखा है — वे तरीके जो सच में 2025 में काम करते हैं, वे silent failures जो आपके data को खराब कर देते हैं, और अपना scraper लिखने, scraping API के लिए भुगतान करने, और बस no-code tool इस्तेमाल करने के बीच के ईमानदार trade-offs। इस guide में तीन extraction methods शामिल हैं (HTML parsing, __NEXT_DATA__ JSON, और internal API interception), production-ready error handling जो ज़्यादातर tutorials पूरी तरह छोड़ देते हैं, और सही approach चुनने के लिए एक साफ़ decision framework। अगर आप Python लिख रहे हैं या बस lunch तक prices से भरी spreadsheet चाहते हैं, तो यहाँ आपके लिए कुछ है।

Python से Walmart को Scrape क्यों करें?

Walmart revenue के हिसाब से दुनिया का सबसे बड़ा retailer है — FY2025 में $680.985 billion, और लगातार 12 साल तक Fortune Global 500 में #1 स्थान पर रहा है। Site पर लगभग 420 million live listings हैं, और Walmart के CFO ने marketplace पर "half a billion SKUs" का हवाला दिया है। लगभग 95% listings third-party sellers से आती हैं, जिसका मतलब है कि catalog बहुत volatile है — sellers बदलते रहते हैं, variants बदलते हैं, और stock रोज़ बदलता है।

walmart_stats_670d06c6bd.png

इसी volatility की वजह से scraping ज़रूरी है। Quarterly report वह नहीं पकड़ सकता जो nightly scrape पकड़ सकता है। यहाँ सबसे common use cases हैं जो मैं देखता हूँ:

Use Caseकिसे इसकी ज़रूरत हैवे क्या निकालते हैं
प्रतिस्पर्धी कीमत मॉनिटरिंगई-कॉमर्स ऑप्स, repricing toolsकीमतें, promotions, MAP compliance
प्रोडक्ट catalog enrichmentsales और merchandising teamsdescriptions, images, specs, variants
stock availability trackingsupply chain, dropshippersinventory status, seller info
market research और trend analysismarketing, product managersratings, reviews, category assortment
lead generationsales teamsseller names, product counts, categories

सिर्फ competitor price monitoring software market ही 2025 में $1.92 billion तक पहुँच गया और 2033 तक $5.09 billion होने का अनुमान है। Consumer behavior इस spending को drive करता है: 94% customers online shopping करते समय prices compare करते हैं, और 83% लोग multiple sites पर comparison shopping करते हैं।

इस काम के लिए Python default language है। Apify की 2026 Infrastructure Report के अनुसार Python सभी web scraping का 71.7% हिस्सा है, और core library (requests) को हर हफ्ते ~30 million downloads मिलते हैं। अगर आप किसी भी scale पर scraping कर रहे हैं, तो लगभग तय है कि आप इसे Python में ही कर रहे हैं।

Walmart Scrape करने के लिए सबसे कठिन Sites में से एक क्यों है

Walmart इसलिए खास तौर पर कठिन है क्योंकि यह दो commercial anti-bot products को series में चलाता है: edge WAF और TLS fingerprinting layer के रूप में Akamai Bot Manager, और behavioral JavaScript challenge layer के रूप में PerimeterX (rebranded HUMAN Security). Scrape.do इस combination को "rare and extremely difficult to bypass" कहता है।

walmart_antibot_3d67d0119c.png

ScrapeOps Walmart की overall scraping difficulty को 9/10 रेट करता है, और सिर्फ Akamai को भी 9/10। मेरे experience में, यह काफी सटीक है।

असल में आपके सामने यह है:

Akamai Bot Manager आपका TLS fingerprint (JA3/JA4 hash), HTTP/2 frame ordering, header order और casing, और session cookies (_abck, ak_bmsc) inspect करता है। एक stock Python requests call ऐसा TLS fingerprint भेजती है जो कोई real browser कभी नहीं बनाता — Akamai आपके request के Walmart के servers तक पहुँचने से पहले ही उसे flag कर देता है।

PerimeterX/HUMAN Akamai के बाद चलता है, और JavaScript fingerprinting (px.js) execute करता है जो navigator properties, canvas rendering, WebGL, audio context, और behavioral biometrics (mouse movement, scroll velocity, keystroke dynamics) check करता है। Visible failure वही बदनाम "Press & Hold" challenge है — एक button जिसे आपको लगभग 10 seconds तक दबाकर रखना पड़ता है, जबकि behavioral signals sample किए जाते हैं। Oxylabs साफ़ कहता है: "Walmart uses the 'Press & Hold' model of CAPTCHA, offered by PerimeterX, which is known to be almost impossible to solve from your code."

सबसे ख़तरनाक behavior है silent block। Walmart 403 की जगह HTTP 200 के साथ CAPTCHA body लौटाता है। ScrapingBee पुष्टि करता है: "Walmart returns a 200 OK status code even when it serves a CAPTCHA page. You can't rely on the status code alone to know if your request succeeded." आपका script CAPTCHA HTML को खुशी-खुशी "product not found" समझकर parse कर देता है और आगे बढ़ जाता है। आपका आधा dataset बेकार है, और आपको पता भी नहीं चलता।

फिर store-scoped data problem है। Walmart prices और inventory location-specific होते हैं, जिन्हें locDataV3 और assortmentStoreId जैसे cookies control करते हैं। सही cookies के बिना, आपको "default national" data मिलता है जो पूरा दिख सकता है, लेकिन real shoppers जो देखते हैं उससे match नहीं करता। Missing cookies block page नहीं बनाते — वे बिना visible failure के गलत data देते हैं, और यह और भी ख़राब है।

Walmart से Data निकालने के तीन तरीके (और उनकी तुलना)

Step-by-step से पहले, extraction के तीन primary approaches ये हैं। ज़्यादातर competitor tutorials सिर्फ एक या दो ही cover करते हैं। मैं तीनों समझाऊँगा ताकि आप अपनी situation के हिसाब से सही विकल्प चुन सकें।

Methodविश्वसनीयताData CompletenessAnti-Bot कठिनाईMaintenance Burden
HTML + BeautifulSoup⚠️ कम (selectors हर deploy पर टूटते हैं)मध्यमऊँचीऊँची
__NEXT_DATA__ JSON✅ अच्छीऊँचीमध्यम-ऊँचीमध्यम
Internal API interception✅ सबसे अच्छीसबसे अधिक (variants, stock, reviews)मध्यम-ऊँचीकम (structured JSON)
Thunderbit (no-code)✅ अच्छीऊँचीकम (AI द्वारा संभाली जाती है)नहीं के बराबर

Walmart के लिए HTML parsing सबसे खराब विकल्प है — site Next.js bundles के साथ hashed CSS class names भेजती है जो हर deploy पर बदल जाते हैं। __NEXT_DATA__ JSON method व्यावहारिक विकल्प है, जिसे 2024–2026 के लगभग सभी serious open-source Walmart scrapers इस्तेमाल करते हैं। Internal API interception सबसे शक्तिशाली है, लेकिन इसमें कुछ caveats हैं जिन्हें ज़्यादातर tutorials हल्के में लेते हैं। और अगर आपको custom pipeline की ज़रूरत ही नहीं है, तो Thunderbit सही विकल्प है।

Walmart scraping के लिए Thunderbit आज़माएँ

Walmart Scrape करने के लिए अपना Python Environment सेट करना

आपको यह चाहिए:

  • कठिनाई: मध्यम
  • समय: setup के लिए ~30 मिनट, फिर coding time
  • ज़रूरी चीज़ें: Python 3.10+, pip, एक code editor, और (production use के लिए) proxy service या scraping API

अपना project folder और virtual environment बनाएँ:

mkdir walmart-scraper && cd walmart-scraper
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

ज़रूरी libraries install करें:

pip install curl_cffi parsel beautifulsoup4 lxml

curl_cffi hard targets scrape करने के लिए 2025 का standard है। यह libcurl binding है जो exact browser TLS fingerprints की नकल कर सकता है। Bright Data समझाता है: "Walmart अपने bot detection के हिस्से के रूप में TLS fingerprinting का उपयोग करता है, और User-Agent सेट करके किसी real browser की नकल करना इसे bypass नहीं करेगा." साधारण requests या httpx, आप जो headers set करें, उसके बावजूद Akamai पास नहीं कर सकते। impersonate="chrome124" के साथ curl_cffi ही फर्क पैदा करता है।

आपको बाद में cover किए जाने वाले production patterns के लिए json (built-in), csv (built-in), time, random, और logging भी चाहिए होंगे।

Step-by-Step: Python से Walmart Product Pages Scrape करें

Step 1: Walmart Product Page Fetch करें

आपका पहला काम ऐसा HTTP request करना है जो तुरंत block न हो। 2024–2026 में Scrapfly, Scrapingdog, Oxylabs, और ScrapeOps के बीच इस्तेमाल होने वाला canonical header set यह है:

from curl_cffi import requests

HEADERS = {
    "User-Agent": (
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
        "AppleWebKit/537.36 (KHTML, like Gecko) "
        "Chrome/124.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",
    "Upgrade-Insecure-Requests": "1",
    "Sec-Fetch-Dest": "document",
    "Sec-Fetch-Mode": "navigate",
    "Sec-Fetch-Site": "none",
    "Sec-Fetch-User": "?1",
    "Referer": "https://www.google.com/",
}

session = requests.Session(impersonate="chrome124")
url = "https://www.walmart.com/ip/Apple-AirPods-Pro-2nd-Generation/1752657021"
response = session.get(url, headers=HEADERS)

यहाँ impersonate="chrome124" parameter भारी काम कर रहा है। यह curl_cffi को Chrome 124 के exact TLS ClientHello, HTTP/2 frame ordering, और pseudo-header sequence से match करने के लिए कहता है। इसके बिना Akamai एक Python-specific JA3 hash देखता है और आपके request के Walmart की application layer तक पहुँचने से पहले ही उसे block कर देता है।

Blocked response कैसी दिखती है: अगर response HTML title में "Robot or human?" दिखाई दे, या response walmart.com/blocked पर redirect हो, तो आप पकड़े जा चुके हैं। मुश्किल यह है कि Walmart अक्सर CAPTCHA body के साथ 200 status code लौटाता है — इसलिए response.ok check करना पर्याप्त नहीं है।

किसी भी production या repeated use के लिए आपको residential proxies चाहिए होंगे। Datacenter IPs Akamai के IP reputation system द्वारा तुरंत burn कर दिए जाते हैं। नीचे production section में मैं पूरा error handling और proxy strategy cover करूँगा।

Step 2: __NEXT_DATA__ JSON से Product Data Parse करें

Walmart.com एक Next.js application है, और server-rendered HTML पूरा hydration payload एक ही script tag में embed करता है: <script id="__NEXT_DATA__" type="application/json">. यही सोने की खान है।

Scrapfly की 2026 guide इसकी पुष्टि करती है: "2026 में Walmart __NEXT_DATA__ script tags के अंदर structured JSON के साथ Next.js का उपयोग करता है, जिससे hidden data extraction पारंपरिक CSS selector parsing से अधिक reliable हो जाती है." हर high-profile open-source Walmart scraper — Scrapfly का, Oxylabs का, python-scrapy-playbook का — यही method इस्तेमाल करता है।

इसे निकालने का तरीका यह है:

import json
from parsel import Selector

sel = Selector(text=response.text)
raw = sel.xpath('//script[@id="__NEXT_DATA__"]/text()').get()
data = json.loads(raw)
product = data["props"]["pageProps"]["initialData"]["data"]["product"]
idml = data["props"]["pageProps"]["initialData"]["data"].get("idml", {})

ज़्यादातर tutorials यहीं रुक जाते हैं। नीचे उन fields के लिए एक complete JSON path map है जिनकी आपको सच में ज़रूरत है — 2024–2026 की live Walmart pages के against verify किया हुआ:

Data FieldJSON Path (initialData के अंदर)TypeNotes
Product Namedata > product > nameString
Branddata > product > brandString
Current Price (number)data > product > priceInfo > currentPrice > priceFloatstore cookie के अनुसार अलग हो सकता है
Current Price (string)data > product > priceInfo > currentPrice > priceStringStringformatted, जैसे "$9.99"
Short Descriptiondata > product > shortDescriptionHTML Stringtext के लिए BeautifulSoup से parse करें
Long Descriptiondata > idml > longDescriptionHTML Stringproduct के अंदर नहीं, बल्कि idml पर होती है — यही वह trap है जहाँ पुराने tutorials गलत हो जाते हैं
All Imagesdata > product > imageInfo > allImagesArray{id, url} objects की list
Average Ratingdata > product > averageRatingFloatkey averageRating है, legacy rating नहीं
Review Countdata > product > numberOfReviewsInteger
Variantsdata > product > variantCriteriaArrayoption groups (size, color)
Availabilitydata > product > availabilityStatusStringIN_STOCK, OUT_OF_STOCK, LIMITED_STOCK
Sellerdata > product > sellerDisplayNameString
Manufacturerdata > product > manufacturerNameString

longDescription path वह एक trap है जो लोगों को पकड़ता है। 2023 के एक ScrapeHero post ने इसे product.longDescription पर रखा था, लेकिन 2024+ sources इसे लगातार sibling idml key पर रखते हैं। हमेशा पहले idml.longDescription पढ़ें और पुराने pages के लिए product.longDescription fallback रखें।

यहाँ .get() chains के साथ safe extraction pattern है:

def extract_product(data):
    product = data["props"]["pageProps"]["initialData"]["data"]["product"]
    idml = data["props"]["pageProps"]["initialData"]["data"].get("idml", {})

    price_info = product.get("priceInfo", {})
    current_price = price_info.get("currentPrice", {})
    image_info = product.get("imageInfo", {})

    return {
        "name": product.get("name"),
        "brand": product.get("brand"),
        "price": current_price.get("price"),
        "price_string": current_price.get("priceString"),
        "short_desc": product.get("shortDescription"),
        "long_desc": idml.get("longDescription", product.get("longDescription")),
        "images": [img.get("url") for img in image_info.get("allImages", [])],
        "rating": product.get("averageRating"),
        "review_count": product.get("numberOfReviews"),
        "variants": product.get("variantCriteria"),
        "availability": product.get("availabilityStatus"),
        "seller": product.get("sellerDisplayName"),
        "manufacturer": product.get("manufacturerName"),
    }

जो users JSON path navigation से बिल्कुल नहीं जूझना चाहते, उनके लिए Thunderbit AI इन fields को अपने आप पहचानकर structure कर देता है — manual path mapping की ज़रूरत नहीं। आप "AI Suggest Fields" click करते हैं, यह page पढ़ता है, और आपको table मिल जाता है। लेकिन अगर आप custom pipeline बना रहे हैं, तो ऊपर दिया गया map आपका reference है।

Step 3: Richer Data के लिए Walmart के Internal API Endpoints Intercept करें

कोई competitor article इस method को ठीक से cover नहीं करता। यह सबसे शक्तिशाली extraction path है — और सबसे complicated भी।

Walmart का front end Apollo Gateway पर बने federated GraphQL backend को call करता है। Endpoints www.walmart.com/orchestra/* के नीचे रहते हैं:

  • /orchestra/pdp/graphql/... — product detail hydration + variant switches
  • /orchestra/snb/graphql/... — search-n-browse pagination
  • /orchestra/reviews/graphql/... — paginated reviews

ये साफ़, structured JSON लौटाते हैं, जिसमें वह data भी होता है जिसे __NEXT_DATA__ कभी-कभी truncate कर देता है — variant-level pricing, real-time stock counts, full review pagination।

वह catch जिसे ब्लॉग पोस्ट्स घुमा-फिराकर छोड़ देते हैं: Walmart Apollo persisted queries का उपयोग करता है। Request body में सिर्फ SHA-256 hash (persistedQuery.sha256Hash) जाता है, query text नहीं। अगर hash server को unknown है, तो PersistedQueryNotFound मिलता है। Walmart deploys पर ये hashes rotate करता है। यही कारण है कि कोई भी high-profile open-source Walmart scraper copy-paste योग्य /orchestra/ code publish नहीं करता।

इस method का practical, honest version एक DevTools exercise है:

  1. Chrome में Walmart product page खोलें
  2. DevTools → Network tab खोलें, "Fetch/XHR" से filter करें
  3. Page को normal तरीके से browse करें — variants पर click करें, reviews तक scroll करें, store location बदलें
  4. /orchestra/* endpoints वाले requests देखें जो product data के साथ JSON लौटाते हैं
  5. Request पर right-click करें → "Copy as cURL"
  6. cURL command को curl_cffi इस्तेमाल करके Python में convert करें

रीप्ले किए गए API call का उदाहरण यह है:

import json
from curl_cffi import requests

session = requests.Session(impersonate="chrome124")

# पहले session को warm करें: product page visit करके
session.get("https://www.walmart.com/ip/some-product/1234567", headers=HEADERS)

# फिर internal API call replay करें (DevTools से copy किया हुआ)
api_url = "https://www.walmart.com/orchestra/pdp/graphql"
api_headers = {
    **HEADERS,
    "accept": "application/json",
    "content-type": "application/json",
    "referer": "https://www.walmart.com/ip/some-product/1234567",
    "wm_qos.correlation_id": "your-copied-correlation-id",
}
payload = {
    # DevTools से exact request body paste करें
    "variables": {"productId": "1234567"},
    "extensions": {
        "persistedQuery": {
            "version": 1,
            "sha256Hash": "the-hash-you-copied"
        }
    }
}

api_response = session.post(api_url, headers=api_headers, json=payload)
api_data = api_response.json()

Session warming step बहुत ज़रूरी है। Walmart के PerimeterX cookies (_px3, _pxhd, ACID) initial HTML fetch से set होने चाहिए, तभी API call सफल होगी। इनके बिना आपको 412 या 403 मिलेगा।

इस method का उपयोग कब करें: जब आपको ऐसा data चाहिए जो __NEXT_DATA__ में नहीं है — deep variant pricing, first batch से आगे paginated reviews, या real-time inventory counts। ज़्यादातर use cases के लिए __NEXT_DATA__ पर्याप्त और बहुत सरल है।

Walmart Search Results और Multiple Pages Scrape करना

Search results भी इसी __NEXT_DATA__ pattern का पालन करते हैं, लेकिन JSON path अलग होता है:

search_url = "https://www.walmart.com/search?q=laptops&page=1"
response = session.get(search_url, headers=HEADERS)

sel = Selector(text=response.text)
raw = sel.xpath('//script[@id="__NEXT_DATA__"]/text()').get()
data = json.loads(raw)

search_result = data["props"]["pageProps"]["initialData"]["searchResult"]
items = search_result["itemStacks"][0]["items"]

# sponsored products को filter करें
organic_items = [i for i in items if i.get("__typename") == "Product"]

for item in organic_items:
    print(item.get("name"), item.get("priceInfo", {}).get("currentPrice", {}).get("price"))

Pagination page parameter बढ़ाने से काम करती है: &page=1, &page=2, आदि। लेकिन यहाँ एक undocumented cap है: Walmart total count चाहे जो भी हो, search results को 25 pages तक सीमित करता है। Scrapfly पुष्टि करता है: "Walmart sets the maximum number of result pages that can be accessed to 25 regardless of the total number of pages available."

गहरी coverage पाने के workaround:

  • Sort-order flipping: वही query &sort=price_low और फिर &sort=price_high के साथ चलाएँ ताकि लगभग 50 pages की coverage मिल सके
  • Price-range slicing: catalog को छोटे windows में बाँटने के लिए &min_price=X&max_price=Y जोड़ें
  • Category slicing: site-wide के बजाय specific categories में search करें

ध्यान दें कि itemStacks एक array है। Scrapfly अपने repo में [0] hardcode करता है, लेकिन category और browse pages में कभी-कभी कई stacks होते हैं ("Top picks," "More results"). Robust pattern सभी stacks iterate करता है:

for stack in search_result.get("itemStacks", []):
    for item in stack.get("items", []):
        if item.get("__typename") == "Product":
            # item process करें
            pass

एक और बात: Walmart की robots.txt /search disallow करती है। Product detail pages (/ip/...) और ज़्यादातर category pages (/cp/...) disallow नहीं हैं। अगर compliance को लेकर चिंता है, तो search के बजाय product pages और category trees से शुरुआत करें।

Silent Blocks को अपने Data को खराब न करने दें: Production-Ready Error Handling

ज़्यादातर tutorials यहीं टूट जाते हैं। वे आपको एक page fetch करना, एक product parse करना, और फिर दिन खत्म करना सिखाते हैं। Production में आप हज़ारों pages fetch कर रहे होते हैं, और Walmart आपको रोकने की कोशिश कर रहा होता है। Demo scraper और असल में काम करने वाले scraper के बीच फर्क failure handling का है।

Silent Blocks को Data Corrupt करने से पहले पहचानें

Walmart scraper में सबसे महत्वपूर्ण function block detector है। ScrapingBee, Scrapingdog, Oxylabs, और Decodo की vendor consensus के आधार पर आपको चार independent checks चाहिए:

BLOCK_MARKERS = (
    "Robot or human",
    "Press &amp; Hold",
    "Press & Hold",
    "px-captcha",
    "perimeterx",
)

def is_walmart_blocked(response) -> bool:
    # 1. Dedicated block endpoint पर redirect
    if "/blocked" in str(response.url):
        return True
    # 2. Hard status codes
    if response.status_code in (403, 412, 428, 429, 503):
        return True
    # 3. 200 OK के साथ CAPTCHA body (silent-block case)
    body = response.text or ""
    if any(m.lower() in body.lower() for m in BLOCK_MARKERS):
        return True
    # 4. Response length sanity — real PDPs 300-900 KB होते हैं
    if len(response.content) < 50_000 and "/ip/" in str(response.url):
        return True
    return False

वह चौथा check — response length — उन cases को पकड़ता है जहाँ Walmart एक stripped-down page लौटाता है जिसमें कोई obvious CAPTCHA marker नहीं होता, लेकिन आपके ज़रूरी product data भी नहीं होते।

Exponential Backoff और Jitter के साथ Retry Logic

जब request fail हो, तो Walmart पर तुरंत hammer नहीं करना चाहिए। Standard pattern retries को desynchronize करने के लिए exponential backoff with jitter का उपयोग करता है:

import time
import random
import logging
from curl_cffi import requests as cffi_requests

log = logging.getLogger("walmart")

def fetch_with_retry(session, url, max_retries=5, base_delay=2, max_delay=60):
    for attempt in range(max_retries):
        try:
            response = session.get(url, headers=HEADERS, timeout=15)

            if response.status_code in (429, 503):
                raise Exception(f"Throttled: {response.status_code}")

            if is_walmart_blocked(response):
                raise Exception("Silent block detected")

            return response

        except Exception as e:
            if attempt == max_retries - 1:
                raise

            wait = min(max_delay, base_delay * (2 ** attempt)) + random.uniform(0, 3)
            log.warning(f"Attempt {attempt + 1} failed: {e}. Retrying in {wait:.1f}s")
            time.sleep(wait)

    return None

Jitter (random.uniform(0, 3)) सिर्फ सजावट नहीं है — यह workers को desynchronize करता है ताकि scrapers का एक fleet उसी second में retry-pulse करके Akamai के velocity detectors को trigger न करे।

Rate Limiting

Thunderbit और Scrape.do दोनों Walmart के लिए प्रति request 3–6 second randomized delay पर सहमत हैं: "page loads के बीच 3–6 seconds wait करके और delays को randomize करके requests को throttle करें।"

import time
import random

def rate_limited_fetch(session, url):
    response = fetch_with_retry(session, url)
    time.sleep(random.uniform(3.0, 6.0))
    return response

Scale पर, async rate limiting के लिए aiolimiter इस्तेमाल करने पर विचार करें:

from aiolimiter import AsyncLimiter
limiter = AsyncLimiter(max_rate=10, time_period=60)  # 10 requests per minute

Data Validation

Response blocked न भी हो, तब भी parsed data गलत हो सकता है (गलत store, degraded payload)। Output में लिखने से पहले validate करें:

def validate_product(product):
    """अगर product data वैध दिखे तो True लौटाता है."""
    if not product.get("name"):
        return False

    price = (product.get("priceInfo") or {}).get("currentPrice", {}).get("price")
    if not isinstance(price, (int, float)) or price <= 0:
        return False

    if product.get("availabilityStatus") not in ("IN_STOCK", "OUT_OF_STOCK", "LIMITED_STOCK"):
        return False

    return True

Session Logging

हर session की success rate track करें। जब यह 10 minutes के लिए 80% से नीचे गिरती है, तो कुछ बदल गया है — या तो आपका IP burn हो गया है, आपके cookies expire हो गए हैं, या Walmart ने नया anti-bot rule deploy कर दिया है।

class ScrapeMetrics:
    def __init__(self):
        self.total = 0
        self.success = 0
        self.blocks = 0
        self.errors = 0

    def record(self, result):
        self.total += 1
        if result == "success":
            self.success += 1
        elif result == "blocked":
            self.blocks += 1
        else:
            self.errors += 1

    @property
    def success_rate(self):
        return (self.success / self.total * 100) if self.total > 0 else 0

    def check_health(self):
        if self.total > 20 and self.success_rate < 80:
            log.critical(f"Success rate dropped to {self.success_rate:.1f}% — consider rotating proxies or pausing")

शानदार नहीं। लेकिन यही आपके data को साफ़ रखता है।

DIY Python बनाम Scraping API बनाम No-Code: Walmart Scrape करने का सही तरीका चुनना

बहुत से developers यह सोचे बिना कि यह सही है या नहीं, सीधे custom scraper लिखना शुरू कर देते हैं। ScrapeOps Walmart को difficulty में 9/10 रेट करता है. Forum users इसे "basically 9/10" कहते हैं और सोचते हैं कि "if a dedicated web scraping API would be overkill." जवाब volume, budget, और engineering capacity पर निर्भर करता है।

FactorDIY Python (requests + proxies)Scraping API (Oxylabs, Bright Data, etc.)No-Code Tool (Thunderbit)
First row तक setup timeघंटे15–60 min~2 min
Production तक setup time40–80 hrs4–16 hrs~30 min
Anti-bot handlingआप संभालते हैं (कठिन)provider संभालता हैअपने आप संभल जाता है
छोटे scale पर लागत (<1K pages/mo)कम (proxy costs ~$4–8/GB)$40–$49/mo entry tiersFree–$15/mo
बड़े scale पर लागत (100K+ pages/mo)प्रति request कमप्रति request अधिकबदलती रहती है
Customizationपूरा controlAPI parametersUI/fields से सीमित
Ongoing maintenance4–8 hrs/monthलगभग शून्यनहीं के बराबर (AI adapt करता है)
Best forcustom pipelines बनाने वाले developersmid-scale production scrapingbusiness users, quick one-off extractions

DIY Python कब समझदारी है

DIY तब जीतता है जब आपके पास पहले से proxy contract हो, headers, zipcode targeting, या seller cohorts पर strict control चाहिए, आप महीने में millions of pages index कर रहे हों जहाँ per-record API fees जुड़ती चली जाती हैं, या आपको on-prem या compliance guarantees चाहिए। trade-off वास्तविक engineering time है: pagination, retries, proxy rotation, TLS impersonation, और multiple page-type schemas के साथ एक production-ready Scrapy spider बनाने में 40–80 घंटे के senior Python work लगते हैं, और Walmart fingerprints rotate करे तो हर महीने 4–8 घंटे maintenance भी चाहिए।

Scraping API कब समय बचाती है

Scraping APIs anti-bot layer को आपके लिए संभाल लेते हैं। ScrapeOps benchmarks Walmart पर Zyte API के लिए 99% और Scrape.do के लिए 98% success rate दिखाते हैं। Entry-tier pricing ScraperAPI, Oxylabs, और Scrapingdog जैसे tools के लिए $40–$49/month से शुरू होता है। अगर आप 2–5 engineers की team हैं और आपकी scraping volume 10K–1M pages per month है, तो API लगभग हमेशा सही विकल्प है। आप per-request cost के बदले zero maintenance पाते हैं।

No-Code कब सही विकल्प है

Thunderbit एक अलग ही profile के लिए है। अगर आप PM, analyst, या e-commerce operator हैं जिन्हें इस afternoon Walmart product data spreadsheet में चाहिए — अगले sprint में नहीं — तो no-code tool सबसे ईमानदार जवाब है।

Workflow: Thunderbit Chrome Extension install करें, Walmart product या search page पर जाएँ, "AI Suggest Fields" click करें, और Thunderbit की AI page पढ़कर columns suggest करेगी (product name, price, rating, etc.)। फिर "Scrape" click करें, और data table में भर जाएगा। Excel, Google Sheets, Airtable, या Notion में export करें — सब free, कोई paywall नहीं।

Thunderbit cloud में anti-bot संभालता है, इसलिए आपको CAPTCHA, proxies, या TLS fingerprinting से जूझना नहीं पड़ता। AI layout changes को automatically adapt कर लेती है, इसलिए maintenance नहीं है। जो users JSON path navigation से बिल्कुल नहीं जूझना चाहते, उनके लिए यही सबसे आसान रास्ता है।

ईमानदार सीमाएँ: Thunderbit 100K+ pages per day के लिए नहीं बना है। Credit budgets और cloud caps high-volume ingest को raw APIs की तुलना में uneconomical बना देते हैं। आप specific zipcode या ASN pin भी नहीं कर सकते, जब तक tool यह support न करे। ongoing, high-volume pipelines के लिए DIY या scraping API अभी भी बेहतर रास्ता है।

मोटा pricing अनुमान: Thunderbit पर 1,000 Walmart product rows लगभग 2,000 credits (~$0.60–$1.10 Starter/Pro plans पर) पड़ते हैं। यह Oxylabs के Walmart API के क़रीब है और low volume पर ज़्यादातर hobby-tier scraping APIs से सस्ता है। मौजूदा details के लिए Thunderbit pricing देखें।

AI से Walmart product data scrape करें Get Started Free

अपनी Scraped Walmart Data को Export करना

Data मिल जाने के बाद, आपको उसे कहीं उपयोगी जगह चाहिए। तीन formats ज़्यादातर ज़रूरतें पूरी कर देते हैं:

CSV — सबसे सामान्य format, जिसे analysts वास्तव में खोलते हैं:

import csv

def export_csv(products, filename="walmart_products.csv"):
    fieldnames = ["name", "price", "availability", "rating", "review_count", "seller", "url"]
    with open(filename, "w", newline="", encoding="utf-8-sig") as f:
        writer = csv.DictWriter(f, fieldnames=fieldnames, quoting=csv.QUOTE_MINIMAL)
        writer.writeheader()
        for p in products:
            writer.writerow({k: p.get(k) for k in fieldnames})

Excel compatibility के लिए utf-8-sig encoding इस्तेमाल करें। BOM marker Excel को special characters बिगाड़ने से रोकता है।

JSONL — scraping pipelines के लिए production format:

import json
import gzip

def export_jsonl(products, filename="walmart_products.jsonl.gz"):
    with gzip.open(filename, "at", encoding="utf-8") as f:
        for p in products:
            f.write(json.dumps(p, ensure_ascii=False) + "\n")

JSONL crash-safe है (बीच में write रुकने पर सिर्फ last line खोती है), constant memory के साथ stream किया जा सकता है, और variants और reviews जैसे nested data को intact रखता है।

Excel — one-shot analyst hand-offs के लिए:

from openpyxl import Workbook

def export_excel(products, filename="walmart_products.xlsx"):
    wb = Workbook(write_only=True)
    ws = wb.create_sheet("Products")
    ws.append(["Name", "Price", "Availability", "Rating", "Reviews", "Seller"])
    for p in products:
        ws.append([p.get("name"), p.get("price"), p.get("availability"),
                    p.get("rating"), p.get("review_count"), p.get("seller")])
    wb.save(filename)

Thunderbit non-Python users के लिए export story को भी cover करता है: Google Sheets, Airtable, Notion, Excel, CSV, और JSON में one-click export — base tier में सब free। Ongoing monitoring के लिए Thunderbit का scheduled scraper feature recurring extractions automatically चला सकता है।

Scheduling पर एक caveat: Walmart scraping के लिए GitHub Actions का उपयोग न करें। GitHub Actions runners Azure IP ranges पर चलते हैं जिन्हें Walmart के anti-bot instant block कर देते हैं। APScheduler को VPS पर चलाएँ, या सारी traffic residential proxies से route करें।

Walmart Scraping के लिए Legal और Ethical Guidelines

Forum users इस चिंता को साफ़ शब्दों में कहते हैं: "मैं developers के साथ cat and mouse खेलने को लेकर तो ठीक हूँ, लेकिन उनकी legal team के साथ खेलने से सावधान हूँ."

Walmart Terms of Use स्पष्ट रूप से prohibit करते हैं कि बिना "express prior written consent" के "any robot, spider… or other manual or automatic device to retrieve, index, 'scrape,' 'data mine' or otherwise gather any Materials" का उपयोग किया जाए।

Walmart की robots.txt /search disallow करती है, साथ ही /account, /api/, और dozens of internal endpoints को भी। Product detail pages (/ip/...) और reviews (/reviews/product/) disallow नहीं हैं।

hiQ v. LinkedIn precedent (9th Circuit, 2022) ने स्थापित किया कि publicly available data scraping से federal CFAA का उल्लंघन होने की संभावना कम है। लेकिन उसी court ने बाद में फैसला दिया कि hiQ ने LinkedIn User Agreement का उल्लंघन किया और उसके खिलाफ $500,000 consent judgment दर्ज हुआ। 2024 के हालिया decisions (Meta v. Bright Data, X Corp. v. Bright Data) ने CFAA को और संकरा किया और copyright-preemption defenses बनाए, लेकिन वे rulings specific ToU language पर टिकी थीं जो Walmart पर साफ़ तौर पर लागू नहीं होतीं।

व्यावहारिक दिशानिर्देश: Servers पर बोझ न डालें। Rate limits का सम्मान करें। Personal या user data scrape न करें। Data का जिम्मेदारी से उपयोग करें। Modest rate पर public Walmart product pages scrape करना commercial scale पर Walmart Terms के खिलाफ scraping से बिल्कुल अलग risk profile है। अगर आप Walmart data पर कोई product बना रहे हैं, तो lawyer से बात करें और Walmart के official affiliate और seller APIs देखें।

Disclaimer: यह शैक्षिक जानकारी है, कानूनी सलाह नहीं।

निष्कर्ष और मुख्य बातें

Walmart को Python से scrape करना 9/10 difficulty challenge है, क्योंकि इसमें dual Akamai + PerimeterX anti-bot stack है। असंभव नहीं — लेकिन सही tools और patterns चाहिए।

मुख्य बातें:

  • ज़्यादातर use cases के लिए __NEXT_DATA__ JSON extraction ही सबसे व्यावहारिक विकल्प है। यही 2024–2026 के हर serious open-source Walmart scraper में है। Base path PDPs के लिए props.pageProps.initialData.data.product और search/browse के लिए searchResult.itemStacks है।
  • impersonate="chrome124" के साथ curl_cffi अनिवार्य है। साधारण requests या httpx, headers चाहे जो हों, Akamai के TLS fingerprinting को पास नहीं कर सकते।
  • Silent blocks असली खतरा हैं। Walmart CAPTCHA bodies के साथ 200 OK लौटाता है। सिर्फ status codes नहीं, response content भी check करें।
  • Production scrapers को happy-path code से कहीं ज़्यादा चाहिए। Exponential backoff with jitter, चार signals पर block detection, प्रति request 3–6 seconds की rate limiting, data validation, और session health monitoring सभी ज़रूरी हैं।
  • /orchestra/* के जरिए internal API interception शक्तिशाली है, लेकिन fragile भी। इसे specific data needs के लिए DevTools exercise की तरह इस्तेमाल करें, primary extraction method की तरह नहीं।
  • Walmart search results को 25 pages तक cap करता है। Sort-order flipping और price-range slicing से coverage बढ़ाएँ।
  • अपना approach ईमानदारी से चुनें: custom needs और high volume वाले developers के लिए DIY Python। मध्यम scale teams के लिए scraping API। और Thunderbit उन business users के लिए जो आज दोपहर Google Sheets में data चाहते हैं।

अगर आप no-code route आज़माना चाहते हैं, तो Thunderbit Chrome Extension का free tier है — आप Walmart pages की कुछ संख्या scrape करके खुद results देख सकते हैं। अगर आप Python route पर जा रहे हैं, तो इस article के code patterns production-tested हैं। किसी भी way से, अब आपके पास Walmart की defenses का map और उनके बीच से निकलने के तीन रास्ते हैं।

Web scraping techniques के बारे में और जानने के लिए, हमारे guides देखें: Python से web scrape कैसे करें, best automated web scraping tools, और blocked हुए बिना web scraping। आप Thunderbit YouTube Channel पर tutorials भी देख सकते हैं।

FAQs

क्या Walmart product data scrape करना legal है?

Walmart की Terms of Use बिना लिखित consent के automated scraping को prohibit करती हैं। 9th Circuit का hiQ v. LinkedIn ruling (2022) यह स्थापित करता है कि federal CFAA public pages scraping पर लागू होने की संभावना कम है, लेकिन उसी case का अंत scraper के खिलाफ $500,000 breach-of-contract judgment के साथ हुआ। Personal research के लिए modest rates पर public product pages scrape करने का risk profile commercial-scale extraction से बहुत अलग है। अगर आप Walmart data पर business बना रहे हैं, तो lawyer से सलाह लें।

मेरा Walmart scraper बार-बार block क्यों हो रहा है?

सबसे common causes हैं: साधारण requests या httpx का उपयोग (जो Python-specific TLS fingerprint भेजते हैं जिसे Akamai तुरंत flag कर देता है), गलत या missing headers, proxy rotation का अभाव, प्रति page 3–6 seconds से तेज़ request rates, और session cookies (_px3, _abck, locDataV3) का missing होना। impersonate="chrome124" के साथ curl_cffi पर जाएँ, residential proxies इस्तेमाल करें, और इस article में बताए गए block detection और retry patterns लागू करें।

मैं Python से Walmart से क्या data scrape कर सकता हूँ?

Product names, prices (current और rollback), images, short और long descriptions, ratings, review counts, stock availability status, seller names, manufacturer info, variant options (size, color), और category placement। __NEXT_DATA__ method से ये सब structured JSON के रूप में उपलब्ध हैं। Internal API interception अतिरिक्त रूप से variant-level pricing, real-time inventory counts, और paginated review data भी लौटा सकता है।

क्या Walmart scrape करने के लिए proxies की ज़रूरत है?

हाँ, production या repeated use के लिए। Walmart के anti-bot systems plain requests को लगातार block करते हैं — perfect headers के बावजूद non-residential IP Akamai के IP reputation system द्वारा flag कर दिया जाएगा। Residential या mobile proxies ज़रूरी हैं। Datacenter IPs लगभग तुरंत burn हो जाते हैं। Proxy provider और tier के हिसाब से लगभग $3–$17 प्रति 1,000 pages का budget रखें।

क्या मैं बिना code लिखे Walmart scrape कर सकता हूँ?

हाँ। Thunderbit एक AI-powered Chrome extension है जो Walmart को दो clicks में scrape करता है: auto-detect product data columns के लिए "AI Suggest Fields", फिर data निकालने के लिए "Scrape"। यह cloud में anti-bot challenges संभालता है और सीधे Excel, Google Sheets, Airtable, या Notion में export करता है — सब free। यह analysts, PMs, और business users के लिए सबसे उपयुक्त है जिन्हें custom pipeline बनाए बिना जल्दी data चाहिए। High-volume या highly customized scraping के लिए Python या scraping API अभी भी बेहतर विकल्प है।

AI से Walmart scraping के लिए Thunderbit आज़माएँ Get Started Free

और जानें

Shuai Guan
Shuai Guan
Thunderbit के CEO | AI डेटा ऑटोमेशन एक्सपर्ट Shuai Guan Thunderbit के CEO हैं और University of Michigan Engineering के पूर्व छात्र हैं। टेक और SaaS आर्किटेक्चर में लगभग दस वर्षों के अनुभव के आधार पर, वे जटिल AI मॉडल्स को ऐसे व्यावहारिक, बिना कोड वाले डेटा एक्सट्रैक्शन टूल्स में बदलने में माहिर हैं जो रोज़मर्रा के काम में तुरंत उपयोग किए जा सकें। इस ब्लॉग पर वे वेब स्क्रैपिंग और ऑटोमेशन रणनीतियों पर अपने सीधे, आज़माए हुए अनुभव साझा करते हैं, ताकि आप अधिक स्मार्ट और डेटा-आधारित वर्कफ़्लो बना सकें। जब वे डेटा वर्कफ़्लो को बेहतर बनाने में व्यस्त नहीं होते, तो वही बारीकी और पैनी नज़र वे अपनी फोटोग्राफी की रुचि में लगाते हैं।
विषय सूची

बस पूछकर एक वेबपेज स्क्रैप करें

जो चाहिए, उसे आसान अंग्रेज़ी में कहें। या उससे भी बेहतर, कुछ न कहें।

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