Skip to main content

A CLI app to get news snapshots

Project description

The Local News CLI

Get the latest news straight from your terminal. Powered by NewsAPI.org.

  • Top headlines by country or topic
  • Full-text keyword search with AND/OR/NOT
  • Articles from the past 7 days only
  • Open any article in your browser directly from the CLI

demo


Install

pip install news-cli

Or with uv:

uv tool install news-cli

Setup

Get a free API key at newsapi.org/register, then set it as an environment variable:

export NEWS_API_KEY=your_key_here

Add that line to your ~/.zshrc or ~/.bashrc to make it permanent.


Usage

news [OPTIONS]

Options:
  -s, --search TEXT    Keywords to search for. Supports AND/OR/NOT.
  -c, --country TEXT   2-letter country code: us, gb, in, fr, de, au, ...
  -t, --topic TEXT     business | entertainment | general | health |
                       science | sports | technology
  -l, --lang TEXT      Article language: en, fr, de, es, ar, zh, ...  [default: en]
      --sort TEXT      relevancy | popularity | date  [default: popularity]
                       (only applies to --search without --country/--topic)
  -n, --limit INT      Number of articles to show (1–100)  [default: 20]
      --json           Output as JSON for scripting
      --verbose        Enable debug logging
      --help           Show this message and exit

Examples

# Top headlines (defaults to US)
news

# Headlines for a specific country
news --country gb
news -c in

# Headlines by topic
news --topic technology
news -t health

# Search for a keyword
news --search "climate change"
news -s "AI AND regulation"

# Combine: search within a country or topic
news --search "election" --country us
news -s "startup" -t technology

# Filter by language
news --search "économie" --lang fr

# Sort search results by date
news --search "SpaceX" --sort date

# Show more results
news -n 50

# Pipe to jq or other tools
news --json | jq '.[].title'

Troubleshooting

No API key found — set the NEWS_API_KEY environment variable (see Setup above).

No articles found — the combination of filters returned nothing. Try a broader country, drop the topic filter, or change the language.

Results seem old — the CLI only shows articles from the past 7 days. For older content, use the NewsAPI directly.

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_cli-2.0.0.tar.gz (11.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_cli-2.0.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file news_cli-2.0.0.tar.gz.

File metadata

  • Download URL: news_cli-2.0.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for news_cli-2.0.0.tar.gz
Algorithm Hash digest
SHA256 a44a153d2006d0221e12213316828364c9ad4c951f6a9daaaf4c784191dfc041
MD5 d4a442a911eeea57863fab32e6d7657f
BLAKE2b-256 2fd1d15448bda6862b5ab21383fb0e50960ee16d8e1bf42478a6700bd5a62994

See more details on using hashes here.

File details

Details for the file news_cli-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: news_cli-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for news_cli-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a941ee0e358b108db53b3b8133b728c8e250f31180771317c0a238ff0575e7a6
MD5 bb5eb1173f9c282c89b790344ab23e31
BLAKE2b-256 a14d12665d8a038bb4b4cd936b0ed003b2cfaf1ab3587e0b81623555ebf1c908

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