User Analysis of TwitterWith Python, we can mine Twitter for a given user [Twitter topic search][Reddit Top Posts][Reddit with search for keyword]. |
Theory
Within the Twitter API was can search for username:
import tweepy import sys consumer_key = '' consumer_secret = '' access_key= '' access_secret = '' auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_key, access_secret) api_obj = tweepy.API(auth) def get_user_tweets(username,count): tweets = api_obj.user_timeline(screen_name=username,count=count) res=[] tweets_for_csv = [tweet.text for tweet in tweets] for j in tweets_for_csv: res.append(j) return(res) user="billatnapier" if (len(sys.argv)>1): user=str(sys.argv[1]) rtn=get_user_tweets(user,5) for s in rtn: print (s.encode('utf-8')) print ()
A sample run is:
["When your CSS doesn't quite work right ... , 'The latest The Cyber Security Daily! https://t.co/Am2RpAywRg #cybersecurity #ai', 'Is it me, or does this connect have a face? https://t.co/tfUXKo7ol0', 'OPAQUE Asymmetric PAKE Protocol https://t.co/90n7IBW5X0 via @YouTube', 'Will OPAQUE fix the one-way authentication problem of TLS and remove us from the problems of PKI?… https://t.co/XLUaPju2vK']