apple-news-to-sqlite
Export Apple News Saved Stories to SQLite
Install
pip install apple-news-to-sqlite
Source code
Usage
apple-news-to-sqlite articles.db
apple-news-to-sqlite --dump
Your Terminal app will require full disk access in order to access the saved article database in the Apple News app sandbox.
CLI help
Usage: apple-news-to-sqlite [OPTIONS] [DB_PATH]
Export your Apple News saved stories/articles to a SQLite database
Example usage:
apple-news-to-sqlite articles.db
This will populate articles.db with an "articles" table containing information
about your saved articles.
Notes:
The contents of the articles themselves are not stored in the database, only
metadata about the article such as title, author, url, etc.
The date the article was saved is in GMT.
Options:
--version Show the version and exit.
--dump, --json Print saved stories to standard output as JSON.
--all Process all saved articles; if not specified, only saved
articles that have not previously been stored in the database
are processed.
--schema Create database schema and exit.
--help Show this message and exit.
Using apple-news-to-sqlite in your own Python code
get_saved_articles() returns a list of dictionaries, each representing a saved article with the
following keys:
* id: str
* date: datetime.datetime
* url: str
* title: str
* description: str
* image: str
* author: str
>>> from apple_news_to_sqlite import get_saved_articles
>>> articles = get_saved_articles()
How it works
Through reverse engineering, it was determined that the Apple News app stores
saved articles in a file called reading-list in the following directory:
~/Library/Containers/com.apple.news/Data/Library/Application Support/com.apple.news/com.apple.news.public-com.apple.news.private-production/
This format of this file is unknown but it is a binary file that contains two embedded binary plist files. The first contains an NSKeyedArchiver object which I have not yet inspected. The second bplist contains a list of saved article IDs along with the date they were saved. The article IDs are used to look up the article data on Apple's News site and the article data is extracted with Beautiful Soup.
Testing
The code is at the "it works on my machine" stage of testing. (M1 Mini, macOS Ventura 13.1)
I've also tested this on macOS Catalina 10.15.7 and it appears to work correctly.
If it doesn't work for you, please open an issue!
Contributing
Contributions of all types are welcome! Fork the repo, make a branch, and submit a PR.
See README_DEV.md for developer notes.
Thanks
Thanks to Simon Willison who inspired this project with his excellent "everything-to-sqlite" dogsheep project.
Thanks Simon also for the excellent tools sqlite-utils and Datasette.
Thanks also to Dave Bullock who inspired this project and helped tremendously with the reverse engineering and initial code.
License
MIT License
Metadata
Release files for apple-news-to-sqlite 0.5.2
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 | |
|---|---|---|---|---|
| apple_news_to_sqlite-0.5.2.tar.gz | 7.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apple_news_to_sqlite-0.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.2 kB
Release files / apple_news_to_sqlite-0.5.2.tar.gz
| Download URL | apple_news_to_sqlite-0.5.2.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48a00bb9750fcbed8f13514238551ece65588eaedac811581134fac521f2d9e6
|
|
BLAKE2b-256 checksum How to use checksums |
1657330539f7c8632d7f06e3b3f660780c755b1a5138f9821fdfd00b0d54ecff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / apple_news_to_sqlite-0.5.2-py3-none-any.whl
| Download URL | apple_news_to_sqlite-0.5.2-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
996db85a87ce22ac2c2ccbc09d434d7e6d84f40cc2946640cd5483a94ae19d02
|
|
BLAKE2b-256 checksum How to use checksums |
7d11a858ce4169ad4beb5e6261ed78bbde18c342bc65b612009480b3385e5a5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for apple-news-to-sqlite 0.5.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.