[Python] Scrape Twitter with snscape

Discussão em 'Python' iniciado por Stack, Agosto 15, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to scrape sport comments/text from Twitter, but it shows error 4 requests to https://twitter.com/i/api/graphql/7...twitter_blue_verified_badge_is_enabled":true} failed, giving up.

    limit = 1000
    tweets_list = []
    for tweet in sntwitter.TwitterSearchScraper("sport").get_items():
    if len(tweets_list)==limit:
    break
    else:
    tweets_list.append([tweet.date, tweet.content, tweet.user.username, tweet.user.displayname, tweet.user.description,
    tweet.replyCount, tweet.retweetCount, tweet.likeCount, tweet.lang, tweet.source])
    df = pd.DataFrame(tweets_list, columns=['date','tweet','username''displayname','description','replaycount','retweet','likecount',
    'language','source'])
    print(df)


    Code

    Continue reading...

Compartilhe esta Página