Skip to main content
The Newspaper4k extractor is a fast, general-purpose content extractor optimized for news articles and blog posts. It automatically identifies article structure and extracts metadata (author, date, keywords, images) without configuration.

Configuration

Enable in EXTRACTOR_ORDER:

Extracted Fields

Standard Fields

title
string
Article title (extracted from <h1>, <title>, or meta tags)Falls back to title_hint if extraction fails.
content
string
Main article text (cleaned, no ads/navigation)Validation: Min 100 characters
author
string
Author name(s) (comma-separated if multiple)Extracted from:
  • <meta name="author">
  • rel="author"
  • Common author class names
published_date
datetime
Publication dateExtracted from:
  • <time> elements
  • <meta property="article:published_time">
  • URL patterns

Metadata Fields

metadata.top_image
string
Main article image URLExtracted from:
  • <meta property="og:image">
  • <img> tags within article
metadata.keywords
string[]
Extracted keywords (auto-generated from content)
metadata.summary
string
Auto-generated article summary

Example Output

Fallback Behavior

Newspaper fails when title extraction fails (without title_hint), content is < 100 characters, or HTML structure is non-semantic. Configure fallback extractors in EXTRACTOR_ORDER.

Title Hints

The spider can provide a title_hint from other sources: Example: Link text from parent page
If newspaper fails to extract title, it uses the hint.

When to Use

Use Newspaper When:

Well-structured news websites
Blog platforms (WordPress, Medium, Ghost)
Semantic HTML with proper tags
Need automatic metadata extraction

Don’t Use Newspaper When:

E-commerce sites (use custom extractors)
Forums or discussion boards (use callbacks)
Heavily customized layouts (use custom selectors)
JavaScript-rendered content (use playwright first)

Debugging

Check if newspaper succeeded:
Look for source: newspaper4k in output. Test on sample page:
If extraction fails:
  1. Check if content is in semantic tags (<article>, <main>, <p>)
  2. Try trafilatura as fallback
  3. Use custom selectors if generic extractors fail

Configuration Examples

News Site (Primary Strategy)

Blog with Custom Fallback