If I understand correctly when you say "I want to be able to see the most trending tweets for a specific hashtag." you mean that you want the tweets that have certain hashtags that are the most trendy (popular).
Well, thinking about it I came across with an idea. You could use the hastag as a query, and then search among the tweets collected which ones have the higest number of retweets.
The code may look something like this:
import tweepy
CONSUMER_KEY = 'key'
CONSUMER_SECRET = 'secret'
OAUTH_TOKEN = 'key'
OAUTH_TOKEN_SECRET = 'secret'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
api = tweepy.API(auth)
trends = api.trends_place(1)
search_hashtag = tweepy.Cursor(api.search, q='hashtag', tweet_mode = "extended").items(5000)
for tweet in search_hashtag:
if 'retweeted_status' in tweet._json:
full_text = tweet._json['retweeted_status']['full_text']
else:
full_text = tweet.full_text
tweets_list.append([tweet.user.screen_name,
tweet.id,
tweet.retweet_count, # What you are interested of
tweet.favorite_count, # Maybe it is helpfull too
full_text,
tweet.created_at,
tweet.entities
])
tweets_df = pd.DataFrame(tweets_list, columns = ["screen_name", "tweet_id",
"nº rt",
"nº replies",
"text",
"created_at",
"entities"])
# In a data frame format you can sort the tweets by the nº of rt and get the top one
tweets_df.to_json()
As you can see I have used tweet_mode = "extended"
becuase probably you are interested in the whole text (by default Twitter API trunctate the text). Moreover, you would like to use the number of replies combined with the number of retweet of a tweet to get the most trendy.
Hope you find it useful!
Happy coding!!!