<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>163</id><slug>respecting-robots-txt-in-practice-part-9-163</slug><title>Respecting robots.txt in practice, part 9</title><excerpt>This is part 9 of our series, and this time we focus on edge cases readers asked about. robots.txt is a short text file with a long history. It tells automated clients which parts of a site the…</excerpt><seriesName>Respecting robots.txt in practice</seriesName><seriesPart>9</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 9 of our series, and this time we focus on edge cases readers asked about. robots.txt is a short text file with a long history. It tells automated clients which parts of a site the operator would prefer they left alone, and how quickly they should crawl the rest.</item></paragraphs></item><item><heading>Step by step</heading><paragraphs><item>Read the site's terms of service before you start. Many sites welcome automated access within limits and say so explicitly; others ask you to use an API instead.</item><item>Treat HTTP 429 responses as a signal, not an obstacle. Read the Retry-After header, back off, and resume at a slower pace.</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>Common pitfalls</heading><paragraphs><item>Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.</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>Fetch robots.txt before you crawl, honour Disallow rules and Crawl-delay values, and re-check it periodically because sites change their policies.</item></paragraphs></item></sections><authorId>4</authorId><authorName>Lucas Silva</authorName><authorSlug>lucas-silva</authorSlug><category>Ethics &amp; Law</category><tags><item>testing</item><item>python</item><item>json</item><item>selenium</item></tags><publishedAt>2024-06-19T00:00:00.000Z</publishedAt><wordCount>196</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
