python - Crawl tweets with URL inside it and perform sentiment analysis for these tweets -
how can in python crawl tweets tweets contain specific url inside it. example:
https://wikileaks.org/wikileaks-offers-award-for-labourleaks.html
import tweepy import csv import pandas pd import text 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) # open/create file append data csvfile = open('ua.csv', 'a') #use csv writer csvwriter = csv.writer(csvfile) tweet in tweepy.cursor(api.search,q="https://wikileaks.org/wikileaks-offers-award-for-labourleaks.html",count=100, lang="en", since="2017-04-03").items(): print (tweet.created_at, tweet.text) csvwriter.writerow([tweet.created_at, tweet.text.encode('utf-8')])
above see have tried.
Comments
Post a Comment