Search code examples
javapythonpython-2.7twittertwitter4j

How to automatically retweet a twitter page?


How to automate the task of retweetsof a page: twitter.com/promotional/sample_page in such a way that whenever there is tweet posted on twitter from that page then the automated script retweeted from my twitter account twitter.com/demo-account/ . Can it be implemented using python or java? Following the attached link:

http://www.techcovered.org/how-to-create-your-own-twitter-auto-retweet-bot/


Solution

  • You can easily do this in python using TwitterAPI.

    The steps are basically:

    1. Authenticate

    from TwitterAPI import TwitterAPI api = TwitterAPI(consumer_key, consumer_secret, access_token_key, access_token_secret)

    1. Grab the tweet you want to retweet
    2. Tweet it

    x = api.request('statuses/update', {'status': the tweets text})

    print(x.status_code)

    It is quite straight forward, I won't spoil it for you posting the full working code.