mahrtayyab / tweety

Twitter Scraper
496 stars 67 forks source link

Bug - Like iteration does not return all likes #172

Closed agnoam closed 8 months ago

agnoam commented 8 months ago

Problem description:

When using the iter_tweet_likes() with a cursor, and trying to yield until the end (just in case the rate limit is not exceeded)

Example code:

# Base variables
USERNAME = ""
PASSWORD = ""
TWEET_ID = ""

# User sign in
twitter_app: Twitter = Twitter("session")
twitter_app.sign_in(USERNAME, PASSWORD)

# Iteration data
last_cursor: str = None
iterated_once = False
last_batch = []
total_data = []

while not iterated_once or len(last_batch): 
    last_batch = []

    # First Iteration disable   
    if not iterated_once:
        iterated_once = True

    # Iterating from the last cursor
    likes_gen = twitter_app.iter_tweet_likes(TWEET_ID, cursor=last_cursor)
    for likes_query_obj, likes_list in likes_gen:
        last_cursor = likes_query_obj.cursor
        last_batch = likes_list
        total_data += last_batch

print(f'Total scraped likes: {len(total_data)}')

This is the code I used in my test. and for example for post with 69 likes, this script returned me 67 likes.

mahrtayyab commented 8 months ago

Can you please specify Tweet Id

mahrtayyab commented 8 months ago
agnoam commented 8 months ago

Can you please specify Tweet Id

1763017952243429422

agnoam commented 8 months ago
  • Twitter no longer returns anything in its full Capacity.

What does it mean?

mahrtayyab commented 8 months ago
  • Twitter no longer returns anything in its full Capacity.

What does it mean?

Even on Website there are 67

agnoam commented 8 months ago

Where did you see it? image

There are 69 likes in this post (right for now)

mahrtayyab commented 8 months ago

https://twitter.com/ShrimpTeslaLong/status/1763017952243429422/likes

They are 67 if you count , either the Like Count is messed or something else with Twitter