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

时间:2017-07-15 01:30:26

标签: python twitter tweepy

我编写的这段代码只是查看最近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

1 个答案:

答案 0 :(得分:3)

tweet.favorite_counttweet.retweet_count就是你要找的。