Skip to content

Instantly share code, notes, and snippets.

@SemanticallyNull
Last active August 29, 2015 14:24
Show Gist options
  • Save SemanticallyNull/7d48552e5f9b865e6a31 to your computer and use it in GitHub Desktop.
Save SemanticallyNull/7d48552e5f9b865e6a31 to your computer and use it in GitHub Desktop.
This will dig out the first tweet in the chain.
# coding=utf-8
import tweepy
# == OAuth Authentication ==
#
# This mode of authentication is the new preferred way
# of authenticating with Twitter.
# The consumer keys can be found on your application's Details
# page located at https://dev.twitter.com/apps (under "OAuth settings")
consumer_key=""
consumer_secret=""
# The access tokens can be found on your applications's Details
# page located at https://dev.twitter.com/apps (located
# under "Your access token")
access_token=""
access_token_secret=""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.secure = True
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
# Put in your status ID here
status_id = ''
i = 1
while status_id:
status = api.get_status(status_id)
print "%d) @%s: %s" % (i, status.user.screen_name, status.text)
if hasattr(status, 'quoted_status_id_str'):
status_id = status.quoted_status_id_str
i += 1
else:
status_id = False
print "%d tweets deep by @%s: %s" % (i, status.user.screen_name, status.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment