Skip to content

Instantly share code, notes, and snippets.

@moskomule
Created February 22, 2017 05:59
Show Gist options
  • Save moskomule/cab1e0212f18ff2a8b1e2c20e0718f4c to your computer and use it in GitHub Desktop.
Save moskomule/cab1e0212f18ff2a8b1e2c20e0718f4c to your computer and use it in GitHub Desktop.
scrape and save urls in tweets of a specified user
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