Skip to content

Instantly share code, notes, and snippets.

@thiagogds
Last active June 30, 2016 18:30
Show Gist options
  • Select an option

  • Save thiagogds/3d546ef9f531ca489ab9a8e0440154aa to your computer and use it in GitHub Desktop.

Select an option

Save thiagogds/3d546ef9f531ca489ab9a8e0440154aa to your computer and use it in GitHub Desktop.
twitter = Twython(
'key',
'secret',
"access_token",
"secret_token"
)
screen_name = 'some_name'
tweets = twitter.get_user_timeline(screen_name=screen_name, count=200)
next_tweets = twitter.get_user_timeline(screen_name=screen_name, count=200, max_id=tweets[-1]['id'])
total = tweets + next_tweets
while next_tweets[-1]['id'] != tweets[-1]['id']:
tweets = twitter.get_user_timeline(screen_name=screen_name, count=200, max_id=next_tweets[-1]['id'])
next_tweets = twitter.get_user_timeline(screen_name=screen_name, count=200, max_id=tweets[-1]['id'])
total += tweets + next_tweets
return filter(lambda x: x['text'][0] != u"@", total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment