Skip to main content

PyPI version Downloads Python versions License CI

news-fetch

Python news scraper & article extractor — extract title, text, authors, date, image, and publisher from any news URL. No API key. Confidence scores included.

Fetch news. Know why it worked.

pip install news-fetch
from newsfetch import fetch

article = fetch("https://www.thehindu.com/...")
print(article.title)
print(article.text)
print(article.authors)
print(article.published_at)
print(article.image)
print(article.confidence.overall)   # 0.0–1.0
print(article.content_source)       # e.g. json-ld.articleBody
news-fetch https://example.com/article
news-fetch https://example.com/article --json
news-fetch batch urls.txt -o articles.jsonl

Why news-fetch?

A lightweight alternative to newspaper3k / newspaper4k / trafilatura wrappers — with its own extraction engine, confidence scores, and bulk + proxy support.

Feature news-fetch
News article extraction (title, body, authors, date, image)
Confidence scores + extraction provenance
Bulk scraping (fetch_many / fetch_iter / CLI JSONL)
Proxy + proxy rotation for thousands of URLs
RSS / sitemap article discovery
Async (pip install news-fetch[async])
Optional browser render (pip install news-fetch[browser])
Disk cache + robots.txt respect
No API key / no account
Small deps (lxml, requests, python-dateutil, cssselect)

Install

pip install news-fetch
pip install news-fetch[async]     # httpx async fetch
pip install news-fetch[browser]   # Playwright fallback (then: playwright install chromium)

Requirements: Python 3.10+


Quick start

Single URL

from newsfetch import fetch

article = fetch(url)
print(article.title, article.text, article.confidence.overall)

From HTML (no network)

from newsfetch import extract

article = extract(html_bytes, url="https://example.com/story")

Bulk scraping + proxies

from newsfetch import fetch_many, fetch_iter

results = fetch_many(
    urls,
    max_workers=20,
    proxies=["http://user:pass@p1:8080", "http://user:pass@p2:8080"],
    request_delay=0.05,
)

for url, article in fetch_iter(urls, max_workers=16):
    if article:
        print(article.title)

Strict mode (production pipelines)

from newsfetch import fetch, LowConfidenceExtractionError

try:
    article = fetch(url, strict=True)
except LowConfidenceExtractionError as e:
    print(e.failed_fields, e.confidence.overall)

Discovery (RSS / sitemaps)

from newsfetch import discover

for item in discover("https://www.bbc.com", limit=10):
    print(item["url"], item.get("title"))

Async

from newsfetch import fetch_async, fetch_many_async

article = await fetch_async(url)
articles = await fetch_many_async(urls, max_concurrency=50, proxies=PROXIES)

CLI

news-fetch https://example.com/article
news-fetch get URL --json
news-fetch batch urls.txt -o out.jsonl --workers 20
news-fetch discover https://www.theguardian.com --limit 10

Cache / robots / browser

from newsfetch import fetch, Config, NewsFetcher

fetch(url, cache=True, respect_robots=True)
fetch(url, render=True)                      # needs news-fetch[browser]
fetch(url, browser_fallback=True)            # retry with Playwright if confidence is low

Custom strategy plugin

from newsfetch import NewsFetcher, CallableStrategy
from newsfetch.strategies.base import Candidate

def my_strategy(doc):
    return {"title": [Candidate("Custom", "plugin.custom", 0.99)]}

fetcher = NewsFetcher()
fetcher.register_strategy(CallableStrategy("custom", my_strategy))

Article fields

url · canonical_url · title · description · text · authors · published_at · modified_at · publisher · language · image · keywords · section · summary · word_count · reading_time_minutes · page_type · is_article · confidence · extraction · sources

article.to_dict()
article.to_json()

Links

MIT License · Built for developers who need reliable Python news scraping without an API.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

news_fetch-1.0.0.tar.gz (40.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

news_fetch-1.0.0-py3-none-any.whl (48.4 kB view details)

Uploaded Python 3

File details

Details for the file news_fetch-1.0.0.tar.gz.

File metadata

  • Download URL: news_fetch-1.0.0.tar.gz
  • Upload date:
  • Size: 40.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.0

File hashes

Hashes for news_fetch-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ec9ec39378a82ff9fba966d191aa2d86d5a9d9483f3ab0bc0cbc0533bf490a39
MD5 22dee705a441b2738fdf1403d9e8dc51
BLAKE2b-256 e460049d1258dc3dd51f71432c6b125dbe2a2327e9d675a948caee960d688313

See more details on using hashes here.

File details

Details for the file news_fetch-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: news_fetch-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 48.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.0

File hashes

Hashes for news_fetch-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1233683d53959114e91c820595be2db44d2ff446c292b832100e57df608be07d
MD5 8b3183a581c3009b720844b5242125af
BLAKE2b-256 e37a9f6c86714e1958980021bf34d9b912a346e668699524bbac06d79889d4c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page