Last active
February 20, 2019 18:52
-
-
Save neelindresh/73cdd149fa2daca6bde80e5a083de030 to your computer and use it in GitHub Desktop.
Getting Twitter Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy | |
from tweepy import Cursor,API | |
from tweepy.streaming import StreamListener | |
from tweepy import OAuthHandler,Stream | |
import Credential | |
auth=OAuthHandler(Credential.CUSTOMER_KEY,Credential.CUSTOMER_SECRECT_KEY) | |
auth.set_access_token(Credential.ACCESS_TOKEN,Credential.ACCESS_SECRECT_TOKEN) | |
api=API(auth,wait_on_rate_limit=True) | |
for tweet in tweepy.Cursor(api.search,q="PulwamaAttack",lang='en',count=100,since='2019-02-14',tweet_mode="extended").items(): | |
date=tweet._json['created_at'] | |
print(date) | |
with open('tweetCur.json','ab') as file: | |
file.write(str(str(tweet._json)+'\n').encode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment