Created
February 22, 2017 05:59
-
-
Save moskomule/cab1e0212f18ff2a8b1e2c20e0718f4c to your computer and use it in GitHub Desktop.
scrape and save urls in tweets of a specified user
This file contains hidden or 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 time | |
api = tweepy.API(auth) | |
with open("log.txt", 'w') as f: | |
for i in range(1,100): | |
users_tweets = api.user_timeline(id=user,page=i,include_entities=True,count=100) | |
for tweet in users_tweets: | |
f.write(tweet.entities['urls'][0]["expanded_url"] + "\n") | |
time.sleep(30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment