Correct previous_tweet_url

This commit is contained in:
jeancf 2023-07-16 15:42:58 +02:00
parent b227c1bb04
commit 37204c5202

View File

@ -211,8 +211,9 @@ def _get_rest_of_thread(session, headers, nitter_url, thread_url):
for item in list: for item in list:
timeline.append((previous_tweet_url, item)) timeline.append((previous_tweet_url, item))
# Get the url of the tweet # Get the url of the tweet
previous_tweet_url = item.find('a', class_='tweet-link') previous_tweet_tag = item.find('a', class_='tweet-link')
if previous_tweet_url is None: if previous_tweet_url is None:
previous_tweet_url = previous_tweet_tag.get('href').strip('#m')
logging.error('Thread tweet is missing link tag') logging.error('Thread tweet is missing link tag')
return timeline return timeline
@ -289,7 +290,7 @@ def get_timeline(nitter_url):
# Get the url of the tweet # Get the url of the tweet
thread_link_tag = item.find('a', class_='tweet-link') thread_link_tag = item.find('a', class_='tweet-link')
if thread_link_tag is not None: if thread_link_tag is not None:
thread_url = thread_link_tag.get('href') thread_url = thread_link_tag.get('href').strip('#m')
timeline.append((thread_url, first_item)) timeline.append((thread_url, first_item))
@ -1193,8 +1194,8 @@ def main(argv):
# Find in database toot id of replied_to_tweet # Find in database toot id of replied_to_tweet
replied_to_toot = None replied_to_toot = None
if tweet['replied_to_tweet'] is not None: if tweet['replied_to_tweet'] is not None:
logging.debug("Seazrching db for replied-to-tweet " + tweet['replied_to_tweet']) logging.debug("Searching db for replied-to-tweet " + tweet['replied_to_tweet'])
db.execute("SELECT toot_id FROM toots WHERE tweet_id=?", tweet['replied_to_tweet']) db.execute("SELECT toot_id FROM toots WHERE tweet_id=?", (tweet['replied_to_tweet']))
replied_to_toot = db.fetchone() replied_to_toot = db.fetchone()
if replied_to_toot is None: if replied_to_toot is None: