<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>93</id><slug>exporting-scraped-data-to-csv-part-5-93</slug><title>Exporting scraped data to CSV, part 5</title><excerpt>Part 5 looks at what changes when the same technique has to run every day in production. CSV is the lingua franca of spreadsheets and the most common way scraped data leaves a project. It is also…</excerpt><seriesName>Exporting scraped data to CSV</seriesName><seriesPart>5</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>Part 5 looks at what changes when the same technique has to run every day in production. CSV is the lingua franca of spreadsheets and the most common way scraped data leaves a project. It is also surprisingly easy to produce a CSV that opens incorrectly.</item></paragraphs></item><item><heading>Putting it into practice</heading><paragraphs><item>Keep configuration such as base URLs, delays and selectors out of your code. Changing a delay should not require a redeploy.</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>Validate the data you extract. Prices without currencies, dates without time zones and empty fields are common sources of silent errors downstream.</item></paragraphs></item><item><heading>Step by step</heading><paragraphs><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><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>Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Use a proper CSV writer rather than joining strings, quote fields that contain commas or newlines, write UTF-8, and keep dates in ISO 8601.</item></paragraphs></item></sections><authorId>11</authorId><authorName>Oliver Kim</authorName><authorSlug>oliver-kim</authorSlug><category>Data Engineering</category><tags><item>selenium</item><item>javascript</item></tags><publishedAt>2024-01-23T00:00:00.000Z</publishedAt><wordCount>213</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
