Correct some bugs

This is running but duplicate replies are collected.
This commit is contained in:
jeancf 2023-07-23 11:06:36 +02:00
parent a9dae52887
commit d460d2feac

View File

@ -178,7 +178,7 @@ def item_is_own_tweet(item):
username = username_tag.get('title').lstrip('@')
if (username == TOML['config']['twitter_account']):
return True
logging.debug("item is not authored by ", TOML['config']['twitter_account'])
logging.debug("item is not authored by " + TOML['config']['twitter_account'])
return False
"""
@ -225,17 +225,18 @@ def _get_rest_of_thread(session, headers, nitter_url, thread_url, first_item):
list = []
# Get all items in thread after main tweet
after_tweet = soup.find('div', 'after-tweet')
if after_tweet is None:
if after_tweet is not None:
list = after_tweet.find_all('div', class_='timeline-item')
# Get all the replies from tweet account in the replies section below thread
if TOML['config']['post_reply_to']:
if TOML['options']['post_reply_to']:
previous_tweet_url = None
replies = soup.find('div', id='r')
if replies is not None:
list.extend(replies.find_all('div', class_='timeline_item'))
list.extend(replies.find_all('div', class_='timeline-item'))
# Build timeline of tuples
timeline = []
previous_tweet_url = thread_url
for item in list:
# Add item to the list