This project provides a Python module and script for scraping detailed information about books from Goodreads. It includes functions to retrieve book URLs, extract book details, and process Goodreads list URLs.S
Project description
Goodreads Miner
A Python CLI tool and module for scraping book information from Goodreads lists and saving it into CSV files.
Table of Contents
Introduction
Currently, Goodreads does not allow importing books directly from a list into your account.
This tool solves that problem by:
- Fetching one or multiple book lists
- Generating a CSV that can be imported into your Goodreads account
In short, it automates the tedious process of adding books manually.
This project provides a Python package and CLI script for scraping detailed information about books from Goodreads. It includes functions to:
- Retrieve book URLs from a Goodreads page
- Extract book details such as title, author, ISBN, and ratings
- Process multiple Goodreads list URLs from a file
- Save all collected data into CSV files
Features
- Fetch books from a single list or multiple lists
- Generate a CSV ready for import into Goodreads
- Save scraped data into CSV files
- Unit tests covering edge cases and file handling
Installation
- Clone the repository:
git clone https://github.com/charveey/goodreads-miner.git
cd goodreads-miner
- Install dependencies using UV:
uv install
Usage
CLI (Recommended)
Run the main script using uv:
uv run goodread_miner.main --file data/list.txt
CLI Options
--url <goodreads_list_url>: Scrape a single Goodreads list URL--file <file_with_goodreads_lists_urls>: Scrape multiple lists from a file--test: Run a predefined test URL
Example :
uv run goodread_miner.main --url https://www.goodreads.com/list/show/195641.Books_to_read_on_Kashmir
Output:
- The script generates a CSV file for each list in the
data/folder. - Filenames are derived from the list name, e.g.,
195641 - Books_to_read_on_Kashmir.csv.
Module Usage
You can also use the package directly in Python:
from goodread_miner.scraper import get_books, scrape_book
from goodread_miner.save_csv import save_import
books = get_books("https://www.goodreads.com/list/show/195641.Books_to_read_on_Kashmir")
data = [scrape_book(url, "2025-11-01") for url in books]
save_import(data, "data/list.csv")
Documentation
Detailed docstrings are included in the code for all functions and classes in:
goodread_miner/scraper.pygoodread_miner/save_csv.pygoodread_miner/main.py
Running Tests
Run all tests using pytest:
pytest tests
- Mocks are used for network calls and file reads
- Edge cases for parsing, scraping, and CSV saving are fully covered
TO-DO
- Allow specifying which Bookshelf to add the books to in Goodreads
- Add a
--output_diroption to specify where the CSV file should be saved
Contributing
Feel free to contribute to the project by opening issues or submitting pull requests. Contributions are always welcome!
License
This script is licensed under the MIT License.
Project details
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 goodreads_miner-0.3.0.tar.gz.
File metadata
- Download URL: goodreads_miner-0.3.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dfc9675f8ead445e9f869cf7efb5c0157a4f11a67f3da60ea84df902e76373e
|
|
| MD5 |
19a12cf27c8aa887712edbcd025a1d8d
|
|
| BLAKE2b-256 |
aa997b343b5e42b5e28b70bd05916ddcf774800069068ea4844cad8d0a5fd08a
|
File details
Details for the file goodreads_miner-0.3.0-py3-none-any.whl.
File metadata
- Download URL: goodreads_miner-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c9ff1e214ce3509ee681eca5fa377184b1ca4bc2951d94556a29a27976e6e6b
|
|
| MD5 |
367f4698023ad8174f8b7502e5aab0b9
|
|
| BLAKE2b-256 |
6f662356f30038e1ebcdea48a0c349a49b02799634845c0d34d80188ed5ef62d
|