mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-05-08 12:33:56 +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
|
in_db_cnt = 0
|
||||||
for status in timeline:
|
for status in timeline:
|
||||||
# Extract tweet ID and status ID
|
# Extract tweet ID and status ID
|
||||||
tweet_id = status.find('a', class_='tweet-link').get('href').strip('#m')
|
try:
|
||||||
status_id = tweet_id.split('/')[3]
|
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)
|
logging.debug('processing tweet %s', tweet_id)
|
||||||
|
|
||||||
@ -995,8 +1000,8 @@ def main(argv):
|
|||||||
timezone_display = pytz.timezone(TOML['options']['tweet_timezone'])
|
timezone_display = pytz.timezone(TOML['options']['tweet_timezone'])
|
||||||
else: # Use local timezone by default
|
else: # Use local timezone by default
|
||||||
timezone_display = datetime.now().astimezone().tzinfo
|
timezone_display = datetime.now().astimezone().tzinfo
|
||||||
logging.debug("Timestamp UTC " + str(timestamp))
|
logging.debug("Timestamp UTC: " + str(timestamp))
|
||||||
logging.debug("Timezone to use" + str(timezone_display))
|
logging.debug("Timezone to use: " + str(timezone_display))
|
||||||
timestamp_display = pytz.utc.localize(timestamp).astimezone(timezone_display)
|
timestamp_display = pytz.utc.localize(timestamp).astimezone(timezone_display)
|
||||||
logging.debug("Timestamp converted " + str(timestamp_display))
|
logging.debug("Timestamp converted " + str(timestamp_display))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user