Metadata-Version: 2.5
Name: scoopy
Version: 0.0.9
Summary: Python interface to live news
Project-URL: Homepage, https://github.com/thorwhalen/scoopy
Author: Thor Whalen
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: beautifulsoup4
Requires-Dist: dol
Requires-Dist: i2
Requires-Dist: requests
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx-rtd-theme>=1.0; extra == 'docs'
Requires-Dist: sphinx>=6.0; extra == 'docs'
Description-Content-Type: text/markdown

# scoopy

A Python interface to live news: current headlines and news search behind one function, whichever service answers.

```bash
pip install scoopy
```

<!-- wads-docs: skip - live network call -->
```python
from scoopy import headlines

headlines()  # ['Coup-hit Niger was betting on a China-backed oil pipeline ...', ...]
```

`headlines()` reads the Yahoo Finance front page, so it needs no API key.

## Search

`search_news(query, source=...)` searches a news service and returns what it found:

<!-- wads-docs: skip - live network call; the default source needs an API key -->
```python
from scoopy import search_news

search_news("central bank", source="yahoo_finance")  # no key: the raw JSON of Yahoo Finance's search endpoint
search_news("central bank")                           # the default source, newsdata.io: a list of articles
```

| `source` | What it is | Needs |
|---|---|---|
| `"yahoo_finance_headlines"` | the Yahoo Finance front-page headlines (no query) | nothing |
| `"yahoo_finance"` | Yahoo Finance's unofficial search endpoint; pass `newsCount=`, `quotesCount=` and so on | nothing |
| `"newsdata"` (the default) | [newsdata.io](https://newsdata.io/documentation) | `pip install newsdataapi`, and your key in the environment variable `NEWSDATA_API_KEY` |

A missing key raises a `ValueError` that names the variable. The Yahoo endpoints are unofficial and can change without notice.

## Per-service functions

`search_news` dispatches to these, which you can also call directly: `newsdata_search`, `yahoo_finance_news_search` and `yahoo_finance_headlines` (`headlines` is its alias, kept so the source of headlines can change later without changing your code).

## License

MIT
