When to use an API instead of scraping
If a site offers an API for the data you need, scraping its HTML is usually the harder, more fragile and less polite option.
Showing 49–60 of 68 articles
If a site offers an API for the data you need, scraping its HTML is usually the harder, more fragile and less polite option.
Part 10 looks at what changes when the same technique has to run every day in production. If a site offers an API for the data you need, scraping its HTML is usually the harder, more fragile and less…
Part 8 looks at what changes when the same technique has to run every day in production. A selector that worked yesterday and fails today is usually a selector that depended on something nobody…
Part 2 looks at what changes when the same technique has to run every day in production. Lazy loading defers images and sections until they are about to scroll into view. A script that reads the page…
For part 8, we revisit the basics with a fresh example and a few lessons learned the hard way. When the data you want is several levels deep and the markup has few useful attributes, XPath's ability…
For part 10, we revisit the basics with a fresh example and a few lessons learned the hard way. A well-behaved API tells you how many requests you have left before it starts saying no. Reading those…
For part 7, we revisit the basics with a fresh example and a few lessons learned the hard way. If a site offers an API for the data you need, scraping its HTML is usually the harder, more fragile and…
This is part 10 of our series, and this time we focus on edge cases readers asked about. Infinite scroll replaces the familiar Next button with a page that keeps growing as you move down it, which…
For part 6, we revisit the basics with a fresh example and a few lessons learned the hard way. Before you crawl a site link by link, check whether it already publishes a list of every page it wants…
For part 4, we revisit the basics with a fresh example and a few lessons learned the hard way. Many product pages already contain a clean, structured description of themselves in a script tag meant…
In part 4 we take the ideas from earlier instalments and apply them to a larger, messier site. Tables look like the easiest thing on a page to scrape, until you meet merged cells, header rows that…
For part 2, we revisit the basics with a fresh example and a few lessons learned the hard way. Before you crawl a site link by link, check whether it already publishes a list of every page it wants…