mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Handling tweet-link exception
This commit is contained in:
parent
f4addcf5a3
commit
89b6068a04
13
twoot.py
13
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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user