<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>96</id><slug>detecting-lazy-loaded-content-part-5-96</slug><title>Detecting lazy-loaded content, part 5</title><excerpt>In part 5 we take the ideas from earlier instalments and apply them to a larger, messier site. Lazy loading defers images and sections until they are about to scroll into view. A script that reads…</excerpt><seriesName>Detecting lazy-loaded content</seriesName><seriesPart>5</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>In part 5 we take the ideas from earlier instalments and apply them to a larger, messier site. Lazy loading defers images and sections until they are about to scroll into view. A script that reads the page immediately sees placeholders instead of content.</item></paragraphs></item><item><heading>Going further</heading><paragraphs><item>Deduplicate as you go. The same item often appears on several listing pages, and a stable identifier such as a SKU or ID makes duplicates easy to spot.</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><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>Common pitfalls</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>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>Key takeaway</heading><paragraphs><item>Scroll the element into view and wait for its real attributes to appear, or read the data-src style attributes that hold the eventual values.</item></paragraphs></item></sections><authorId>9</authorId><authorName>Mateo Hughes</authorName><authorSlug>mateo-hughes</authorSlug><category>Browser Automation</category><tags><item>javascript</item></tags><publishedAt>2026-09-05T00:00:00.000Z</publishedAt><wordCount>213</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
