able to fetch content in a series with page limits

This commit is contained in:
retrozelda
2025-02-09 00:52:48 -05:00
parent 6e95fbd82b
commit e733779737

View File

@@ -103,7 +103,7 @@ class BeaconSeries:
return new_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.get(self.series_url)
@@ -119,8 +119,12 @@ class BeaconSeries:
logging.log(helpers.LOG_VERBOSE, f"\"Load More\" click #{click_count}")
click_count = click_count + 1
load_more_button.click()
time.sleep(1)
if max_pages < 0 or click_count < max_pages:
load_more_button.click()
time.sleep(1)
else:
break
except ElementClickInterceptedException: # clicking too fast or while its loading will throw this, so we will just try again
continue
except NoSuchElementException: # I hate python