<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>7</id><slug>extracting-json-ld-from-product-pages-7</slug><title>Extracting JSON-LD from product pages</title><excerpt>Many product pages already contain a clean, structured description of themselves in a script tag meant for search engines. Reading it is often more reliable than parsing the visible HTML.</excerpt><seriesName>Extracting JSON-LD from product pages</seriesName><seriesPart>1</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>Many product pages already contain a clean, structured description of themselves in a script tag meant for search engines. Reading it is often more reliable than parsing the visible HTML.</item></paragraphs></item><item><heading>Common pitfalls</heading><paragraphs><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><item>Character encodings still cause trouble. Decode responses using the charset the server declares, and normalise text before comparing or storing it.</item></paragraphs></item><item><heading>Step by step</heading><paragraphs><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><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></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Select script[type='application/ld+json'], parse every block, and pick the one whose @type matches what you need. Fall back to HTML only for missing fields.</item></paragraphs></item></sections><authorId>5</authorId><authorName>Chen Patel</authorName><authorSlug>chen-patel</authorSlug><category>Data Engineering</category><tags><item>ethics</item></tags><publishedAt>2025-05-17T00:00:00.000Z</publishedAt><wordCount>164</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
