Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import tweepy
from google.colab import drive
import json
from datetime import date
from datetime import datetime
import time
drive.mount('/content/gdrive')
path= './gdrive/My Drive/CSE5095'
#Twitter Authentication
auth = tweepy.OAuthHandler("hpXTmspBRz3OuVMJJY6YX5J4Z","8N13LuXiESJfnFQ0luQceimp7mbmYmnkyup8qzOQjzfTpLKesW")
auth.set_access_token("1308844071159439360-sykzN0HkNytBUL1ZxmCXtO8Dkh3KNr","RKrc7yygx1P8CZF2fECRMAVUWAJdmllAvBqPXwNrHepYy")
api = tweepy.API(auth, wait_on_rate_limit=True)
#name and tweet id for specific tweet
name = 'FootyAccums'
tweet_id = '1316662005323960320'
data=[]
for full_tweets in tweepy.Cursor(api.user_timeline,screen_name=name,timeout=999999).items(10):
for tweet in tweepy.Cursor(api.search,'to:{} filter:replies'.format(name),result_type='recent',timeout=999999, lang='en', tweet_mode='extended').items(1000):
tweet_details = {}
tweet_details['name'] = tweet.user.screen_name
tweet_details['tweet'] = tweet.full_text
tweet_details['retweets'] = tweet.retweet_count
tweet_details['location'] = tweet.user.location
tweet_details['created'] = tweet.created_at.strftime("%d-%b-%Y")
tweet_details['followers'] = tweet.user.followers_count
tweet_details['is_user_verified'] = tweet.user.verified
if hasattr(tweet, 'in_reply_to_status_id_str'):
if (tweet.in_reply_to_status_id_str==tweet_id):
data.append(tweet_details)
with open("data.json", 'w') as outfile:
json.dump(data, outfile)