1
+ from bs4 import BeautifulSoup
2
+ import requests
3
+
4
+
5
+ import webbrowser
6
+
7
+
8
+
9
+
10
+ booklinks = []
11
+ booktitles = []
12
+
13
+ def findfromgoldenaudiobooks (bookname ):
14
+ URL = "https://goldenaudiobooks.com/?s="
15
+ r = requests .get (URL + bookname )
16
+ soup = BeautifulSoup (r .content , 'html5lib' )
17
+ booklist = soup .findAll ('h2' , attrs = {'class' :'entry-title' })
18
+
19
+ for book in booklist :
20
+ booklinks .append (book .a ['href' ])
21
+ booktitles .append (book .a .text )
22
+
23
+ def findfromfindaudiobooks (bookname ):
24
+ URL = "https://findaudiobook.com/?s="
25
+ r = requests .get (URL + bookname )
26
+ soup = BeautifulSoup (r .content , 'html5lib' )
27
+ booklist = soup .findAll ('h2' , attrs = {'class' :'entry-title post-title' })
28
+
29
+ for book in booklist :
30
+ booklinks .append (book .a ['href' ])
31
+ booktitles .append (book .a .text )
32
+
33
+ def findfromfullengthaudiobooks (bookname ):
34
+ URL = "https://fulllengthaudiobooks.com/?s="
35
+ r = requests .get (URL + bookname )
36
+ soup = BeautifulSoup (r .content , 'html5lib' )
37
+ booklist = soup .findAll ('h2' , attrs = {'class' :'entry-title post-title' })
38
+
39
+ for book in booklist :
40
+ booklinks .append (book .a ['href' ])
41
+ booktitles .append (book .a .text )
42
+
43
+
44
+ def findfrom101audiobooks (bookname ):
45
+ URL = "https://101audiobooks.net/?s="
46
+ r = requests .get (URL + bookname )
47
+ soup = BeautifulSoup (r .content , 'html5lib' )
48
+ booklist = soup .findAll ('h2' , attrs = {'class' :'entry-title' })
49
+
50
+ for book in booklist :
51
+ booklinks .append (book .a ['href' ])
52
+ booktitles .append (book .a .text )
53
+
54
+ search = input ("search for a book " )
55
+
56
+ findfromgoldenaudiobooks (search )
57
+ findfromfindaudiobooks (search )
58
+ findfromfullengthaudiobooks (search )
59
+ findfrom101audiobooks (search )
60
+
61
+ for x in range (1 , len (booktitles ) + 1 ):
62
+ print (str (x ) + ": " + booktitles [x - 1 ])
63
+
64
+ booknum = int (input ("select a book number " ))
65
+ print ("opening " + str (booklinks [booknum - 1 ]))
66
+ webbrowser .open (str (booklinks [booknum - 1 ]), new = 2 )
67
+
68
+
0 commit comments