Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.7%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Use all the New York Times APIs in Python!
Basic Info
- Host: GitHub
- Owner: michadenheijer
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://pynytimes.michadenheijer.com
- Size: 171 KB
Statistics
- Stars: 58
- Watchers: 1
- Forks: 15
- Open Issues: 6
- Releases: 17
Topics
Metadata Files
README.md
pynytimes
Use all (actually most) New York Times APIs, get all the data you need from the Times!
Documentation
Extensive documentation is available at: https://pynytimes.michadenheijer.com/.
Installation
There are multiple options to install and upgrade pynytimes, but the easiest is by just installing it using pip (or pip3).
Linux and Mac
bash
pip install --upgrade pynytimes
Windows
shell
python -m pip install --upgrade pynytimes
Usage
You can easily import this library using:
python
from pynytimes import NYTAPI
Then you can simply add your API key (get your API key from The New York Times Dev Portal):
python
nyt = NYTAPI("Your API key", parse_dates=True)
Make sure that if you commit your code to GitHub you don't accidentially commit your API key.
Supported APIs
When you have imported this library you can use the following features from the New York Times API.
Search - Article search - Book reviews - Movie reviews
Popular - Top stories - Most viewed articles - Most shared articles - Best sellers lists
Metadata - Article metadata - Archive metadata - Load latest articles
Other - Tag query (TimesTags)
Top stories
To get the current top stories use:
python
top_stories = nyt.top_stories()
Read the documentation to find the top stories per section.
Most viewed articles
You can also get todays most viewed articles:
python
most_viewed = nyt.most_viewed()
Read the documentation to get the most viewed articles per week or month.
Most shared articles
To get the most shared articles (shared over email) use:
python
most_shared = nyt.most_shared()
Read the documentation to get the most shared articles using facebook.
Article search
Search articles using a query using:
python
articles = nyt.article_search(query="Obama")
In this example we have just defined the content of the search query (Obama), but we can add many more search parameters. Read the documentation to see how.
Book reviews
You can easily find book reviews for every book you've read. You can find those reviews by searching for the author, ISBN or title of the book.
```python
Get reviews by author (first and last name)
reviews = nyt.book_reviews(author="George Orwell")
Get reviews by ISBN
reviews = nyt.book_reviews(isbn="9780062963673")
Get book reviews by title
reviews = nyt.book_reviews(title="Becoming") ```
Read the documentation to find more information about additional parameters.
Movie reviews
You can not only get the book reviews, but the movie reviews too.
python
reviews = nyt.movie_reviews(keyword="Green Book")
Read the documentation to find more information about additional parameters.
Best sellers lists
The New York Times has multiple best sellers lists. To get from the fiction best seller list:
```python
Get fiction best sellers list
books = nyt.bestsellerslist() ```
Read how to get the other best seller lists in the documentation.
Article metadata
With an URL from a New York Times article you can easily get all the metadata you need from it.
python
metadata = nyt.article_metadata(
url = "https://www.nytimes.com/2019/10/20/world/middleeast/erdogan-turkey-nuclear-weapons-trump.html"
)
Read additional parameters in the documentation.
Load latest articles
You can easily load the latest articles published by the New York Times.
python
latest = nyt.latest_articles(
source = "nyt",
section = "books"
)
Additional parameters can be found in the documentation.
Tag query
The New York Times has their own tags library. You can query this library with this API.
python
tags = nyt.tag_query(
"pentagon",
max_results = 20
)
Additional parameters can be found in the documentation.
Archive metadata
If you want to load all the metadata from a specific month, then this API makes that possible. Be aware you'll download a big JSON file (about 20 Mb), so it can take a while.
```python import datetime
data = nyt.archive_metadata( date = datetime.datetime(2019, 1, 1) ) ```
Read more in the documentation.
Citing this Repository
If you use pynytimes, a citation would be very much appriciated. If you're using BibTeX you can use the following citation:
bib
@software{Den_Heijer_pynytimes_2023,
author = {Den Heijer, Micha},
license = {MIT},
title = {{pynytimes}},
url = {https://github.com/michadenheijer/pynytimes},
version = {0.10.1},
year = {2023},
doi = {10.5281/zenodo.7821090}
}
If you're not using BibTeX, you can retrieve the preferred citation from Zenodo.
License
Disclaimer: This project is not made by anyone from the New York Times, nor is it affiliated with The New York Times Company.
Owner
- Name: Micha den Heijer
- Login: michadenheijer
- Kind: user
- Location: Amsterdam, The Netherlands
- Company: Vrije Universiteit Amsterdam
- Website: https://michadenheijer.com
- Twitter: michadenheijer
- Repositories: 5
- Profile: https://github.com/michadenheijer
Econometrics and Operations Research student at VU University Amsterdam.
Citation (CITATION.cff)
cff-version: 1.2.0
title: pynytimes
type: software
authors:
- given-names: Micha
family-names: Den Heijer
affiliation: Vrije Universiteit Amsterdam
orcid: 'https://orcid.org/0009-0009-5151-3897'
identifiers:
- type: doi
value: 10.5281/zenodo.7821090
description: Collective DOI of all versions
repository-code: 'https://github.com/michadenheijer/pynytimes'
url: 'https://pynytimes.michadenheijer.com/'
abstract: A simple Python Library for using the New York Times APIs.
keywords:
- news
- API wrapper
license: MIT
version: 0.10.0
date-released: '2023-04-21'
GitHub Events
Total
- Issues event: 2
- Watch event: 7
- Delete event: 3
- Issue comment event: 2
- Push event: 4
- Pull request event: 8
- Pull request review event: 2
- Pull request review comment event: 2
- Create event: 2
Last Year
- Issues event: 2
- Watch event: 7
- Delete event: 3
- Issue comment event: 2
- Push event: 4
- Pull request event: 8
- Pull request review event: 2
- Pull request review comment event: 2
- Create event: 2
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Micha den Heijer | m****a@m****m | 89 |
| Micha den Heijer | m****a@m****l | 15 |
| Matti Nelimarkka | m****a@h****i | 4 |
| dependabot[bot] | 4****] | 3 |
| dependabot-preview[bot] | 2****] | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 9
- Total pull requests: 103
- Average time to close issues: about 2 months
- Average time to close pull requests: 2 months
- Total issue authors: 6
- Total pull request authors: 6
- Average comments per issue: 1.22
- Average comments per pull request: 0.06
- Merged pull requests: 84
- Bot issues: 0
- Bot pull requests: 11
Past Year
- Issues: 2
- Pull requests: 2
- Average time to close issues: 3 months
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 2
- Average comments per issue: 0.5
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
- michadenheijer (3)
- sergio-ns (2)
- shainaraza (1)
- abdulsamet (1)
- mt-krainski (1)
- peichenxi77 (1)
- Qian-Cun (1)
Pull Request Authors
- michadenheijer (88)
- dependabot[bot] (10)
- KingNawat (1)
- matnel (1)
- fossabot (1)
- dependabot-preview[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 1,182 last-month
- Total dependent packages: 0
- Total dependent repositories: 16
- Total versions: 15
- Total maintainers: 2
pypi.org: pynytimes
A Python wrapper for (most) New York Times APIs
- Homepage: https://pynytimes.michadenheijer.com/
- Documentation: https://pynytimes.readthedocs.io/
- License: MIT
-
Latest release: 0.10.0
published over 2 years ago
Rankings
Maintainers (2)
Dependencies
- requests ==2.26.0
- urllib3 *
- requests >=2.10.0,<3.0.0
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
