Ignore timeline-item without tweet-link tag

This commit is contained in:
jeancf 2023-07-22 10:46:59 +02:00
parent b69ac01b3c
commit 2327294af3

View File

@ -975,7 +975,12 @@ def main(argv):
in_db_cnt = 0 in_db_cnt = 0
for replied_to_tweet, status in timeline: for replied_to_tweet, 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') tweet_link_tag = status.find('a', class_='tweet-link')
if tweet_link_tag is None:
logging.debug("Malformed timeline item (no tweet link), skipping")
continue
tweet_id = tweet_link_tag.get('href').strip('#m')
status_id = tweet_id.split('/')[3] status_id = tweet_id.split('/')[3]
logging.debug('processing tweet %s', tweet_id) logging.debug('processing tweet %s', tweet_id)