def get_user_tweets(self,hashtaglist): ext= Extractor() auth = ext.loadtokens() api = ext.connectToAPI(auth) for ht in hashtaglist: full_tweets = ext.gettweets_hashtag(ht,api) ext.printcsv(full_tweets,ht)
temp.append(t[7]) top_RT.append(t) tweets.sort(key=lambda x:int(x[3]), reverse=True) ##Create list of most followed users## for t in tweets: if (t[0] not in temp2) and (len(most_followed) < 200): temp2.append(t[0]) most_followed.append([t[0], t[3]]) ext= Extractor() auth = ext.loadtokens() api = ext.connectToAPI(auth) id_list=[] print ("Getting ID of most retweeted tweets...") ## Get the ID of the most retweeted tweets and put them in a list## ## If tweet starts with 'RT', meaning it is a retweet, then get the ID of the original tweet ## for t in top_RT: if (t[7].startswith('RT')) or (t[7].startswith('"RT')): tweet=api.get_status(id=int(t[1])) #dumps serialises strings into JSON (which is very similar to python's dict) json_str= json.dumps(tweet._json)