You run the script at 6 a.m., open the output file, and the price column is blank. The request returned HTTP 200, the page renders fine in Chrome, and the same selector worked last week. Nothing in the log looks like a failure, which is exactly the problem.
Before you touch the parser, answer one question. Where does the number come from? Three answers cover nearly every site. The value sits in the HTML the server sends, so an HTTP client plus a parser gets it. The value is built by JavaScript after the page loads, so you need a browser or the request the render depends on. Or the value arrives as JSON from an internal endpoint the front end calls, which you can usually call directly.
The eight web scraping examples below are organised around that decision, not around a tool ranking. Each one answers a specific question. Static or rendered, selectors or schema, visible HTML or hidden JSON.
The rule that saves the most time is simple: pick the cheapest method that returns the data reliably. A rendering browser that takes four seconds per page is waste when requests returns the same numbers in 200 milliseconds.
1. Static HTML Scraping with Requests and BeautifulSoup (Python)
If the price appears when you open View Page Source, the tool decision is already made. requests fetches the HTML, BeautifulSoup parses it, and CSS selectors pull the fields. No browser, no JavaScript engine, no proxy budget. Static parsing covers more of the web than any other method here, and it costs almost nothing to run at volume.

The workflow is short. Send a GET with a descriptive User-Agent, call raise_for_status(), pass response.text into BeautifulSoup, loop over soup.select('.product-card'), and write each dict to CSV or JSON. quotes.toscrape.com exists for exactly this exercise: ten quotes, stable markup, no JavaScript. A static product catalogue feeding a small price-tracking script follows the same shape.
Check the raw HTML first
Grep the response for the value you expect before you write a single selector. If the string isn't in the payload, no selector will find it, and you're looking at a rendering problem rather than a parsing problem. That check separates this method from every browser-based approach below.
A few habits keep the parser alive:
- Send a real User-Agent: a descriptive string with a project name beats a spoofed Chrome string, and it pairs with honest robots.txt handling and the site's terms.
- Set a timeout:
requests.get(url, timeout=10)turns a hung socket into a retryable error instead of a stuck job. A guide to Python requests timeouts for reliable scraping covers the retry and backoff side. - Prefer stable selectors: data attributes and semantic IDs survive redesigns;
div > div:nth-child(3) > spandoesn't. - Handle the empty case: a missing node should produce a null field and a logged warning, never a silent skip.
A 200 response means the server answered. It says nothing about whether your data is in the body.
2. Full-Crawl Pipelines with Scrapy
A job stops being a single page fetch and becomes a nightly sweep of an entire catalogue, and the script stops being the right shape. Scrapy is built for that shift. A spider class declares start URLs and a parse callback that yields items or new requests, while the framework handles scheduling, concurrency, retries, deduplication and throttling.
The pattern scales further than many projects ever need. Common Crawl has run it since 2008, swapped its custom crawler for an Apache Nutch-based CCBot in 2013, and moved to the WARC archival format. Its archive now exceeds 10 petabytes, and recent monthly crawls typically hold more than 2 billion pages, according to Common Crawl's project history. That's the same loop you'll write for a 40-page catalogue, with storage and quality controls bolted on.
When one page becomes a crawl
Start with books.toscrape.com, which paginates cleanly and gives you a thousand items to practise deduplication on. Then move to a practical case: a daily competitor catalogue crawl exporting a feed into a warehouse, where the hard part isn't extraction but keeping the schema stable across a thousand URLs.
Scrapy's defaults will get you blocked if you don't touch them:
- Throttle: set
DOWNLOAD_DELAYand enableAUTOTHROTTLE_ENABLEDso the framework slows when the site does. - Cap test runs:
CLOSESPIDER_ITEMCOUNTorCLOSESPIDER_PAGECOUNTstops a development run before it reaches production volume. - Cache while developing:
HTTPCACHE_ENABLEDsaves every response to disk, so parser changes don't re-hit the site. - Validate in pipelines: drop malformed records in an Item Pipeline instead of discovering them in the warehouse a week later.
The framework won't tell you the data went stale. Your pipeline has to.
3. JavaScript-Rendered Pages with Playwright
Your 200 response contained a shell. A <div id="root">, a bundle reference, and none of the products. The grid renders after JavaScript runs, so no parser can see it.

