Skip to main content

news-fetch is an open-source, easy-to-use news extractor with basic NLP features (cleaning text, keywords, summary) that just works.

Project description

PyPI version Downloads Python versions License GitHub stars GitHub forks Open issues Last commit

๐Ÿ“ฐ news-fetch

news-fetch extracts structured data from a news article URL with one call: Newspaper(url=...).get_dict ๐ŸŒ. Under the hood it's built on newspaper4k, but it isn't just a wrapper around it โ€” it exists to fix the gaps single-engine extraction leaves.

If this saves you time, please โญ star the repo โ€” it's the main way other people find it, and it's free.


๐Ÿ“š Table of Contents

โœจ Why news-fetch?

news-fetch Plain newspaper4k
Publication / category / modified-date backfilled from JSON-LD when Open Graph tags are missing (e.g. BBC) โœ… โŒ
summary / keywords always populated, no NLTK corpus download needed โœ… โŒ (.nlp() requires one)
One flat dict, first non-empty value wins across engines โœ… โŒ (assemble it yourself)
Site-wide article discovery via sitemap/RSS, no browser automation โœ… โŒ
Concurrent batch scraping with per-URL failure isolation โœ… โŒ
Reading time & word count computed for free โœ… โŒ
Install footprint ~50MB, no Scrapy/boto3/Selenium โ€”

In detail:

  • JSON-LD backfill. Many modern news sites (e.g. BBC) don't expose Open Graph tags that newspaper4k relies on for publication/category, but do embed a schema.org/NewsArticle JSON-LD block. news-fetch parses that block directly and fills in publication, category, and date_modify whenever the primary engine comes up empty โ€” no extra dependency required, since it reuses the beautifulsoup4/requests already in the base install.
  • No NLTK download required. newspaper4k's built-in summary/keyword extraction (.nlp()) needs an NLTK corpus download, which routinely fails behind corporate proxies or strict SSL setups. news-fetch falls back to a dependency-free, pure-stdlib summarizer/keyword extractor when that's unavailable, so summary/keywords are never empty.
  • Every field, one flat dict, first non-empty value wins. Instead of learning three different libraries' inconsistent APIs, you get one object where each field is resolved by trying every available engine in priority order and returning the first real value.
  • Site-wide article discovery, no browser automation. NewsSiteURLExtractor finds a news site's recent article URLs (with title/date, when available) via its robots.txt sitemap directives, Google News sitemaps, and RSS/Atom feeds โ€” the same techniques real news aggregators use, and safer/more reliable than scraping a search engine.
  • Reading time and word count, computed for free from the extracted article text.
  • Concurrent batch scraping via Newspaper.from_urls([...]) โ€” one bad URL doesn't take down the whole batch; it just comes back as None.
  • A minimal, honest dependency footprint. The whole install is ~50MB: newspaper4k, beautifulsoup4, requests, lxml-html-clean, Unidecode โ€” no Scrapy, no boto3, no Selenium.

๐Ÿ“ Extracted Information

news-fetch extracts the following attributes from news articles. You can also check out an example JSON file.

  • ๐Ÿ“ฐ Headline
  • โœ๏ธ Author(s)
  • ๐Ÿ“… Publication date
  • ๐Ÿ—ž๏ธ Publication
  • ๐Ÿ“‚ Category
  • ๐ŸŒ Source domain
  • ๐Ÿ“‘ Article content
  • ๐Ÿ“ Summary
  • ๐Ÿ”‘ Keywords
  • ๐ŸŒ URL
  • ๐ŸŒ Language
  • โฑ๏ธ Word count & estimated reading time

๐Ÿ”ง Installation

Install from PyPI with pip:

pip install news-fetch

Or install from source:

git clone https://github.com/santhoshse7en/news-fetch.git
cd news-fetch
pip install .

๐Ÿš€ Usage

To scrape all the news details, use the newspaper function:

from newsfetch.news import Newspaper

news = Newspaper(url='https://www.thehindu.com/news/cities/Madurai/aa-plays-a-pivotal-role-in-helping-people-escape-from-the-grip-of-alcoholism/article67716206.ece')
print(news.headline)
# Output: 'AA plays a pivotal role in helping people escape from the grip of alcoholism'
print(news.word_count, news.reading_time_minutes)
# Output: 210 1

To discover recent article URLs from a news site (via its sitemaps/RSS feeds โ€” no browser required):

from newsfetch.discovery import NewsSiteURLExtractor

site = NewsSiteURLExtractor(news_domain='https://www.bbc.com', limit=10)
for article in site.articles:
    print(article)
# Output: {'url': 'https://www.bbc.com/news/articles/...', 'title': '...', 'date': '2026-07-10T16:56:53Z'}

To scrape many URLs at once, with per-URL failures isolated:

from newsfetch.news import Newspaper

results = Newspaper.from_urls(site.urls, max_workers=5)
for result in results:
    if result is not None:
        print(result.headline)

๐Ÿ”— Project Links

Source Link
PyPI pypi.org/project/news-fetch
Repository github.com/santhoshse7en/news-fetch
Issue tracker github.com/santhoshse7en/news-fetch/issues

๐Ÿค Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.

  • ๐Ÿด Fork the repo, make your change, and open a PR.
  • ๐Ÿ› Found a bug or have a feature idea? File an issue.
  • โญ Starring the repo costs nothing and genuinely helps โ€” it's how other people searching for a news extractor find this one.

Please also read the Code of Conduct before participating.

๐Ÿ“„ License

This project is licensed under the MIT License.

Project details


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-0.4.1.tar.gz (15.0 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-0.4.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for news_fetch-0.4.1.tar.gz
Algorithm Hash digest
SHA256 5b20c2bebe6bf6c758d3dabd0bdb8aa8bd4f48c8fdf73de0ce424e287eb45dd0
MD5 d2683b0f14f710628122904da68a3f87
BLAKE2b-256 6488131ba8a3320e30c5e9d6ced6d81b60e627f0dbaa3c0002f8c03ac68e851f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: news_fetch-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 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-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f7716fe1a458910710bd0d1e5428777afe1b28c9d39c5dae72dfcd3827cc54c
MD5 a737c7ad9293ab6fd40afe1feee049a1
BLAKE2b-256 417b500a8fce4081496f58f443959ba342603bb2a6447012798d03b4dbd16733

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 Pingdom Monitoring Sentry Error logging StatusPage Status page