mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Modify call to get_rest_of_thread
This commit is contained in:
parent
f585878d0f
commit
9bdcccf713
8
twoot.py
8
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user