Skip to main content

Scrape Goodreads User Data: Profile, Book Shelves, Books, Authors

Project description

Goodreads Icon

Goodreads User Scraper

Scrape Goodreads User Data: Profile, Book Shelves, Books, Authors

Version  Downloads 

Contents

Usage

Install once, then run

Best for repeat use. Installs the CLI into an isolated environment and adds the goodreads-user-scraper command to your shell.

Using pipx:

pipx install goodreads-user-scraper
goodreads-user-scraper --user_id <your id> --output_dir goodreads-data

Or with uv:

uv tool install goodreads-user-scraper
goodreads-user-scraper --user_id <your id> --output_dir goodreads-data

Run once without installing

Best for one-off use. Downloads and runs the CLI in a temporary environment: no install step, no $PATH changes.

Using pipx:

pipx run goodreads-user-scraper --user_id <your id> --output_dir goodreads-data

Or with uvx (ships with uv):

uvx goodreads-user-scraper --user_id <your id> --output_dir goodreads-data

Arguments

--user_id

  • Description: The user whose data should be scraped. Find your user id using these directions.
  • Required: Yes

--output_dir

  • Description: The directory where all scraped data will be output.
  • Required: No
  • Default: goodreads-data

--skip_user_info

  • Description: If passed, skip scraping user information.
  • Required: No

--skip_shelves

  • Description: If passed, skip scraping shelves.
  • Required: No

--skip_authors

  • Description: If passed, skip scraping authors.
  • Required: No

--cookie

  • Description: Your Goodreads session cookie (the full Cookie: request-header value). Required for shelf scraping — see Authentication.
  • Required: No
  • Default: None

--cookie_file

  • Description: Path to a text file containing your Goodreads session cookie. Used only if --cookie is not passed and GOODREADS_COOKIE is not set.
  • Required: No
  • Default: None

Authentication

Shelf scraping requires authentication — Goodreads hides shelf data behind login, and the tool gathers books and authors from your shelves. So without a cookie you get a profile only; a cookie adds shelves, books, and authors, and works on your own private profile too.

Getting your session cookie

  1. Sign in to Goodreads in your browser.
  2. Open DevTools (Cmd/Ctrl+Shift+I) and switch to the Network tab.
  3. Refresh the page, then click any goodreads.com request in the list.
  4. In the request Headers, find the Cookie: header and copy its full value.

Passing the cookie

In order of precedence (first one set wins):

  1. --cookie "<cookie string>"
  2. GOODREADS_COOKIE environment variable
  3. --cookie_file <path-to-file>

Cookies typically last several weeks. If you see a "Cookie appears invalid or expired" error, re-grab the cookie from your browser.

If no cookie is provided, shelf scraping is skipped with a warning. Pass --skip_shelves to suppress the warning.

Troubleshooting

Missing profile or shelf data?

  • Your own account: pass your session cookie (see Authentication). Every request is authenticated, so your profile, shelves, and books all scrape even when your profile is private — there's no need to change any Goodreads privacy settings.
  • Another user's account: you can only see what your logged-in account is allowed to, so their profile must be publicly viewable. Shelves still require your cookie.

Development

  1. Clone the GitHub repository

    git clone https://github.com/YashTotale/goodreads-user-scraper.git
    
  2. Run the install script

    bash scripts/install.sh
    
  3. Make changes

  4. Run the unit tests

    pytest
    

    These run against saved Goodreads HTML in tests/fixtures/ — no network, no cookie. This is the CI gate on every push and PR.

    When Goodreads changes its markup, refresh the fixtures with scripts/capture_fixtures.py (reads your cookie from .goodreads-cookie if present), then re-run pytest.

  5. Optionally run the live smoke test

    bash scripts/test.sh
    

    This scrapes the real Goodreads site end to end. To include shelf scraping, save your Goodreads cookie to a gitignored .goodreads-cookie file in the repo root — the test script picks it up automatically. CI runs this monthly (see integration.yml) to catch Goodreads markup changes.

Publishing

Publishing is automated via GitHub Actions using PyPI Trusted Publishing (OIDC) — no API tokens are stored.

Run the publish script with the version bump type:

bash scripts/publish.sh <patch|minor|major>

The script bumps the version, creates a git tag, and pushes it. The publish workflow builds the distribution and uploads it to PyPI on any pushed v* tag.

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_user_scraper-2.2.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

goodreads_user_scraper-2.2.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file goodreads_user_scraper-2.2.0.tar.gz.

File metadata

  • Download URL: goodreads_user_scraper-2.2.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for goodreads_user_scraper-2.2.0.tar.gz
Algorithm Hash digest
SHA256 03ff8b08472600d37fe873965e42eabcfa084de472f3257111da80752b7f28b1
MD5 0750438e717f99ecd884c8bcbd908d52
BLAKE2b-256 85d0418806d48480ac5c5c5ccf2759c9b45373aa8891094c36df6fc7a3f81b75

See more details on using hashes here.

Provenance

The following attestation bundles were made for goodreads_user_scraper-2.2.0.tar.gz:

Publisher: publish.yml on YashTotale/goodreads-user-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file goodreads_user_scraper-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for goodreads_user_scraper-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9397665a94c617bd8ad9013f9a2bdafdecf6d0686d3aa9463e0070ce8592ac59
MD5 f05e2c6b3f8d94627db9f53c8f48f8ee
BLAKE2b-256 fddf540f0b4a63b946458527d90fb7baf00f968ba21b98dad2362a3a48a06fe7

See more details on using hashes here.

Provenance

The following attestation bundles were made for goodreads_user_scraper-2.2.0-py3-none-any.whl:

Publisher: publish.yml on YashTotale/goodreads-user-scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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