Python 有了tweepy,你怎么能在推特上获得收藏和转发?

Python 有了tweepy,你怎么能在推特上获得收藏和转发?,python,twitter,tweepy,Python,Twitter,Tweepy,我写了这段代码,只看最近10条关于某个查询的tweet。我想以某种方式得到它的最爱和转发的数量 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(acce

我写了这段代码,只看最近10条关于某个查询的tweet。我想以某种方式得到它的最爱和转发的数量

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

tweet.favorite\u count
tweet.retweet\u count
是您要查找的内容。

如果您想知道如何找出哪些特定用户喜欢或发送了tweet…您不能。公共API不支持这一点。直到现在我才注意到用户可能想要获得所有的RTs,包括RTs的数量,谢谢你完成我的回答!