Created
November 20, 2019 14:17
-
-
Save milindjagre/05a29d24281b840d243e63b35f4d282a to your computer and use it in GitHub Desktop.
Mustang Mach-E tweets extraction using Python
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 | |
import csv | |
import pandas as pd | |
consumer_key = '****' | |
consumer_secret = '****' | |
access_token = '****' | |
access_token_secret = '****' | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth,wait_on_rate_limit=True) | |
csvFile = open('MustangMachE_Tweets.csv', 'a') | |
csvWriter = csv.writer(csvFile) | |
for tweet in tweepy.Cursor(api.search,q="#MustangMachE",count=100, | |
lang="en", | |
since="2019-11-10").items(): | |
print (tweet.created_at, tweet.text) | |
csvWriter.writerow([tweet.created_at, tweet.text.encode('utf-8')]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment