Вопрос

Hi maybe I'm missing something really obvious but I've been using tweepy to collect tweets from a keyword.

I cannot understand, and have been searching for most of the day, how to access details about the tweets that I have, for instance their retweet count or favorite count. This using the tweet ' s id number.

Any help to a to do this would be very helpful.

Это было полезно?

Решение 2

import tweepy


consumer_key=""
consumer_secret=""
access_key = ""
access_secret = "" 


auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)

id_list = ['tweetidexample', 'tweetidexample',"....etc" ]

def get_retweet_count(tweet_id):
    tweet = api.get_status(tweet_id)
    return tweet.retweet_count

for id in id_list:
   print get_retweet_count(id), id

This enables retweet count from ID at least.

Другие советы

You can use the statuses/show endpoint (usable in Tweepy through api.get_status. Unfortunately, any data not provided by the endpoint can only be accessed by scraping the website - there's no way to have Twitter send more data.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top