https://github.com/zzampax/kindle-scribe-api
Server that periodically checks GMAIL inbox to download the latest PDF file sent via a Kindle Scribe
https://github.com/zzampax/kindle-scribe-api
gmail-api google-api kindle kindle-scribe pdf python3
Last synced: 3 months ago
JSON representation
Server that periodically checks GMAIL inbox to download the latest PDF file sent via a Kindle Scribe
- Host: GitHub
- URL: https://github.com/zzampax/kindle-scribe-api
- Owner: zzampax
- Created: 2024-10-11T18:22:07.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-23T12:08:47.000Z (4 months ago)
- Last Synced: 2025-02-23T12:27:21.463Z (4 months ago)
- Topics: gmail-api, google-api, kindle, kindle-scribe, pdf, python3
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KindleScribe Automatic Downloader API
This Python script automatizes the process of storing `PDF` files sent by a *Kindle Scribe*.
## APIs
The whole script is based on Google's `Gmail API`, enabling it to parse email metadata and find the temporary link for the `PDF`.
> When a `PDF` is shared through a Kindle Scribe *send to email* function, the file is hosted for 30 days on Amazon's servers in order to make it downloadable.
> The `URL` is then embedded in a link on the email sent to the user.Once the `URL` has been found, the script fetches it via:
```python3
def fetch_pdf(pdf_link, filename):
# Download the PDF
import requests
response = requests.get(pdf_link)
with open(f"kindle_pdfs/{filename}.pdf", "wb") as pdf:
pdf.write(response.content)
```
## Essential files
- `credentials.json` downloadable after generating an **ID client OAuth 2.0** via the Google API Dashboard.
- `token.json` generated after loggin in via a link.
## Running the code
Before running the code it is essential to install the `requirements.txt` dependencies, it is recommended to use a python virtual environment:
```bash
python3 -m venv .venv
source .venv/bin/activate
```
> Use the appropriate `activate` accordingly (eg. `activate.fish` for `fish` shell)
```bash
pip3 install -r requirements.txt
```
The code is then runnable as following:
```bash
python3 main.py
```
The `PDFs` will be saved in the `kindle_pdfs/` folder.