From cdc1fb03f7d0dec01df07fa32c0439c971db1fd7 Mon Sep 17 00:00:00 2001 From: jeancf Date: Fri, 14 Jul 2023 13:11:20 +0200 Subject: [PATCH] Add comments --- twoot.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/twoot.py b/twoot.py index e57010b..8ae75fd 100755 --- a/twoot.py +++ b/twoot.py @@ -295,9 +295,9 @@ def get_timeline(nitter_url): timeline = [] for item in list: classes = item['class'] - if 'timeline-item' in classes: + if 'timeline-item' in classes: # Individual tweet timeline.append(item) - elif 'thread-line' in classes: + elif 'thread-line' in classes: # First tweet of a thread # Get the first item of thread first_item = item.find('div', class_='timeline-item') timeline.append(first_item) @@ -956,21 +956,17 @@ def main(argv): # Select random nitter instance to fetch updates from nitter_url = 'https://' + NITTER_URLS[random.randint(0, len(NITTER_URLS) - 1)] - # ********************************************************** - # Load twitter page of user. Process all tweets and generate - # list of dictionaries ready to be posted on Mastodon - # ********************************************************** - # To store content of all tweets from this user - tweets = [] + # Load twitter page of user soup, timeline = get_timeline(nitter_url) logging.info('Processing ' + str(len(timeline)) + ' tweets found in timeline') # ********************************************************** - # Process each tweets and generate dictionary + # Process each tweets and generate an array of dictionaries # with data ready to be posted on Mastodon # ********************************************************** + tweets = [] out_date_cnt = 0 in_db_cnt = 0 for status in timeline: