Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Scarvy/readwise-reader-cli
Use Readwise Reader π in the Command-line (CLI) π»
https://github.com/Scarvy/readwise-reader-cli
api cli command-line python readwise
Last synced: 3 months ago
JSON representation
Use Readwise Reader π in the Command-line (CLI) π»
- Host: GitHub
- URL: https://github.com/Scarvy/readwise-reader-cli
- Owner: Scarvy
- License: mit
- Created: 2023-08-10T22:39:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-25T20:13:27.000Z (about 1 year ago)
- Last Synced: 2024-07-04T05:02:43.206Z (4 months ago)
- Topics: api, cli, command-line, python, readwise
- Language: Python
- Homepage:
- Size: 2.4 MB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-readwise - readwise-reader-cli - A command-line interface for Readwise Reader. (Client Libraries)
- jimsghstars - Scarvy/readwise-reader-cli - Use Readwise Reader π in the Command-line (CLI) π» (Python)
README
# Reader API Command-Line Interface
![](./images/reader-terminal.png)
This repository provides a command-line interface (CLI) for interacting with [Readwise's Reader API](https://readwise.io/reader_api). This tool allows you to interact with the API directly from your command line, making it easy to `add` and `list` documents from your Reader library.
Also, you can `upload` documents from your browser reading list, such as Chrome ReadingList.
Please note that future updates will include support for additional browsers.
## Installation
Set up a virtual environment and then run:
```bash
pip install readwise-reader-cli
```## Usage
Before using the CLI, make sure to set the READER_API_TOKEN environment variable. You can obtain your API token [here](https://readwise.io/access_token).
```bash
export READER_API_TOKEN={your_api_token}
```The CLI provides the following commands:
```bash
Usage: python -m readercli [OPTIONS] COMMAND [ARGS]...Interact with your Reader Library
Options:
--help Show this message and exit.Commands:
add Add Document
lib Library breakdown
list List Documents
upload Upload Reading List File
validate Validate token
```### List Documents
```bash
Usage: python -m readercli list [OPTIONS]List Documents
Options:
-l, --location [new|archive|later|feed]
Document(s) location
-c, --category [article|tweet|pdf|epub|email|note|video|highlight|rss]
Document(s) category
-a, --update-after [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]
Updated after date in ISO format. Default:
last 24hrs.
-d, --date-range TEXT View documents updated after choosen time:
today, week, month.
-L, --layout [table|list] Display documents either as a list or table.
Default: table.
-n, --num-results INTEGER The number of documents to show.
-P, --pager Use to page output.
--help Show this message and exit.
```Examples:
```bash
python -m readercli list --location archive
``````bash
python -m readercli list --location archive --category article
``````bash
python -m readercli list --location archive --category article --update-after 2023-01-01
``````bash
python -m readercli list --location archive --category article --update-after 2023-01-01 --layout list
``````bash
python -m readercli list --location archive --category article --date-range week
```### Layouts
![table](./images/table.png)
![list_table](./images/list.png)
### Upload a Reading List (Google Chrome support only)
**THINGS TO NOTE:**
- **RATE LIMIT - Due to Reader's API rate limit of 20 requests per minute, a larger list will take a few minutes to upload.**
- **LACK OF READING LIST APIs - There is no API to pull your ReadingList from Google, but it is being looked at [here](https://bugs.chromium.org/p/chromium/issues/detail?id=1238372).**
To `upload` your Chrome Reading List, you first need to download your data from your account, then follow these steps:
1. Navigate to the [Data & Privacy](https://myaccount.google.com/data-and-privacy) section.
2. Find the "Download your data" option and click on it.
3. A list of data to export will appear. Click "Deselect all" and then locate the Chrome section.
4. Click "All Chrome data Included" and select ONLY "ReadingList".
5. Save the downloaded `.html` file to your preferred directory and take note of the file path.
6. Run the `import` command.```bash
Usage: python -m readercli upload [OPTIONS] INPUT_FILEUpload Reading List File
Options:
--file-type [html|csv]
--help Show this message and exit.
```Examples:
```bash
python -m readercli upload /path/to/ReadingList.html
``````bash
python -m readercli upload --file-type csv /path/to/ReadingList.csv
```### Add Document
```bash
Usage: python -m readercli add [OPTIONS] URLAdd Document
Options:
--help Show this message and exit.
```Example:
```bash
python -m readercli add http://www.example.com
```### Library Overview
```bash
Usage: python -m readercli lib [OPTIONS]Library breakdown
Options:
-V, --view [category|location|tags]
--help Show this message and exit.
``````bash
python -m readercli libCategory Breakdown
βββββββββββββββ³ββββββββ
β Name β Count β
β‘ββββββββββββββββββββββ©
β ποΈ highlightβ 724 β
β π‘οΈ rss β 391 β
β βοΈ email β 363 β
β π°οΈ article β 264 β
β ποΈ note β 140 β
β ποΈ pdf β 83 β
β π¦οΈ tweet β 25 β
β πΉοΈ video β 10 β
β ποΈ epub β 0 β
βββββββββββββββ΄ββββββββpython -m readercli lib --view [location | tags]
Location Breakdown
βββββββββββββ³ββββββββ
β Name β Count β
β‘ββββββββββββββββββββ©
β ποΈ archiveβ 1124 β
β ποΈ later β 241 β
β βοΈ new β 10 β
β π₯οΈ feed β 2 β
βββββββββββββ΄ββββββββpython -m readercli lib --view tags
Tags Breakdown
ββββββββββββββββββββββββββ³ββββββββ
β Name β Count β
β‘βββββββββββββββββββββββββββββββββ©
β python β 32 β
β documentation β 9 β
β programming β 7 β
β github β 7 β
β git β 6 β
β packages β 6 β
β design-patterns β 6 β
β mac β 1 β
ββββββββββββββββββββββββββ΄ββββββββ
```### Validate Token
```bash
Usage: python -m readercli validate [OPTIONS] TOKENValidate token
Options:
--help Show this message and exit.
```## Main Third-Party Libraries
- [click](https://github.com/pallets/click)
- [pydantic](https://github.com/pydantic/pydantic)
- [requests](https://github.com/psf/requests)
- [rich](https://github.com/Textualize/rich)## Inspiration
- [starcli](https://github.com/hedyhli/starcli)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.