Playwright opens the page in a real Chromium, Firefox or WebKit browser through one API, available in Python, Node.js, Java and .NET, and hands you the DOM after the client code finishes. It's the standard answer for single-page apps, infinite scroll, and anything loaded by a client-side call.
Rendered pages, real browser
The sequence that works: page.goto() with domcontentloaded, then page.wait_for_selector('.product-grid') or a response wait on the endpoint the grid depends on, then page.evaluate() to map cards into objects. Waiting on the network response beats waiting on a selector when the selector paints before its data arrives.
A React product listing is the standard case. Wait for the grid, extract rendered cards, move on. The better version of the same job intercepts the JSON the grid fetched while scrolling and saves the payloads, which is faster and immune to markup changes.
Four settings cut most of the cost:
- Block heavy assets: route handlers that abort images, fonts and media can halve load time.
- Wait on conditions, not clocks: fixed sleeps fail on slow pages and waste time on fast ones.
- Reuse the browser: launch once, create a fresh context per session, close the context rather than the browser.
- Inspect the network first: the endpoint behind the render is usually cheaper than the render itself.
Rendering is correct when the page needs a browser. It's wasteful when it's a habit, because every page costs memory, seconds and proxy bandwidth.
4. Browser Automation with Selenium WebDriver
A public procurement board hides award rows behind a search form. Pick a year, submit, then page through the table. The first HTML response has no results, and a one-shot page load never presses Submit. Selenium is the right call when the data only exists after those actions.
It is the oldest tool in this set, and large enterprises still keep it. WebDriver, a W3C standard, drives Chrome, Firefox and Edge, so the same script moves between them with a driver swap. The decision is interaction, not markup: submit a public search, step through pagination, or wait while a report file generates on a page anyone can open.
Rank tracking is the parallel case. Selenium Grid spreads sessions across browser instances. Each session opens a public results page, reads the listing, and exits. Both jobs share one rule. A visitor could do the same clicks without an account.
Where automation crosses a line
Logging in changes the legal picture, and not only for European teams. The European Data Protection Board's guidance on web scraping states that GDPR can apply where scraping involves personal-data operations such as collection, storage, organization or retrieval. Publicly reachable pages and spaces that need circumvention to enter carry very different risk, and a login is the clearest line between them.
If you had to bypass a password, a paywall challenge or an access control to reach the data, that's the point to stop and route the target through a human review, not a retry loop.
The public workflow is short. Load the form, fill only fields a visitor can fill, then WebDriverWait with expected_conditions until the table or the generated file link is present. That wait replaces every time.sleep(). Close the driver in a finally block so orphaned Chrome processes do not pile up.
Selenium is slower and heavier than an HTTP client. I use it where the click is the requirement, and I send anything behind a login to a person instead of a retry loop.
5. Node.js Static Parsing with Cheerio
The same page that needs BeautifulSoup in Python needs Cheerio in Node. Cheerio implements a subset of jQuery's core API on the server, and it never renders anything, which is why it's fast: no browser, no layout, no external resource loading. Pair it with fetch or axios, download the HTML, and query with $('.product h2').text().
Two practical uses. A serverless function that pulls headlines and publication dates from a static news section and writes them to a queue. A nightly inventory snapshot that parses server-rendered product pages for a retail team, where the markup has barely changed in years because the store's search visibility depends on it.
The JavaScript counterpart
The failure modes differ from Python's, mostly because Node makes it trivial to fire thousands of requests at once. Cheerio itself is synchronous and cheap; the concurrency around it is the risk.
- Limit parallelism: wrap requests with
p-limitor a queue and keep the pool small. A modest pool of concurrent requests finishes a catalogue faster than a huge one that all gets blocked. - Set headers once: a realistic
User-AgentandAccept-Languageon every request, applied in a shared client rather than copy-pasted per call. - Normalise text at extraction:
$.text()returns whitespace and non-breaking spaces. Trim, collapse with a regex, then write the value. - Guard empty selections:
$('.price').attr('data-value')returnsundefinedwhen the node is missing. Check length first, log the URL, and continue.
Cheerio is not a crawler. It parses a string you already have, so scheduling, retries and caching are your job, and that's where the naive Node scraper falls over.
6. Headless Chrome Automation with Puppeteer
Puppeteer is the Chrome team's Node library for driving Chrome or Chromium over the DevTools Protocol. It renders JavaScript-heavy pages, captures screenshots, generates PDFs, and evaluates extraction logic inside the page context with page.evaluate(). If your stack is Node and the page needs a browser, this is the shortest path.
Two jobs it does better than anything else: rendering price-by-date grids on hotel and flight listing pages that update after a search submission, and generating PDF snapshots of competitor landing pages for a compliance archive.
Rendering at Node scale
waitUntil: 'networkidle2' or an explicit waitForSelector handles dynamic content. Fixed delays break the moment the site slows down. The operational side matters more than the API:
- Pool browsers: launching Chrome costs hundreds of megabytes and a second or two. Reuse instances, close pages promptly, cap concurrency per instance.
- Abort what you don't need: block image, font and media requests to cut load time and bandwidth.
- Restart on a schedule: run under a process manager that recycles the browser process every N pages, because Chrome leaks memory over long runs.
- Return typed data: have
page.evaluate()return a plain array of objects, then validate before writing.
Puppeteer and Playwright solve the same problem with different ergonomics. Playwright ships three browser engines and a stronger auto-wait model; Puppeteer tracks Chrome closely with a smaller footprint. The trade-offs, including selector engines and context isolation, are covered in Playwright vs Puppeteer, a developer's deep dive.
Neither fixes the core cost. A rendered page is a browser session, and a browser session at scale is an infrastructure problem before it's a scraping problem.
7. Capturing Hidden JSON APIs with Requests and Network Inspection
A search page shows 24 product cards. The HTML is a shell. Prices, stock and the next page live in a Fetch/XHR response the browser already made. The decision is HTML or hidden JSON. If that response is application/json and holds the fields you need, call the same endpoint with requests and skip the render.

