Skip to content

Conversation

@ShortTimeNoSee
Copy link

@ShortTimeNoSee ShortTimeNoSee commented Jul 18, 2025

Hi there! Thanks for creating this package. I'd wanted to add a feature for my own use and thought it might be helpful for others too.

This pull request adds the ability to fetch a user's reading progress for a book.

book.reading_progress(book_id, cookies) method would be the new method on the Book client to get the current progress (e.g., "70%"). This requires authentication, so I've added the necessary logic to handle session cookies for book-related requests. I also added a user-agent to book requests. This should HELP to prevent the 403 issues seen in Issue #4

The README is also updated, and while adding the new feature, I ran the static type checker pyright and fixed a number of potential type-related issues in the parsing logic. This should make the code a bit more robust/future-proof without changing any existing functionality.

All existing methods are backward compatible, so these changes shouldn't break anything for current users.

Let me know if you have any feedback or suggestions.

reading_progress to the features list;
new code example for fetching progress;
cookie requirements for authenticated endpoints
This commit marks a significant evolution of the unofficial StoryGraph API wrapper, focusing on performance, reliability, and expanded functionality.

- Replaced Selenium with `requests`: The core scraping logic has been refactored to use the `requests` library directly, removing the heavy dependency on Selenium and a headless browser. This results in a much faster, lighter, and more stable client.

- Expanded API Coverage: Added numerous new methods to interact with the StoryGraph API:
    - **User:** Fetch `currently-reading`, `to-read`, and `books-read` shelves, and retrieve all journal entries.
    - **Book:** Get reading progress, read dates, AI summaries, and journal entries for specific books.

- Enhanced Authentication: Implemented a more reliable cookie-based authentication flow, requiring `_storygraph_session` and `remember_user_token`.

- Added Comprehensive Tests: A new `test.py` script provides a full suite of tests for all client methods, ensuring reliability.

- New README: Generated a completely new `README.md` that reflects all the new features, including detailed setup instructions and up-to-date usage examples.
@kirst412
Copy link

kirst412 commented Aug 4, 2025

Just wanted to thank you for putting this PR together, works great for me! The updated error handling is a lot easier to debug as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants