Web novel scraper and library manager with Rich UI
Project description
novel-cli
A CLI tool for scraping and managing web novels offline, with an optional web viewer.
Features
- Smart Scraping: Automatically skips completed novels with all chapters already downloaded, saving time and bandwidth
- Offline Reading: Download and store complete novels locally
- Web Viewer: Optional web-based reader for your library
- Multiple Sources: Support for various novel hosting sites ( Only tested on one site - RR)
- Library Management: Add, remove, export, and organize your collection
- Progress Tracking: Monitor download progress and completion status
Installation
From Source
git clone https://github.com/Azizgic/novel-cli.git
cd novel-cli
pip install -e .
From PyPI
pip install novel-cli
Quick Start
# Add a novel to your reading list
novel add https://www.royalroad.com/fiction/12345/some-novel
# Scrape all novels (smart mode - skips completed ones)
novel scrape
# Scrape a single novel
novel scrape "Novel Title"
# Update stats only (no chapter download)
novel update-stats
# List your library
novel list
# Show novel details
novel show "Novel Title"
# Remove a novel
novel remove "Novel Title"
# Export library
novel export json
novel export csv
# Show statistics
novel stats
# Clean up orphaned data
novel clean
Command Reference
| Command | Description |
|---|---|
novel add <url> |
Add a novel URL to your reading list |
novel scrape [title] |
Download chapters (skips completed novels by default) |
novel scrape --dry-run |
Preview what would be scraped without downloading |
novel update-stats [title] |
Update metadata without downloading chapters |
novel list |
Display all novels in your library |
novel show [title] |
Show detailed information about a novel |
novel remove [title] |
Remove a novel from your library |
novel export <json|csv> |
Export your library to JSON or CSV |
novel stats |
Display library statistics |
novel clean |
Remove orphaned data and thumbnails |
novel read |
Start the web viewer |
Web Viewer (Optional)
cd viewer && pnpm install
novel read
# Opens at http://localhost:4173
Data Storage
All your data is stored locally in ~/.novel-library/:
library.db- SQLite database with chapters and metadataurls.txt- Your reading listthumbnails/- Cover imageslibrary.json- Configuration file
Smart Scraping
The tool intelligently avoids rescraping novels that are already complete. A novel is skipped if:
- Its status is marked as "Completed"
- AND all chapters have already been downloaded
This saves time and bandwidth during regular scraping sessions. Other statuses (Ongoing, Hiatus, Dropped, etc.) are always scraped to catch updates.
Testing
The project includes comprehensive automated tests to ensure reliability.
Running Tests
# Install test dependencies
pip install pytest pytest-cov
# Run all tests
pytest tests/
# Run with verbose output
pytest tests/ -v
# Generate coverage report
pytest tests/ --cov=novel --cov-report=html
See tests/README.md for detailed testing documentation.
Recent Changes
Smart Skip Feature (v0.1.0)
- Added
ScrapeCheckermodule to prevent rescraping completed novels - Reduces unnecessary downloads and improves performance
- Fully automated testing with 30+ test cases
- See
docs/ENHANCEMENT_SKIP_COMPLETED.mdfor details
Development
Project Structure
novel-cli/
├── novel/
│ ├── cli.py # Command-line interface
│ ├── manage.py # Library management
│ ├── paths.py # Data storage paths
│ └── scraper/
│ ├── novel_scraper_indexer.py # Main scraper
│ ├── scrape_checker.py # Skip logic
│ ├── writers.py # Database writer
│ └── base_scraper.py # Base scraper class
├── tests/
│ └── test_scrape_checker.py # Test suite
├── examples/
│ └── integration_example.py # Integration examples
└── viewer/ # Web viewer (Svelte)
Contributing
Contributions are welcome! Please ensure:
- All tests pass:
pytest tests/ - Code follows the existing style
- New features include test coverage
Dependencies
requests- HTTP requestsbeautifulsoup4- HTML parsingcloudscraper- Handle CloudFlare protectionselenium- Browser automation (if needed)markdownify- Convert HTML to Markdownlxml- XML/HTML processing
For development:
pytest- Testing frameworkpytest-cov- Coverage reports
AI Use
Ai has been used to create a portion of this code. Specifically to write the tests, and other minor improvements. AI has also been used to improve readability and add helpful code comments.
License
MIT License - see LICENSE file for details
Support
Found a bug or have a suggestion? Open an issue on GitHub: https://github.com/Azizgic/novel-cli/issues
Made with ❤️ for novel readers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file novel_cli-2.0.0.tar.gz.
File metadata
- Download URL: novel_cli-2.0.0.tar.gz
- Upload date:
- Size: 49.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeaf7e98e8e771787750ae52b8a7587aaa4147a23b5e6c2c5756456b62e6a69d
|
|
| MD5 |
468104cd780b8e149a95701b523a03ac
|
|
| BLAKE2b-256 |
d36c058219bf693c24c5f7b1257981d818587247b7f0dbd3d526a65b42aee539
|
File details
Details for the file novel_cli-2.0.0-py3-none-any.whl.
File metadata
- Download URL: novel_cli-2.0.0-py3-none-any.whl
- Upload date:
- Size: 56.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e19efdaee9d2707f007a5462cb767d3ce44fc30fcef6bdcb31caba446d32a57
|
|
| MD5 |
44e9ee6bedccdd9e45c60cab0a0c321e
|
|
| BLAKE2b-256 |
4db898df2f16d10c5c15d0877df61c8606efa8a790b2a76c10a11b4a9e75e400
|