Open DevTools, switch to Network, filter Fetch/XHR, reload, and look for application/json. That payload is what the front end renders. Carry the headers and cookies the call needs, then read structured fields instead of walking markup. Drop anything the request does not require once the copy works.
Read the network tab before you render
The front end paginates by calling a search endpoint with page=2. Same query parameters, same JSON, and no selector to break when a class name changes. A rendered page would start a browser, wait for paint, and parse markup for those same 24 rows. Hidden JSON is the cheaper path when the endpoint stays put. Government dashboards that serve exchange-rate or statistics data follow the same pattern, and they tend to change less often than retail templates.
Identity is what fails after the fetch works. Retail price monitoring is usable only if each row maps to one product across stores. A comparison of 24,394 products sold across Amazon, Walmart, Target and Best Buy found that among items carried by at least four retailers, choosing one retailer at random left shoppers paying an average of 15.6% more than the lowest listed price, per this product price analysis. Matching on title alone conflates pack sizes, variants and accessories, so store the retailer ID, brand, model number and normalised attributes next to the price, and keep the raw payload for audit.
The inspection step itself is quick to learn.
Watch the video on YouTube- Filter by type: Fetch/XHR first, then look for
application/jsonresponses with the fields you want. - Copy as cURL: reproduce headers and cookies exactly, then strip anything the request doesn't need.
- Validate the schema: check required keys on every response so a renamed field fails loudly instead of writing nulls.
- Confirm it's public: an endpoint your browser reaches without credentials is still subject to the site's terms of service.
8. LLM-Powered Structured Extraction to Markdown or JSON
Selectors break when the layout changes. A model reading the same page often still finds the price, because it matches meaning rather than markup. That's the trade: you swap brittle selectors for per-page inference cost and non-deterministic output.

