Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry on "no next found" #7

Merged
merged 4 commits into from
Jul 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions schlabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,10 @@ def process_posts(self, cur_page, dlurl):
self.process_unkown(post, post_type, dlurl)

def backup(self, cont_url = ""):
maxretrycount = 10
retrycount = 0
dlurl = self.rooturl + cont_url
while True:
while retrycount < maxretrycount:
print("Get: " + dlurl)
dl = requests.get(dlurl)
page = BeautifulSoup(dl.content, 'html.parser')
Expand All @@ -369,8 +371,10 @@ def backup(self, cont_url = ""):
print("Process Posts")
self.process_posts(page, dlurl)
if self.dlnextfound == False:
print("no next found.")
break
retrycount=retrycount+1
print("no next found. retry {} of {}".format(retrycount, maxretrycount))
else:
retrycount = 0

def main(soups, bup_dir, cont_from):
for site in soups:
Expand Down