Skip to main content

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.

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.1.tar.gz (12.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.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: news_cli-2.0.1.tar.gz
  • Upload date:
  • Size: 12.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.1.tar.gz
Algorithm Hash digest
SHA256 7ef5f2c2f2fca0490c2955a385cc809867ff4e3551fbf8d72de0bae55f724cda
MD5 08d8ac0ae2cd0c8143f94cbc33839de6
BLAKE2b-256 ae1f2079e9faef8c0b4835a44a2b44d39ce991b5f0c7aaf7ef861058f82bed10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: news_cli-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb61c92249d1ed9090e2b5e73e54899f902388e3980928d97548de192886a0fc
MD5 358fe177f21c4c5724fc3e3c1e48a206
BLAKE2b-256 3890fb0edb66079a8784f493e11260769debd2fc1421e62e2af1a6d0d492f11c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 files

2.0.0

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

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