Back to feed
Dev.to
Dev.to
7/24/2026
Half the web already hands you clean product data. You just have to ask.

Half the web already hands you clean product data. You just have to ask.

Short summary

A developer explains how many e-commerce pages already embed clean, structured product data in JSON-LD script blocks — published for Google rich results but equally useful for scraping. The post provides a Node.js function using cheerio to parse JSON-LD Product objects, extracting name, SKU, price, currency, and availability without fragile CSS selectors. The author advocates a preference order: JSON-LD first, OpenGraph and microdata second, hand-written selectors last.

  • Many e-commerce pages embed structured product data in JSON-LD blocks meant for Google rich results
  • A cheerio-based function extracts product fields (name, price, availability) from these blocks in one parse
  • Preference order: JSON-LD first, OpenGraph/microdata second, CSS selectors last — higher up the stack means longer scraper lifespan

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more