-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookFinder.py
57 lines (41 loc) · 957 Bytes
/
bookFinder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import isbnlib as isbnlib
from isbnlib.registry import bibformatters
def datahunt(isbnSearch):
searchTerm = isbnSearch
isbn = isbnlib.isbn_from_words(searchTerm)
returnData = isbnlib.meta(isbn)
cover = isbnlib.cover(isbn)
#print("Cover: ", cover)
try:
mainTitle = returnData["Title"]
except Exception as e:
mainTitle = ""
try:
mainAuthors = returnData["Authors"]
except Exception as e:
mainAuthors = ""
try:
mainPublisher = returnData["Publisher"]
except Exception as e:
mainPublisher = ""
try:
mainYear = returnData["Year"]
except Exception as e:
mainYear = ""
try:
mainISBN = returnData["ISBN-13"]
except Exception as e:
mainISBN = ""
try:
mainCover = cover["smallThumbnail"]
except Exception as e:
mainCover = ""
bookInfo = {
"title" : mainTitle,
"author" : mainAuthors,
"publisher" : mainPublisher,
"year" : mainYear,
"isbn" : mainISBN,
"coverURL" : mainCover
}
return bookInfo