Skip to content

feat(utils): add schema.org microdata parser - #3465

Open
haroldfabla2-hue wants to merge 1 commit into
apify:masterfrom
haroldfabla2-hue:feature/schema-org-microdata-parser
Open

feat(utils): add schema.org microdata parser#3465
haroldfabla2-hue wants to merge 1 commit into
apify:masterfrom
haroldfabla2-hue:feature/schema-org-microdata-parser

Conversation

@haroldfabla2-hue

Copy link
Copy Markdown

Summary

Adds a new function to extract schema.org structured data (microdata) from HTML pages, following the existing pattern of .

Changes

  • New file:
  • Exports function and constant
  • Supports common schema.org properties: name, description, url, image, price, author, etc.
  • Extracts all items with nested properties
  • Handles aggregateRating and offers schemas
  • Compatible with both raw HTML strings and CheerioAPI objects

Usage

import { parseSchemaOrg } from 'crawlee';

// From raw HTML
const result = parseSchemaOrg(html);

// From CheerioAPI
const result = parseSchemaOrg($);

// Result structure:
// {
//   items: [...],        // All itemscope items found
//   properties: {...}    // Common properties extracted globally
// }

Closes #276

- Add parseSchemaOrg function for extracting schema.org structured data
- Supports common properties: name, description, url, image, price, etc.
- Extracts itemscope items with nested properties
- Handles aggregateRating and offers schemas
- Follows existing open_graph_parser pattern

Closes apify#276
@tomvonclef

Copy link
Copy Markdown

nice, but surely something like this should include tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Idea: we could add function to extract schema.org microdata from a page

4 participants