<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>64</id><slug>building-a-polite-scrapy-spider-part-4-64</slug><title>Building a polite Scrapy spider, part 4</title><excerpt>This is part 4 of our series, and this time we focus on edge cases readers asked about. Scrapy makes it very easy to send thousands of requests a minute. Making a spider that a site operator would be…</excerpt><seriesName>Building a polite Scrapy spider</seriesName><seriesPart>4</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 4 of our series, and this time we focus on edge cases readers asked about. Scrapy makes it very easy to send thousands of requests a minute. Making a spider that a site operator would be happy to see in their logs takes a few deliberate settings.</item></paragraphs></item><item><heading>Going further</heading><paragraphs><item>Deduplicate as you go. The same item often appears on several listing pages, and a stable identifier such as a SKU or ID makes duplicates easy to spot.</item><item>Keep configuration such as base URLs, delays and selectors out of your code. Changing a delay should not require a redeploy.</item></paragraphs></item><item><heading>A practical approach</heading><paragraphs><item>Validate the data you extract. Prices without currencies, dates without time zones and empty fields are common sources of silent errors downstream.</item><item>Pagination comes in several shapes: numbered pages, next links, offsets and opaque cursors. Each has trade-offs, and a robust scraper should detect the end of the result set rather than assuming a fixed number of pages.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Turn on ROBOTSTXT_OBEY, set AutoThrottle, use a descriptive User-Agent with contact details, and cache responses while you develop.</item></paragraphs></item></sections><authorId>9</authorId><authorName>Mateo Hughes</authorName><authorSlug>mateo-hughes</authorSlug><category>Scraping Basics</category><tags><item>ethics</item></tags><publishedAt>2024-06-27T00:00:00.000Z</publishedAt><wordCount>175</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
