Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions twikit/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3596,14 +3596,19 @@ async def get_list_tweets(
next_cursor = items[-1]['content']['value']

results = []
for item in items:
if not item['entryId'].startswith('tweet'):
continue

def handle_item(item):
tweet = tweet_from_data(self, item)
if tweet is not None:
results.append(tweet)

for item in items:
if item['entryId'].startswith('tweet'):
handle_item(item)
elif item['entryId'].startswith('list-conversation'):
for item in item['content']['items']:
handle_item(item)
Comment on lines +3608 to +3610

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Avoid shadowing the 'item' variable in the inner loop.

The inner loop reuses the name 'item' which shadows the outer 'item'. This could lead to confusion when reading the code. Consider renaming the inner loop variable (e.g., to 'sub_item') for clarity.

Suggested change
elif item['entryId'].startswith('list-conversation'):
for item in item['content']['items']:
handle_item(item)
elif item['entryId'].startswith('list-conversation'):
for sub_item in item['content']['items']:
handle_item(sub_item)


return Result(
results,
partial(self.get_list_tweets, list_id, count, next_cursor),
Expand Down