Last active
April 19, 2022 02:58
-
-
Save HackingGate/c5ec3a5e6bbd70ceb068a44e73330eff to your computer and use it in GitHub Desktop.
Have I retweeted or liked a tweet? Check tweet status by ids.
This file contains 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
#!/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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Example