{"data":{"id":176,"slug":"detecting-lazy-loaded-content-part-9-176","title":"Detecting lazy-loaded content, part 9","excerpt":"In part 9 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…","seriesName":"Detecting lazy-loaded content","seriesPart":9,"sections":[{"heading":"Introduction","paragraphs":["In part 9 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."]},{"heading":"What to watch for","paragraphs":["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.","Treat HTTP 429 responses as a signal, not an obstacle. Read the Retry-After header, back off, and resume at a slower pace."]},{"heading":"Going further","paragraphs":["Keep configuration such as base URLs, delays and selectors out of your code. Changing a delay should not require a redeploy.","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."]},{"heading":"Key takeaway","paragraphs":["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."]}],"authorId":9,"authorName":"Mateo Hughes","authorSlug":"mateo-hughes","category":"Browser Automation","tags":["selenium","json","playwright"],"publishedAt":"2025-03-12T00:00:00.000Z","wordCount":175,"readingTimeMinutes":2}}