diff --git a/twoot.py b/twoot.py index da8b2e8..ffc5624 100755 --- a/twoot.py +++ b/twoot.py @@ -885,8 +885,13 @@ def main(argv): in_db_cnt = 0 for status in timeline: # Extract tweet ID and status ID - tweet_id = status.find('a', class_='tweet-link').get('href').strip('#m') - status_id = tweet_id.split('/')[3] + try: + tweet_id = status.find('a', class_='tweet-link').get('href').strip('#m') + status_id = tweet_id.split('/')[3] + except Exception as e: + logging.critical('Malformed timeline downloaded from nitter instance') + logging.debug(e) + shutdown(-1) logging.debug('processing tweet %s', tweet_id) @@ -995,8 +1000,8 @@ def main(argv): timezone_display = pytz.timezone(TOML['options']['tweet_timezone']) else: # Use local timezone by default timezone_display = datetime.now().astimezone().tzinfo - logging.debug("Timestamp UTC " + str(timestamp)) - logging.debug("Timezone to use" + str(timezone_display)) + logging.debug("Timestamp UTC: " + str(timestamp)) + logging.debug("Timezone to use: " + str(timezone_display)) timestamp_display = pytz.utc.localize(timestamp).astimezone(timezone_display) logging.debug("Timestamp converted " + str(timestamp_display))