-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathSample.py
35 lines (32 loc) · 1.06 KB
/
Sample.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
#!/usr/bin/env python
from Books import Books
from Reviews import Reviews
from Tools import read_books
from time import sleep
# from Tools import *
if __name__ == '__main__':
# >>> Create books object and get all books shelved as "arabic"
b = Books(arabic=False)
# b.append_books(read_books())
b.output_books(2522)
while not b.output_books_editions(read_books(), file_name="editions"):
print("Refreshing after a while")
sleep(50)
while not b.output_books_edition_by_language(read_books("editions"), file_name="ara_books"):
print("Refreshing after a while")
sleep(50)
# >>> Create Reviews object and scrape all reviews from the books list
r = Reviews(edition_reviews=True)
while True:
try:
r.output_books_reviews(read_books("ara_books_list"))
break
# If an error occurs
except Exception as e:
print("ERROR:", str(e))
r.reset()
r.close()
print("Done!")
# delete_repeated_reviews()
# combine_reviews()
# split_reviews(5)