mirror of
https://github.com/RetroZelda/beacon-snatch.git
synced 2026-06-15 14:28:14 +00:00
able to fetch content in a series with page limits
This commit is contained in:
@@ -103,7 +103,7 @@ class BeaconSeries:
|
|||||||
return new_series
|
return new_series
|
||||||
|
|
||||||
# fetches all the content for this series
|
# fetches all the content for this series
|
||||||
def fetch(self, auth : BeaconAuthentication):
|
def fetch(self, auth : BeaconAuthentication, max_pages = -1):
|
||||||
|
|
||||||
driver = auth.get_driver()
|
driver = auth.get_driver()
|
||||||
driver.get(self.series_url)
|
driver.get(self.series_url)
|
||||||
@@ -119,8 +119,12 @@ class BeaconSeries:
|
|||||||
|
|
||||||
logging.log(helpers.LOG_VERBOSE, f"\"Load More\" click #{click_count}")
|
logging.log(helpers.LOG_VERBOSE, f"\"Load More\" click #{click_count}")
|
||||||
click_count = click_count + 1
|
click_count = click_count + 1
|
||||||
|
|
||||||
|
if max_pages < 0 or click_count < max_pages:
|
||||||
load_more_button.click()
|
load_more_button.click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
break
|
||||||
except ElementClickInterceptedException: # clicking too fast or while its loading will throw this, so we will just try again
|
except ElementClickInterceptedException: # clicking too fast or while its loading will throw this, so we will just try again
|
||||||
continue
|
continue
|
||||||
except NoSuchElementException: # I hate python
|
except NoSuchElementException: # I hate python
|
||||||
|
|||||||
Reference in New Issue
Block a user