Processing
 

Tweepy - Getting the author of a retweeted tweet

26/08/2016 16:59#1

Ben Parry

Member

Joined at: 5 months ago

Post: 1

Thank: 0

Thanked: 0

I'm using Tweepy to create a giveaway bot on Twitter, which basically likes, retweets and follows tweets with the tag "giveaway" in the given tweet. It's nearly to the point where I'm completely happy with it, however I am not sure how to solve the issue I'm currently having.

import tweepy, time, sys, random #Required Imports import requests.packages.urllib3 import datetime as dt requests.packages.urllib3.disable_warnings()   CONSUMER_KEY = 'mine' CONSUMER_SECRET = 'mine' ACCESS_KEY = 'mine' ACCESS_SECRET = 'mine'  auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) myUser = api.get_user(screen_name = '@iBPBot') count = 0 loopCount = 0  while(loopCount <14):     for tweet in tweepy.Cursor(api.search,q='giveaway').items(14): #Searches for the query term         try:             if(tweet.user.id == myUser.id): #If my username is a tweet, ignore it                continue             if(tweet.favorited == False) or (tweet.retweeted == False) or (tweet.user.following == False):                 tweet.favorite() #Favourites the tweet                 tweet.retweet() #Retweets the tweet                 tweet.user.follow() #Follows the user                 count+=1                 loopCount+=1          except tweepy.TweepError as e:             print(e)             continue         except StopIteration:             break #Error Handling      currentTime = dt.datetime.now()     futureTime = currentTime + dt.timedelta(minutes = 15)         print("\nCurrent Time: %s \nProcess Restarts: %s" % (currentTime.time(), futureTime.time()))     print("\nCurrent Number Of Tweets Engaged With: %s" % (count))     loopCount = 0     time.sleep(900) 

Does anyone know how to make it so it grabs the original authors username and follows them, instead of the person who retweeted the original tweet? Many thanks.

Similar articles

How do twitter giveaways work?

9 months ago - Reply: 2 - Views: 130

How may I get genuine followers on Twitter?

3 years ago - Reply: 33 - Views: 1,832

Login to Twitter sometime fail

7 months ago - Reply: 1 - Views: 27

Twitter doesn't accept PHP's cURL, but Linux'

1 year ago - Reply: 2 - Views: 92

Twitter OAuth on iOS

6 months ago - Reply: 1 - Views: 96

why am i getting an error on .verifyCredentials()

6 months ago - Reply: 1 - Views: 37

TwitteR setup_twitter_oauth() gives an error

6 months ago - Reply: 1 - Views: 31

Tweepy - Getting the author of a retweeted tweet

6 months ago - Reply: 0 - Views: 7

Retrieving data from twitter with JavaScript

6 months ago - Reply: 0 - Views: 4

Combined social media feed returning the wrong data

6 months ago - Reply: 0 - Views: 3

Django and Twitter request_token

6 months ago - Reply: 0 - Views: 3

Python HMAC hashed value encoding to base64

6 months ago - Reply: 1 - Views: 35

At the rate symbol in facebook

6 months ago - Reply: 0 - Views: 3

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re