fix ups
This commit is contained in:
+9
-5
@@ -21,8 +21,7 @@ errored = False
|
|||||||
|
|
||||||
scraper: Scraper
|
scraper: Scraper
|
||||||
|
|
||||||
# Returns a list of sorted and filtered TalentTweets (should
|
# Updates TTweetQueue
|
||||||
# be equivalent to queue.txt)
|
|
||||||
async def get_cross_tweets_online():
|
async def get_cross_tweets_online():
|
||||||
global safe_to_post_tweets
|
global safe_to_post_tweets
|
||||||
global queue
|
global queue
|
||||||
@@ -50,9 +49,10 @@ async def get_cross_tweets_online():
|
|||||||
else:
|
else:
|
||||||
queue.finished_user_dates[talent_id] = get_current_date()
|
queue.finished_user_dates[talent_id] = get_current_date()
|
||||||
queue.save_file()
|
queue.save_file()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt as e:
|
||||||
print('Interrupting tweet pulling... NOTE: remaining dates in queue file will not be updated!')
|
print('Interrupting tweet pulling... NOTE: remaining dates in queue file will not be updated!')
|
||||||
queue.save_file()
|
queue.save_file()
|
||||||
|
raise e
|
||||||
except:
|
except:
|
||||||
print('Unhandled error occurred while pulling tweets.')
|
print('Unhandled error occurred while pulling tweets.')
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
@@ -159,9 +159,9 @@ async def run(PROGRAM_ARGS):
|
|||||||
else:
|
else:
|
||||||
print('Tweets were not retrieved cleanly. Not processing queue.')
|
print('Tweets were not retrieved cleanly. Not processing queue.')
|
||||||
return False
|
return False
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt as e:
|
||||||
print('Interrupting queue processing...')
|
print('Interrupting queue processing...')
|
||||||
return False
|
raise e
|
||||||
except:
|
except:
|
||||||
print('Unhandled error occurred while running catch up in posting phase.')
|
print('Unhandled error occurred while running catch up in posting phase.')
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
@@ -172,6 +172,7 @@ async def run(PROGRAM_ARGS):
|
|||||||
|
|
||||||
await get_cross_tweets_online()
|
await get_cross_tweets_online()
|
||||||
|
|
||||||
|
try:
|
||||||
if PROGRAM_ARGS.straight_to_queue:
|
if PROGRAM_ARGS.straight_to_queue:
|
||||||
PROGRAM_ARGS.straight_to_queue = False
|
PROGRAM_ARGS.straight_to_queue = False
|
||||||
print('Processing queue first before pulling tweets...')
|
print('Processing queue first before pulling tweets...')
|
||||||
@@ -179,3 +180,6 @@ async def run(PROGRAM_ARGS):
|
|||||||
else:
|
else:
|
||||||
await get_cross_tweets_online()
|
await get_cross_tweets_online()
|
||||||
return await queue_loop()
|
return await queue_loop()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('Interrupt received. Ending catchup mode...')
|
||||||
|
return False
|
||||||
+1
-1
@@ -100,7 +100,7 @@ class Scraper:
|
|||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
print("Unknown exception occurred, trying again as private...")
|
print("Unknown exception occurred, trying again as private...")
|
||||||
self.get_tweet(id, True)
|
return self.get_tweet(id, True)
|
||||||
|
|
||||||
# since MUST BE TIMEZONE AWARE
|
# since MUST BE TIMEZONE AWARE
|
||||||
# usage example: since=datetime(2023, 8, 1).replace(tzinfo=pytz.utc)
|
# usage example: since=datetime(2023, 8, 1).replace(tzinfo=pytz.utc)
|
||||||
|
|||||||
Reference in New Issue
Block a user