<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>1</id><slug>parsing-html-tables-with-beautifulsoup-1</slug><title>Parsing HTML tables with BeautifulSoup</title><excerpt>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.</excerpt><seriesName>Parsing HTML tables with BeautifulSoup</seriesName><seriesPart>1</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>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>Character encodings still cause trouble. Decode responses using the charset the server declares, and normalise text before comparing or storing it.</item><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>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>Step by step</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>Always identify your client honestly with a descriptive User-Agent, and keep your request rate modest. A crawler that behaves like a considerate visitor is far less likely to cause problems for the site operator.</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>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>2</authorId><authorName>Noah Bennett</authorName><authorSlug>noah-bennett</authorSlug><category>Scraping Basics</category><tags><item>scrapy</item><item>python</item><item>testing</item></tags><publishedAt>2025-08-20T00:00:00.000Z</publishedAt><wordCount>224</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
