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.

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.1.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.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: goodreads_miner-0.4.1.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.1.tar.gz
Algorithm Hash digest
SHA256 2f61845932300333e066827c1310a14e3a8e9e41459b726f95870f7b7c4865cb
MD5 b330083b2fb9ddafa0b95c920f6640ef
BLAKE2b-256 c6507ad3cc51b1d75d86513225aff2428abf05eb744693d53a84fd471891e8ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goodreads_miner-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c25e514d74da6c17f18957ae1a44629eea8bc758ac086ccb66f082ed524393d7
MD5 dcb3799f9c93863005f8c21c3c30d923
BLAKE2b-256 1edf1567185199371a01a0110c72f17e33c99b0616f993caef9a5ef98802013b

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