Goodreads Developers discussion
questions
>
How do I get Good Reads Book ID from a Good Reads URL?
date
newest »
newest »
Don't know how to properly format code in OP. Please check this: https://www.notehub.org/pnlkrThank you!
We may change the format of the URL at any time.Haven't tested this extensively, but i think if you look for the first match of /(\d+?)/ that will work.
Keep in mind this could break at any moment if we make changes to our url structures.


Basically I want to extract Good Read ID from the Good Read URL.
Example:
URL - https://www.goodreads.com/book/show/1...
The ID here is 1. How do I get it? Is there any API end point?
If not, I can use good ol regex. So I think following are valid URL formats:
- https://www.goodreads.com/book/show/1
- https://www.goodreads.com/book/show/1...
- https://www.goodreads.com/book/show/1...
- https://www.goodreads.com/book/show/1...
So basically the format is https://www.goodreads.com/book/show/
However what if the book name itself has a number?
Take this example: 12 Monkeys
Following are valid:
- https://www.goodreads.com/book/show/8...
- https://www.goodreads.com/book/show/8...
So now regex becomes: https://www.goodreads.com/book/show/
but that again fits into: https://www.goodreads.com/book/show/
Am I right path?