Skip to main content

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

  1. Clone the repository:
git clone https://github.com/charveey/goodreads-miner.git
cd goodreads-miner
  1. Install dependencies using UV:
uv install

Usage

CLI (Recommended)

Run the main script using uv:

uv run goodreads_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 goodreads_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 goodreads_miner.scraper import get_books, scrape_book
from goodreads_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:

  • goodreads_miner/scraper.py
  • goodreads_miner/save_csv.py
  • goodreads_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_dir option 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

goodreads_miner-0.4.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goodreads_miner-0.4.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file goodreads_miner-0.4.0.tar.gz.

File metadata

  • Download URL: goodreads_miner-0.4.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for goodreads_miner-0.4.0.tar.gz
Algorithm Hash digest
SHA256 36a451b4d0d6c10a60b5414ce60eae9b9de58747dfd89065c8af4ba8a311c0f8
MD5 2b552207074b521013d99039d716be36
BLAKE2b-256 485369b8d43f7e9cb4cda2f1fd17ac8a6a4f4f08270a441f5dcdebf97f2a43b2

See more details on using hashes here.

File details

Details for the file goodreads_miner-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for goodreads_miner-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b687a89d7878950f408b415a4cc9d39bd6e4f18cad7d8b39b1c5c7fb5cbe3243
MD5 1b687bc2663711f04aac144a89ba45a5
BLAKE2b-256 3d062ca4e3bfe6d2f38e45830f34d695d625db0f8026995e6a6ed679a100e056

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page