How agent-fetch extraction strategies work
mainagent-fetch runs multiple extraction strategies in parallel and selects the most complete result based on content length and quality.
Supported Strategies
| Strategy | Description |
|---|---|
| Readability | Uses Mozilla's Reader View algorithm (strict + relaxed passes). Best for semantic HTML. |
| Text density | Uses statistical text-to-tag ratio analysis (CETD). Best for complex layouts. |
| JSON-LD | Parses schema.org structured data. Best for sites with rich metadata. |
| Next.js | Extracts from __NEXT_DATA__ props. Best for Next.js Pages Router. |
| React Server Components | Parses streaming RSC payloads. Best for Next.js App Router. |
| WordPress REST API | Fetches via /wp-json/wp/v2/ endpoints. Best for WordPress sites. |
| CSS selectors | Probes semantic containers like <article> or .post-content. Used as a fallback. |
Winner Selection Logic
- Strategies extracting 500+ characters are considered candidates.
- If text-density or RSC finds 2x more content than Readability, they win.
- Otherwise, the longest result is chosen.
- Metadata (author, date, site name) is composed from the best source for each specific field across all strategies.