<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>137</id><slug>reading-sitemaps-to-discover-urls-part-7-137</slug><title>Reading sitemaps to discover URLs, part 7</title><excerpt>This is part 7 of our series, and this time we focus on edge cases readers asked about. Before you crawl a site link by link, check whether it already publishes a list of every page it wants found.…</excerpt><seriesName>Reading sitemaps to discover URLs</seriesName><seriesPart>7</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 7 of our series, and this time we focus on edge cases readers asked about. Before you crawl a site link by link, check whether it already publishes a list of every page it wants found. That list is usually called sitemap.xml.</item></paragraphs></item><item><heading>What to watch for</heading><paragraphs><item>Write small, focused tests for your parsers using saved HTML fixtures. They run in milliseconds and catch layout changes long before a full crawl would.</item><item>Log every request with its URL, status code and duration. When something goes wrong at two in the morning, those logs are the difference between a quick fix and a long investigation.</item></paragraphs></item><item><heading>Putting it into practice</heading><paragraphs><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>Be careful with relative URLs. Resolve every link against the page it came from, not against the site root, or you will request pages that do not exist.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Look for the Sitemap line in robots.txt, follow sitemap index files to their children, and use lastmod to skip pages that have not changed.</item></paragraphs></item></sections><authorId>6</authorId><authorName>Sofia Fischer</authorName><authorSlug>sofia-fischer</authorSlug><category>Scraping Basics</category><tags><item>selenium</item><item>playwright</item><item>python</item><item>ethics</item></tags><publishedAt>2023-11-26T00:00:00.000Z</publishedAt><wordCount>176</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
