A command-line interface for Instapaper that lets you manage your reading list and export articles as EPUB files — perfect for sending articles to your Kobo e-reader.
- Add articles — Save any URL to your Instapaper account directly from the terminal
- Upload local files — Add Markdown (
.md) and PDF (.pdf) files directly from your filesystem - List bookmarks — Browse your reading list with a formatted table showing titles and reading progress
- Export to EPUB — Download articles as EPUB files, ready for your Kobo or any e-reader
- Kobo integration — Articles added via the CLI sync automatically to your Kobo over WiFi through Instapaper's native integration
git clone https://github.com/juange87/instapapercli.git
cd instapapercli
pip install .git clone https://github.com/juange87/instapapercli.git
cd instapapercli
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"instapaper loginThis prompts for your Instapaper email and password, exchanges them for OAuth tokens via xAuth, and stores the tokens securely at ~/.config/instapaper/tokens.json. You only need to do this once.
API consumer credentials are bundled with the CLI, so no extra configuration is needed.
If you prefer to use your own OAuth consumer tokens, request them from Instapaper and set them as environment variables:
export INSTAPAPER_CONSUMER_KEY="your_consumer_key"
export INSTAPAPER_CONSUMER_SECRET="your_consumer_secret"Environment variables take priority over the built-in defaults.
instapaper add https://example.com/interesting-articleWith a custom title:
instapaper add https://example.com/article --title "Must read later"Save to a specific folder:
instapaper add https://example.com/article --folder 12345If you have the Kobo-Instapaper integration enabled, added articles will sync to your Kobo automatically the next time it connects to WiFi.
Upload a Markdown file:
instapaper add ./notes.mdUpload a PDF:
instapaper add report.pdfThe CLI auto-detects .md and .pdf files, converts them to HTML, and uploads the content directly to Instapaper. The filename is used as the title by default (override with --title).
instapaper listOutput:
Bookmarks
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ ID ┃ Title ┃ Progress ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ 1234567 │ How CSS Grid Works │ 45% │
│ 1234568 │ Rust for Beginners │ 0% │
│ 1234569 │ The Art of Cooking │ 100% │
└─────────┴─────────────────────┴──────────┘
Show more results:
instapaper list --limit 50Filter by folder:
instapaper list --folder 12345Export a single article by its ID (shown in instapaper list):
instapaper export 1234567Export all unread articles:
instapaper export --allSpecify an output directory:
instapaper export 1234567 --output-dir ~/Books
instapaper export --all --output-dir ~/BooksEach article is saved as a separate EPUB file named after its title (e.g., How_CSS_Grid_Works.epub).
After exporting, connect your Kobo via USB and copy the files:
instapaper export --all --output-dir /Volumes/KOBOeReader/instapaper --help
| Command | Description |
|---|---|
instapaper login |
Authenticate with Instapaper |
instapaper add <url or file> |
Add a URL or local file (.md, .pdf) to your reading list |
instapaper list |
List saved bookmarks |
instapaper export [ID] |
Export article(s) as EPUB |
| Option | Short | Description |
|---|---|---|
--title |
-t |
Custom title for the bookmark |
--folder |
-f |
Folder ID to save the article to |
| Option | Short | Default | Description |
|---|---|---|---|
--limit |
-l |
25 | Number of bookmarks to show (max 500) |
--folder |
-f |
— | Filter by folder ID |
| Option | Short | Default | Description |
|---|---|---|---|
--all |
— | — | Export all unread bookmarks |
--output-dir |
-o |
. |
Output directory for EPUB files |
There are two ways to get articles on your Kobo:
- Link your Instapaper account to your Kobo in Instapaper settings
- Add articles from the terminal:
instapaper add https://example.com/article
- Your Kobo downloads the articles automatically when connected to WiFi
- Export articles as EPUB:
instapaper export --all --output-dir ~/Desktop/kobo-articles
- Connect your Kobo via USB
- Copy the
.epubfiles to your Kobo's root directory or a subfolder - Eject and disconnect — the articles appear in your library
instapapercli/
├── pyproject.toml # Package metadata and dependencies
├── src/
│ └── instapaper/
│ ├── __init__.py
│ ├── cli.py # Click commands (login, add, list, export)
│ ├── api.py # OAuth 1.0a API client
│ ├── converters.py # Markdown/PDF → HTML conversion
│ ├── epub.py # HTML → EPUB conversion
│ └── config.py # Credential management
└── tests/
├── test_api.py # API client tests (8 tests)
├── test_cli.py # CLI command tests (9 tests)
├── test_config.py # Config module tests (4 tests)
├── test_converters.py # File converter tests (4 tests)
└── test_epub.py # EPUB export tests (3 tests)
Instapaper uses OAuth 1.0a with xAuth. Instead of the typical OAuth browser redirect flow, xAuth allows the CLI to exchange your username and password directly for OAuth access tokens. This happens once during instapaper login, and the tokens are stored locally for all subsequent requests.
- Consumer key/secret — Stored as environment variables (
INSTAPAPER_CONSUMER_KEY,INSTAPAPER_CONSUMER_SECRET) - Access tokens — Stored at
~/.config/instapaper/tokens.jsonafter login
All Instapaper API calls use HTTPS POST requests with OAuth 1.0a HMAC-SHA1 signatures. The API returns JSON arrays containing typed objects (bookmark, user, meta, error). The client filters these to return only the relevant types.
The export pipeline:
- Fetches the processed HTML text of an article via the Instapaper API
- Cleans the HTML with BeautifulSoup
- Wraps it in a valid EPUB structure using ebooklib
- Saves the file with a sanitized filename based on the article title
pytest tests/ -vAll 28 tests use mocked HTTP responses (via the responses library), so no Instapaper account or network connection is needed to run the test suite.
| Package | Purpose |
|---|---|
| click | CLI framework with commands, options, and prompts |
| requests | HTTP client |
| requests-oauthlib | OAuth 1.0a authentication for requests |
| ebooklib | EPUB file generation |
| beautifulsoup4 | HTML parsing and cleanup |
| rich | Formatted terminal tables |
| markdown | Markdown to HTML conversion |
| pymupdf | PDF text extraction |
MIT