Skip to content

Content extractor — jsoup content + metadata extraction#12

Merged
hendrikebbers merged 3 commits into
mainfrom
feat/006-content-extractor
Jul 12, 2026
Merged

Content extractor — jsoup content + metadata extraction#12
hendrikebbers merged 3 commits into
mainfrom
feat/006-content-extractor

Conversation

@herbie-bot

Copy link
Copy Markdown
Collaborator

Summary

ContentExtractor turns raw HTML into an ExtractedContent (clean body + metadata) using jsoup: it selects the main container via the source's contentSelector (comma fallback; body = whole doc; readability fallback), always strips scripts/styles/comments, removes contentExclude elements, and whitespace-normalizes the body. Metadata (title, excerpt, date, author, categories, preview image, locale) is read independently from OpenGraph/Article <meta>, JSON-LD, and <time>. No indexing yet (spec 008).

Spec

  • docs/specs/006-content-extractor/{design,behaviors,steps}.md

Changes

  • ExtractedContent record
  • ContentExtractor — body selection/cleaning + structured metadata extraction (metadata read before scripts are stripped, so JSON-LD survives)

Test coverage

  • 14 behavioral scenarios (selector/fallback/body/strip/exclude/whitespace/readability + OG/JSON-LD/tags/locale/graceful-degradation/empty). 66 tests total; spec-review and quality-review clean.

Closes #11

🤖 Generated with Claude Code

- ExtractedContent record (body + title/excerpt/author/categories/
  publishedDate/previewImage/locale; categories normalized).
- ContentExtractor (@component, ContentLocaleResolver + ObjectMapper):
  reads metadata before stripping scripts (JSON-LD survives), then strips
  script/style/noscript/template + comments; selects the container via
  contentSelector (comma fallback, body = whole doc, readability fallback),
  removes contentExclude, and whitespace-normalizes to block-separated body.
  Metadata from OpenGraph/Article meta, JSON-LD (arrays/@graph), and
  <time datetime>; locale via the path rule.
- ContentExtractorTest: 14 cases (selection/cleaning + metadata + edges).
  66 tests green.
- steps.md; refresh CLAUDE.md.

Refs #11
@hendrikebbers hendrikebbers merged commit 3b44f5c into main Jul 12, 2026
1 check passed
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.

Content extractor — jsoup content + metadata extraction

2 participants