mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Squash bugs
This commit is contained in:
parent
061db3f729
commit
24e9bd5691
17
twoot.py
17
twoot.py
|
@ -175,7 +175,7 @@ Only used by `get_timeline()`.
|
|||
"""
|
||||
def _get_rest_of_thread(session, headers, nitter_url, thread_url, first_item):
|
||||
# Add first item to timeline
|
||||
timeline = [(thread_url, first_item)]
|
||||
timeline = [(None, first_item)]
|
||||
|
||||
logging.debug("Downloading tweets in thread from separate page")
|
||||
# Download page with thread
|
||||
|
@ -213,13 +213,16 @@ def _get_rest_of_thread(session, headers, nitter_url, thread_url, first_item):
|
|||
for item in list:
|
||||
timeline.append((previous_tweet_url, item))
|
||||
# Get the url of the tweet
|
||||
previous_tweet_tag = item.find('a', class_='tweet-link')
|
||||
if previous_tweet_url is None:
|
||||
previous_tweet_url = previous_tweet_tag.get('href').strip('#m')
|
||||
tweet_link_tag = item.find('a', class_='tweet-link')
|
||||
if tweet_link_tag is not None:
|
||||
previous_tweet_url = tweet_link_tag.get('href').strip('#m')
|
||||
else:
|
||||
previous_tweet_url = None
|
||||
logging.error('Thread tweet is missing link tag')
|
||||
|
||||
# return timeline in reverse chronological order
|
||||
return timeline.reverse()
|
||||
timeline.reverse()
|
||||
return timeline
|
||||
|
||||
|
||||
"""
|
||||
|
@ -1195,12 +1198,14 @@ def main(argv):
|
|||
# Find in database toot id of replied_to_tweet
|
||||
replied_to_toot = None
|
||||
if tweet['replied_to_tweet'] is not None:
|
||||
logging.debug("Searching db for replied-to-tweet " + tweet['replied_to_tweet'])
|
||||
logging.debug("Searching db for toot corresponding to replied-to-tweet " + tweet['replied_to_tweet'])
|
||||
db.execute("SELECT toot_id FROM toots WHERE tweet_id=?", [tweet['replied_to_tweet']])
|
||||
replied_to_toot = db.fetchone()
|
||||
|
||||
if replied_to_toot is None:
|
||||
logging.warning('Replied-to tweet %s not found in database', tweet['replied_to_tweet'])
|
||||
else:
|
||||
logging.debug("toot %s found", replied_to_toot)
|
||||
|
||||
# Post toot
|
||||
toot = {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user