The pipeline is fetch, clean, convert to Markdown or reduced HTML, send with a JSON schema, validate the response. It fits sites whose layouts churn, one-off research extraction across many domains, and anything feeding an agent or a retrieval index.
Schema instead of selectors
Production users exist outside scraping startups. The U.S. Census Bureau's SABLE program converts financial report PDFs to text, then uses models to locate tables by the positions of informative word sequences, collecting state tax revenue, pension and building-permit data, as described in the Census SABLE paper. Its evaluation criteria make a useful checklist before replacing an existing collection: feasibility, data quality, cost, timeliness, transparency, required skills, sustainability and risk.
Industry reporting on scraping pipelines puts accuracy, freshness and consistency at the centre of quality, and describes AI as a layer around validated pipelines rather than a replacement for parsers, according to Apify's State of Web Scraping report. That framing holds. Keep a deterministic selector on a sample of pages and compare it against model output through rollout.
- Strip the page first: remove nav, scripts and footers to cut tokens and noise before the model sees anything.
- Enforce a schema: Pydantic or Zod validation on every response, no exceptions for confident-looking output.
- Cache by URL and content hash: repeated runs over unchanged pages shouldn't pay twice.
- Quarantine low-confidence rows: route them to human review instead of the warehouse.
Browser automation with LLMs covers the integration side once extraction works.
How the eight web scraping methods compare
| Item | Best for | Renders JavaScript | Relative cost | Skill level |
|---|---|---|---|---|
| Static HTML Scraping with Requests and BeautifulSoup (Python) | Static pages and beginner scraping | No | Low | Beginner |
| Full-Crawl Pipelines with Scrapy | Large-scale, recurring crawls | No, not natively | Low to moderate | Intermediate |
| JavaScript-Rendered Pages with Playwright | Single-page apps and dynamic content | Yes | High | Intermediate |
| Browser Automation with Selenium WebDriver | Form-driven sites and legacy workflows | Yes | High | Intermediate |
| Node.js Static Parsing with Cheerio | Fast parsing of static HTML in Node.js | No | Low | Beginner |
| Headless Chrome Automation with Puppeteer | JavaScript-heavy pages in Chromium | Yes | High | Intermediate |
| Capturing Hidden JSON APIs with Requests and Network Inspection | Structured data from site APIs | No | Low | Intermediate |
| LLM-Powered Structured Extraction to Markdown or JSON | Flexible extraction across changing layouts | Depends on the page-fetching method | High | Intermediate |
Choosing the Right Method and Testing It Before You Scale
Work down a short ladder and stop at the first rung that returns the data. Open View Page Source: if the value is there, use requests and BeautifulSoup and spend your time on validation instead. If it's missing, open the Network tab before opening a browser, because a JSON endpoint you can call with the right headers is the cheapest reliable method on the web. Only when neither works do you render, and then only for the pages that need it.
That order matters because the cost gap is an order of magnitude, not a rounding error. A static parse costs milliseconds and a few kilobytes. A rendered page costs a browser session, hundreds of megabytes of memory, seconds of wall clock and proxy bandwidth. Pointing a browser at a site that serves its prices in HTML is money spent for identical data.
Before you build a pipeline, run one example end to end on a practice site and measure two numbers: success rate and cost per page. Success rate is correctly extracted rows divided by URLs attempted, counted after validation rather than after HTTP 200. Cost per page includes retries, proxy traffic and the minutes you'll spend repairing selectors over the next quarter. If a stable target can't hold a high success rate, the method is wrong, not the selector.
Then repeat the test on your real target with a sample of 50 URLs before you commit to a schedule. Mix in the awkward ones: a category page with a filter applied, a product with no stock, a listing that paginates past page ten. Those are the URLs that decide whether your success rate survives contact with production.
Teams that would rather not operate browser fleets can test the alternative: Scrappey gives you 150 free scrapes to start with no card needed, enough to compare proxied HTTP against full-browser mode on your own targets before committing to either. Failed full-browser scrapes aren't charged, so a broken target doesn't eat the budget you set aside for learning which method fits.
One last piece of discipline: log the source URL, the fetch timestamp and the method used for every row you store. When a number looks wrong three weeks later, that metadata is the difference between a five-minute check and a full re-scrape.
Scrappey puts both of the modes this article describes behind one API: direct HTTP requests for static pages and JSON endpoints, and full Chrome or Firefox automation with residential proxies for pages that only exist after JavaScript runs. You can point either mode at the URL that broke your script this week, compare the output against the method you picked from the list, and keep whichever costs less per valid row. Start with the free tier at Scrappey and measure it the same way you'd measure your own scraper.



