Skip to content

Instantly share code, notes, and snippets.

@HackingGate
Last active April 19, 2022 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HackingGate/c5ec3a5e6bbd70ceb068a44e73330eff to your computer and use it in GitHub Desktop.
Save HackingGate/c5ec3a5e6bbd70ceb068a44e73330eff to your computer and use it in GitHub Desktop.
Have I retweeted or liked a tweet? Check tweet status by ids.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy, sys
#enter the corresponding information from your Twitter application:
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_KEY = ''
ACCESS_SECRET = ''
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
tweets = api.lookup_statuses(sys.argv)
for tweet in tweets:
#tweet obtained
print('Tweet ID: ' + tweet.id_str)
print('Is retweeted: ' + str(tweet.retweeted))
print('Retweet count: ' + str(tweet.retweet_count))
print('Is favorited: ' + str(tweet.favorited))
print('Favorite count: ' + str(tweet.favorite_count))
@HackingGate
Copy link
Author

HackingGate commented Nov 24, 2018

Usage

python tweet_lookup_statuses.py id1 id2 id3...

Example

python3 tweet_lookup_statuses.py 1065406263612399617

2018-11-24 15 48 54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment