Find trending Tweepy tweets for a specific keyword

Woe to me, since I'm still learning Python ..

I want to see the most trash tweets for a specific hashtag. I can find trending tweets, and I can find tweets with a specific hashtag, but I find it difficult to try to combine these two.

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').items(5000)

for tweet in search_hashtag:
    print json.dumps(tweet)

print json.dumps(trends, indent=1)

This is what I am working on right now.

Thank!

+4
source share
1 answer

From: https://dev.twitter.com/rest/public/search

, , , Twitter, Twitter.com. API Twitter , 7 .

, . /.

https://dev.twitter.com/rest/reference/get/trends/place , , , , tr

+1

Source: https://habr.com/ru/post/1671265/


All Articles