Metadata-Version: 2.4
Name: novel-cli
Version: 2.2.0
Summary: Web novel scraper and library manager with Rich UI
Author-email: Your Name <your@email.com>
License: MIT
Project-URL: Homepage, https://github.com/YOUR_USERNAME/novel-cli
Project-URL: Repository, https://github.com/YOUR_USERNAME/novel-cli
Project-URL: Issues, https://github.com/YOUR_USERNAME/novel-cli/issues
Keywords: novel,scraper,cli,royalroad,novelfull,web-novel
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Requires-Dist: beautifulsoup4>=4.11
Requires-Dist: markdownify>=0.11
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.9
Requires-Dist: loguru>=0.7
Requires-Dist: tenacity>=8.0
Requires-Dist: cloudscraper>=1.2
Requires-Dist: selenium>=4.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-cov>=4.0; extra == "test"
Dynamic: license-file

# novel-cli

A powerful CLI application for scraping, managing, and reading web novels offline.

![Python](https://img.shields.io/badge/python-3.11+-blue)
![License](https://img.shields.io/github/license/Azizgic/novel-cli)

## Features

- Beautiful terminal UI powered by Rich
- Multi-site scraping architecture
- Parallel chapter downloading
- Resume support and crash recovery
- Cached chapter indexes
- Fuzzy searching
- SQLite-based library management
- Statistics and metadata tracking
- Optional Svelte web reader
- Modular and extensible architecture
- Comprehensive test suite

---

## Supported Sites

### Currently Supported

- Royal Road
- NovelFull / NovelOnlineFree

### Planned

- ScribbleHub
- Additional plugin-based site support

---

## Installation

### From Source

```bash
git clone https://github.com/Azizgic/novel-cli.git
cd novel-cli
pip install -e .
```

### Development Installation

```bash
pip install -r requirements-dev.txt
```

---

## Quick Start

Add a novel:

```bash
novel add https://www.royalroad.com/fiction/36735/the-perfect-run
```

Scrape all novels in your reading list:

```bash
novel scrape
```

Scrape a specific novel:

```bash
novel scrape "The Perfect Run"
```

List library:

```bash
novel list
```

Search:

```bash
novel search "perfect"
```

Show details:

```bash
novel show "The Perfect Run"
```

Statistics:

```bash
novel stats
```

---

## Commands

| Command | Description |
|---------|-------------|
| `novel add <url>` | Add a novel URL to the reading list |
| `novel scrape` | Scrape novels from the reading list |
| `novel scrape --dry-run` | Preview actions without downloading |
| `novel scrape --yes` | Skip confirmations |
| `novel update` | Update metadata and statistics |
| `novel list` | Display library |
| `novel show <query>` | Show novel details |
| `novel search <query>` | Fuzzy search |
| `novel remove <query>` | Remove a novel |
| `novel read` | Start web reader |
| `novel stats` | Display statistics |
| `novel clean` | Remove orphaned data |
| `novel export` | Export library |

---

## Example

```bash
$ novel add https://www.royalroad.com/fiction/36735/the-perfect-run
✓ Added: The Perfect Run

$ novel scrape
✓ Indexed chapters
✓ Downloaded chapters

$ novel stats

Novels:      12
Chapters:    4,392
Downloaded:  100%
Storage:     1.8 GB
```

---

## Data Storage

All data is stored under:

```text
~/.novel-library/
├── library.db
├── library.json
├── urls.txt
├── thumbnails/
├── chapter_indices/
└── logs/
```

### Description

| Path | Purpose |
|------|----------|
| `library.db` | SQLite database |
| `library.json` | Configuration and cache |
| `urls.txt` | Reading list |
| `thumbnails/` | Cover images |
| `chapter_indices/` | Cached indexes |
| `logs/` | Log files |

---

## Project Structure

```text
novel-cli/
├── novel/
│   ├── cli/
│   ├── db/
│   ├── scraper/
│   │   ├── sites/
│   │   ├── components/
│   │   └── retry.py
│   ├── scripts/
│   ├── ui/
│   └── utils/
│
├── tests/
├── viewer/
├── examples/
└── docs/
```

---

## Architecture

```text
URL
 │
 ▼
Site Parser
 │
 ▼
Indexer
 │
 ▼
Downloader
 │
 ▼
Writer Thread
 │
 ▼
SQLite Storage
 │
 ▼
CLI / Web Viewer
```

---

## Web Reader

A SvelteKit-based reader is included.

Features:

- Reading progress tracking
- Themes and font customization
- Search
- Chapter navigation
- Reading statistics
- Offline support
- PWA support

Start the reader:

```bash
novel read
```

Or manually:

```bash
cd viewer
pnpm install
pnpm dev
```

---

## Running Tests

```bash
pytest tests/ -v
```

Coverage:

```bash
pytest --cov=novel tests/
```

---

## Development Roadmap

- [x] Royal Road support
- [x] NovelFull support
- [x] Parallel downloads
- [x] Resume support
- [x] Rich terminal UI
- [x] Svelte reader
- [ ] Plugin system
- [ ] EPUB export
- [ ] Scheduled updates
- [ ] Full-text search
- [ ] Additional sites

---

## Dependencies

### Python

- rich
- typer
- requests
- beautifulsoup4
- markdownify
- loguru
- tenacity

### Frontend

- SvelteKit
- TailwindCSS
- TypeScript
- pnpm

---

## Contributing

Contributions, bug reports, and feature requests are welcome.

1. Fork the repository
2. Create a branch
3. Make changes
4. Add tests
5. Submit a pull request

---

## License

MIT License

---

## Links

Repository:

https://github.com/Azizgic/novel-cli

Issues:

https://github.com/Azizgic/novel-cli/issues
