editions() returns incorrect isbns when Open Library service is used
acidtv opened this issue · comments
It seems the editions()
call with the Open Library service returns ISBNs from other books.
Example:
>>> import isbnlib
>>> isbnlib.meta("9780596007126")
{'ISBN-13': '9780596007126', 'Title': 'Head First Design Patterns', 'Authors': ['Eric Freeman', 'Elisabeth Freeman', 'Kathy Sierra', 'Bert Bates'], 'Publisher': "O'Reilly Media, Inc.", 'Year': '2004', 'Language': 'en'}
>>> isbnlib.meta(isbnlib.editions("9780596007126", "openl")[1])
{'ISBN-13': '9788475335667', 'Title': 'Josafat', 'Authors': ['Prudenci Bertrana'], 'Publisher': '', 'Year': '1999', 'Language': 'ca'}
I'm using isbnlib 3.10.8 with python 3.9.7.
There are different 'understandings' of what editions
is by the service providers... and I don't have any control of the content returned by the service.
Thanks
Yes, but I don't think that is the case here. Looking at the web page for 'Head first design patterns' it shows the correct editions: https://openlibrary.org/books/OL3436354M/Head_First_design_patterns
Digging deeper, it looks like the url to fetch the editions from the Open Library is incorrect. For this example it seems to use http://openlibrary.org/query.json?type=/type/edition&/books/OL3436354M&isbn_13=&isbn_10=
to fetch the editions. But that url returns the same results for every /books/*
key you put in there.
This kind of url is just the Open Library API! I will check what is going on.
This API stopped to work! I will implement a new version using the new API (soon).
Thank you!
Hi, mek here w/ Open Library. Please let us know if you have questions or need any help w/ Open Library's APIs
https://openlibrary.org/isbn/9780596007126.json is another way to get the json for this item.
Thanks mek. Soon, I will try with the new api.
For isbnlib
, 'editions' is a list of related ISBNs (usually the same book but by another publisher), however after trying with the new API for Open Library, it seems that they don't have the same concept exposed by the API!
For related isbns, you either want the isbns attached to the edition which you can get by adding .json to the edition url e.g. https://openlibrary.org/books/OL25448615M.json
Or you can get the isbns for related editions from the work (which spans editions) using the search API:
https://openlibrary.org/search.json?q=OL25448615M&fields=isbn
The same is true using isbn, e.g. https://openlibrary.org/isbn/9782960133509.json and
https://openlibrary.org/search.json?q=9782960133509&fields=isbn
OK, I see! Then it is very easy to fix... it is now on 'dev'.