From 9bdcccf713ad7d03de984eeed1854bda50babde2 Mon Sep 17 00:00:00 2001 From: jeancf Date: Sun, 16 Jul 2023 11:18:21 +0200 Subject: [PATCH] Modify call to get_rest_of_thread --- twoot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/twoot.py b/twoot.py index 036b385..579c682 100755 --- a/twoot.py +++ b/twoot.py @@ -169,12 +169,14 @@ Dowload page with full thread of tweets and extract all replied to tweet referen Only used by `get_timeline()`. :param session: Existing HTTP session with Nitter instance :param headers: HTTP headers to use -:param url: url of the thread page to download +:param nitter url: url of the nitter instance to use +:param thread_url: url of the first tweet in thread :return: List of tweets from the thread """ -def _get_rest_of_thread(session, headers, url): +def _get_rest_of_thread(session, headers, nitter_url, thread_url): logging.debug("Downloading tweets in thread from separate page") # Download page with thread + url = nitter_url + thread_url try: thread_page = session.get(url, headers=headers, timeout=HTTPS_REQ_TIMEOUT) except requests.exceptions.ConnectionError: @@ -278,7 +280,7 @@ def get_timeline(nitter_url): thread_link_tag = item.find('a', class_='tweet-link') if thread_link_tag is not None: thread_url = thread_link_tag.get('href') - timeline.extend(_get_rest_of_thread(session, headers, nitter_url + thread_url)) + timeline.extend(_get_rest_of_thread(session, headers, nitter_url, thread_url)) else: # Ignore other classes continue