diff --git a/readit.py b/readit.py index f102026..38d9d6e 100755 --- a/readit.py +++ b/readit.py @@ -45,11 +45,11 @@ def login(driver): return True def pageHandler(driver, id, page): - if not loadPage("https://app.myreadit.com/reader/%s#%i" % (id, int(page)), driver): - if "/ %i" % (int(page) - 1) in driver.page_source or "/ %i" % (int(page) - 2) in driver.page_source: - return False - while not loadPage("https://app.myreadit.com/reader/%s#%i" % (id, int(page)), driver): - time.sleep(5) + if "/ %i" % (int(page) - 1) in driver.page_source or "/ %i" % (int(page) - 2) in driver.page_source: + return False + + while not loadPage("https://app.myreadit.com/reader/%s#%i" % (id, int(page)), driver): + pass img = driver.find_element_by_id("page1").get_attribute("src") helpers.downloadPage(img, id, page, helpers.JPG)