fixed bug where keyboardinterrupt did not break infinite loop
This commit is contained in:
@@ -250,6 +250,8 @@ class Twitter(object):
|
||||
content['video'] = self._extract_video_url(elem)
|
||||
# get image(s)
|
||||
content['images'] = self._extract_post_images(elem)
|
||||
except KeyboardInterrupt:
|
||||
return
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
@@ -312,6 +314,7 @@ def scrape_account(account: str, until_year: int):
|
||||
num_posts_found = get_period(account, start_date, end_date)
|
||||
except KeyboardInterrupt:
|
||||
logging.warning('KeyboardInterrupt')
|
||||
return
|
||||
except:
|
||||
date_list.append((start_date, end_date))
|
||||
logging.warning(f'retrying later due to error getting period {start_date} to {end_date}')
|
||||
|
||||
Reference in New Issue
Block a user