Skip to content

Instantly share code, notes, and snippets.

@milindjagre
Created November 20, 2019 14:17
Show Gist options
  • Save milindjagre/05a29d24281b840d243e63b35f4d282a to your computer and use it in GitHub Desktop.
Save milindjagre/05a29d24281b840d243e63b35f4d282a to your computer and use it in GitHub Desktop.
Mustang Mach-E tweets extraction using Python
Display the source blob
Display the rendered blob
Raw
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