<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>41</id><slug>parsing-html-tables-with-beautifulsoup-part-3-41</slug><title>Parsing HTML tables with BeautifulSoup, part 3</title><excerpt>This is part 3 of our series, and this time we focus on edge cases readers asked about. Tables look like the easiest thing on a page to scrape, until you meet merged cells, header rows that repeat…</excerpt><seriesName>Parsing HTML tables with BeautifulSoup</seriesName><seriesPart>3</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 3 of our series, and this time we focus on edge cases readers asked about. Tables look like the easiest thing on a page to scrape, until you meet merged cells, header rows that repeat every twenty lines and numbers formatted for humans rather than machines.</item></paragraphs></item><item><heading>Going further</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>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>Putting it into practice</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>Selectors are the most fragile part of any scraper. Prefer stable attributes such as data-testid or semantic structure over generated class names, which can change on every deploy.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Locate the table by a stable attribute, read the header row once, and convert every cell to a typed value before you store it.</item></paragraphs></item></sections><authorId>4</authorId><authorName>Lucas Silva</authorName><authorSlug>lucas-silva</authorSlug><category>Scraping Basics</category><tags><item>javascript</item><item>python</item><item>json</item></tags><publishedAt>2024-11-25T00:00:00.000Z</publishedAt><wordCount>180</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
