问题
The python package 'isbntools' (https://github.com/xlcnd/isbntools) allows to retrieve bibliography information about books from online resources. In particular the script isbn_meta [number]
retrieves information about the book with given isbn-number [number]
. Among other it uses data from google using googleapis as https://www.googleapis.com/books/v1/volumes?q=isbn+[number]&fields=
. It is obvious that the url can be adjusted to search e.g. for a general [keyword]
https://www.googleapis.com/books/v1/volumes?q=[keyword]
. But how can I reuse the code in 'isbntools' to create a script, say title_meta
which searches and retrieves bibliography data based on [keyword]
. My problem is to some extent that it is not obvious for me how to deal consistently with the python package.
回答1:
In version 3.0.1 exists a new script isbn_goom
which uses goom.py that does exactly what you want.
回答2:
Note: This is just an example, not meant to be used as is.
You can override the variable that contains the URL in this way, when you want:
import goob
goob.SERVICE_URL = 'my_new_googleapis_url'
myquery = goob.query(myKeyword)
Notice that you will need an %s
in the SERVICE_URL
variable on the place you want to put your keyword.
来源:https://stackoverflow.com/questions/22960956/adapt-isbntools-to-search-for-keywords-in-author-and-title