Open News
A lightweight Python toolkit for pulling, filtering, and understanding the news.
Fetch → Extract → Filter → Rank → Summarize → Export
Quick start · Features · Architecture · Docs · Colab examples
Why Open News?
Open News is built for real-world news workflows: pulling headlines and article bodies, checking sources, filtering noise, grouping similar stories, and exporting results in a format your app or shell can use.
It is not a hosted reader or a single website scraper. You can use it as a Python library in your own project, or run the CLI directly from a terminal.
At a glance
| Area | What it does |
|---|---|
| News discovery | Fetches category and location-based feeds, or searches by keyword |
| Source resilience | Tries multiple acquisition paths so one broken source does not kill the whole request |
| Article extraction | Pulls text, metadata, authors, dates, images, and source details |
| Website discovery | Finds articles through RSS discovery and fallback crawling |
| Processing | Filters by language, topic, domains, and deduplicates duplicate URLs/titles |
| Story clustering | Groups similar headlines and exposes cluster metadata |
| Async workflows | Supports async fetch/search/article retrieval and batch summarization |
| Summarization | Produces lightweight summaries with optional NLP helpers |
| Export | Writes Markdown and clean JSON output |
| CLI | Works well in shell scripts and automation |
✨ Features
News acquisition and search
fetch()for category and location-based newssearch()for keyword search, exclusions, locale, and date ranges- Streaming helpers for incremental results
- Multi-source fallback logic when one provider is down or noisy
Article extraction and website discovery
get_article()andget_article_async()for a single URLdiscover_and_get()for RSS-first discovery with same-domain crawling when needed- Optional Playwright rendering for JavaScript-heavy pages
- Metadata extraction using structured data, Open Graph, and HTML heuristics
Processing and analysis
- Topic and token filtering
- Domain allowlists and denylists
- URL/title deduplication
- Relevance ranking with BM25, TF-IDF, or a simple fallback
- Similar-story clustering
- Batch and keyword-driven summarization
Async API
The library exposes async entry points such as fetch_async(), search_async(), get_article_async(), batch_summarize_async(), and search_and_summarize_async() for non-blocking workflows.
📦 Installation
Requirements: Python 3.10 or newer.
python -m pip install open-news-api
Optional extras:
# Browser rendering for JavaScript-heavy pages
python -m pip install "open-news-api[js]"
playwright install chromium
# Optional NLP components, including BM25 and summarization helpers
python -m pip install "open-news-api[nlp]"
Install from a local checkout:
git clone https://github.com/alphap365/open-news.git
cd open-news
python -m venv .venv
# Linux / macOS
source .venv/bin/activate
# Windows PowerShell
# .venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"
🧪 Colab examples
For notebook-friendly testing and quick experiments, see the demo folder at examples/colab.
It includes:
- a ready-to-open Google Colab notebook
- a few small project-specific scripts for fetch/search/export flows
- a simple getting-started path for developers who want to test the library in a notebook environment
The folder contains:
examples/colab/open_news_colab_demo.ipynbexamples/colab/fetch_demo.pyexamples/colab/search_demo.pyexamples/colab/export_demo.py
🚀 Quick start
Fetch current technology news
from open_news import fetch
articles = fetch(category="tech", max_results=5)
for article in articles:
print(article["title"], article["url"])
Search with a region and date range
from open_news import search
articles = search(
"renewable energy",
country="in",
start_date="2026-01-01",
max_results=10,
)
Use the async API
import asyncio
from open_news import fetch_async
async def main():
articles = await fetch_async(category="science", max_results=10)
for article in articles:
print(article["title"])
asyncio.run(main())
Extract an article
from open_news import get_article
article = get_article("https://example.com/news/story")
print(article["title"])
print(article["text"])
Rank and cluster stories
from open_news import fetch, rank_articles, cluster_articles
articles = fetch(category="tech", max_results=40)
ranked = rank_articles(articles, query="artificial intelligence", method="auto")
clusters = cluster_articles(
ranked,
threshold=0.72,
drop_singletons=True,
)
for cluster in clusters:
print(cluster["size"], cluster["label"])
Export results
from open_news import export
markdown = export.to_markdown(clusters, path="out/stories.md")
json_text = export.to_json(clusters, path="out/stories.json")
Both exporters return the serialized string; if you pass a path, they also write the file to disk.
🧭 Architecture
Open News separates acquisition, extraction, processing, and presentation. The public API coordinates the workflow while specialized modules handle each stage.
Open full-size architecture diagram (SVG)
The main processing path looks like this:
Open full-size pipeline diagram (SVG)
See Architecture for module responsibilities and data flow.
⌨️ Command-line interface
Once installed, the command is open-news:
open-news --help
open-news --version
open-news fetch --category tech --limit 5
open-news search "artificial intelligence" --country in --limit 10
open-news extract https://example.com/news/story
open-news discover https://example.com --limit 10
open-news search-site "climate policy" reuters.com
open-news cluster --query "AI regulation" --limit 30
open-news export input.json --md output.md --json clean.json
For scripts, request JSON and pipe it into your preferred tools:
open-news search "AI" --format json | jq '.[].title'
For release history and version notes, see the changelog.
📚 Documentation
| Guide | Contents |
|---|---|
| Installation | Python setup, editable installs, and optional extras |
| Python API | Sync and async entry points with examples |
| CLI reference | Commands, options, and output formats |
| Parameters | Locale, dates, filters, streaming, and ranking |
| Architecture | Modules, acquisition flow, and processing pipeline |
| Release notes | What changed across releases |
🧪 Development and tests
python -m pip install -e ".[dev]"
pytest -q
The repository includes unit tests, contract tests, mocked integration tests, feed-engine checks, extraction tests, processing tests, export tests, and CLI coverage. Network-dependent behavior should be tested separately from deterministic offline tests.
⚠️ Operational notes
- News acquisition depends on external providers and may return different results over time.
locationis a hint, not a guarantee that every result comes from that region. Use a domain allowlist when strict publisher geography matters.- JavaScript rendering is optional and requires the
jsextra plus a Playwright browser installation. - BM25 support is optional. With
method="auto", ranking can fall back to TF-IDF when the optional backend is unavailable. - Extracted article metadata varies by publisher; dates, descriptions, and source attribution are best-effort fields.
License
Open News is distributed under the MIT License. See LICENSE.
Metadata
Release files for open-news-api 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| open_news_api-1.0.5.tar.gz | 96.9 kB | With provenance | Details for open_news_api-1.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| open_news_api-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for open_news_api-1.0.5-py3-none-any.whl |
Total release size: 182.7 kB
Release files / open_news_api-1.0.5.tar.gz
| Download URL | open_news_api-1.0.5.tar.gz |
|---|---|
| Size | 96.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fedcd1ba40ff72b6dee007960fc5ce042d32dcba29f073632f50183a295b902
|
|
BLAKE2b-256 checksum How to use checksums |
cbdabf811b3fa8f82be813e7ccf72112dd2e59c28f31a9a568377560be15be1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / open_news_api-1.0.5-py3-none-any.whl
| Download URL | open_news_api-1.0.5-py3-none-any.whl |
|---|---|
| Size | 85.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
144d350bc9e85596b12150f6a50f4bf8c91814580b141c4d82cfc288559848cc
|
|
BLAKE2b-256 checksum How to use checksums |
d06db864c3dc83e0ea521ff209772938df3ad03bfa4c25ed04adb217371ecea3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for open-news-api 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for open_news_api-1.0.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.