我编写的这段代码只是查看最近10条关于某个查询的推文。我想以某种方式获得收藏和转发的数量。
import tweepy
import time
import sys
consumer_key='…'
consumer_secret='…'
access_token='…'
access_token_secret='…'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
query="query"
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd)
new_tweets = api.search(q=query,count=1)
for tweet in new_tweets:
# Get favorites and retweets here
WOM=new_tweets[0].created_at-new_tweets[len(new_tweets)-1].created_at
答案 0 :(得分:3)
tweet.favorite_count
和tweet.retweet_count
就是你要找的。 p>