Giter VIP home page Giter VIP logo

twitter-giveaways-bot's Introduction

Twitter Giveaways Bot

A bot that will constantly look for new giveaways and contests on Twitter; and enter to all of them! It will do whatever it's needed, either retweeting or liking something, or even following and DMing someone :D

Limits are pretty high; the bot can enter to more than 1000 giveaways per day, so it's likely that you'll win several giveaways :)

What's new? 😃

  • Added ban keyword list (ignore tweets that contain certain keywords)
  • Don't retweet tweets that have a few numbers of retweets (to avoid retweeting fake giveaways)
  • Don't retweet old tweets (you can set the bot to ignore tweets that're older than 30 days for example)

Getting Started

These instructions will get your bot started in minutes.

Prerequisites

Things you need to have installed in order to be able to run the script.

Python 3.5
python-twitter

Installing

First of all, if you don't already have Python in your system, download and install it now. Once that's done, for the script to be able to work with Twitter you'll need to install its API

pip install python-twitter

You should also download both scripts: main.py and config.py. Preferably, put them in the same folder.

Once there, open the config.py file with a text editor; don't run it! This file has all the variables the main script will use. Give each one of them the values you want, or just leave them by default.

However, you do need to change the first variable: twitter_credentials. As it contains all the credentials related to the Twitter API; they can't stay blank (what's by default) if you want the bot to connect to Twitter.

Twitter App

This is meant to be a short guide on how to get the twitter credentials your bot will need. Here I assume you already have Twitter account, if you don't please make one now.

Steps:
  • Enter to Twitter Apps and click the Create New App button
  • Fill out all details and create the app
  • Enter to the Keys and Access Token section and create a new access token.
  • Now copy Consumer Key, Consumer Secret, Access Token, Access Token Secret and paste them into their right place inside the config.py's twitter_credentials variable.

If you've followed the steps correctly, now to start the bot you just need to run the main.py script. Experiment with the variables at your own risk.

How it works

As soon as the script starts, the bot authenticates to Twitter and searches for tweets with the tags given in the search_tags variable. It stores them in a list so then in can iterate through each one of them, and checks if they contain any retweet_tags; it would be very weird not having to retweet anything, that usually means you have to open a link to enter, thus it isn't a Twitter giveaway anymore and we skip the whole tweet.

If it does contain a retweet_tag, the bot retweets it and proceeds to check if it has any

  • message_tag
  • follow_tag
  • like_tag

If the bot finds them in the tweet's text, it'll do its right action. You can find more info in config.py.

Once the bot is done with analyzing tweet and entering to the giveaway, it will sleep for the seconds defined in the retweet_rate variable; this is what will avoid the bot getting banned, or what will get the bot banned. After the bot has checked all tweets in the list, the script sleeps for the value defined in search_rate and the loop stars again.

To check the limits Twitter sets please refer to Twitter's Rate Limits and Twitter’s Account Limits.

The bot prints everything into the console with colors and all, so it's easy to see what's going on. And all files are well commented

Disclaimer

This is entirely for educational purpose. Use at your own risk and responsibility, there's a possibility that your Twitter account gets banned. I hold no liability for what you use the bot for or the consequences.

Authors

  • Diego Estevez - Please check out my blog, you'll love my other projects!

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Troubleshooting

Rate limit exceeded => All info here

Acknowledgments

twitter-giveaways-bot's People

Contributors

disestevez avatar itsomarkhater avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitter-giveaways-bot's Issues

Does the bot comment automatically?

Thank you so much for your work. In most giveaways it is asked to comment and retweet. I couldn't find anything about commenting under a post! Does the bot do that?

Grammar Issues in Readme.md

I found some grammar issues in the readme.md, I would fix them, so the readme is more fluent 👍

Section Installing

    Twitter App 
       "Here I assume you already have Twitter account, if you don't please make one now."
       "Here I assume you already have a Twitter account, if you don't, please, make one now."

Section Steps

    Step 2 : Enter to the Keys and Access Token section and create a new access token.
       Enter )"to" --> remove) the Keys and Access Token section and create a new access token.

Section How it works

The second sentence is very long. To improve readability, consider breaking this into multiple sentences.

    "It stores them in a list so then in can iterate through each one of them, and checks if they contain any retweet_tags; it would be very weird not having to retweet anything, that usually means you have to open a link to enter, thus it isn't a Twitter giveaway anymore and we skip the whole tweet."

Section Disclaimer

"Use at your own risk and responsibility, there's a possibility that your Twitter account gets banned"
Comma Splice next to responsability. You have 3 choices, :

  • ; there's

  • , and there's

  • . There's

      Use at your own risk and responsibility ;  there's a possibility that your Twitter account gets banned
    

Section Acknowledgments

I would put commas between "Hunter Scott"

    Thank you, Hunter Scott. for your inspiration!

I found some more erros, but I think they are not particulary neccesary to be changed.

Not working for me.

Hi there,

I followed the steps exactly and this message keeps coming up in pycharm dashboard when I try to run main.py

Traceback (most recent call last):
File "C:\Users\Kristian\Desktop\python stuff\Twitter-Giveaways-Bot-edeb1591bf4e29fb423e2b33c4a1e5c462dc024f\Twitter-Giveaways-Bot-edeb1591bf4e29fb423e2b33c4a1e5c462dc024f\main.py", line 2, in
import twitter
File "C:\Users\Kristian\Desktop\python stuff\Twitter-Giveaways-Bot-edeb1591bf4e29fb423e2b33c4a1e5c462dc024f\Twitter-Giveaways-Bot-edeb1591bf4e29fb423e2b33c4a1e5c462dc024f\twitter_init_.py", line 56, in
from .api import Api # noqa
File "C:\Users\Kristian\Desktop\python stuff\Twitter-Giveaways-Bot-edeb1591bf4e29fb423e2b33c4a1e5c462dc024f\Twitter-Giveaways-Bot-edeb1591bf4e29fb423e2b33c4a1e5c462dc024f\twitter\api.py", line 5093
raise TwitterError({'message': 'Unknown error': '{0}'.format(json_data)})
^
SyntaxError: invalid syntax

Any help would be great!

Kind Regards,

Kristian

time error ?

Remember you can change the settings in config.py!
Friends retrieved successfully!

Started Analyzing (13:9:39)
'str' object has no attribute 'created_at'

what should I do ?

Fortnite Giveaway

Hey there

How do I set it up for Fortnite Giveaways?
Can you maybe make an .exe file or something so it's easier to use?

AttributeError: module 'twitter' has no attribute 'Api'

Remember you can change the settings in config.py!
Traceback (most recent call last):
File "C:/Users/Nick Grichine/AppData/Local/Temp/Temp1_Twitter-Giveaways-Bot-master.zip/Twitter-Giveaways-Bot-master/main.py", line 20, in
twitter_api = twitter.Api(consumer_key=config.twitter_credentials["Sw3rdzhifEUBa4GbjDRWlP6TE"],
AttributeError: module 'twitter' has no attribute 'Api'

Can you add a ban keyword option ?

Hello, i love this progam, he work perfectly bu i think you miss 1 option: a ban keyword option. Its could be great because I don't like that my bot RT and follow giveway of nude pics...
You can also add a minimum RT count before RT a giveway, that could be great improve
If you have time to do that, it will be awesome !
Thanks for your good work, bye :)

No module named 'twitter'

I followed the instructions and installed python-twitter, but when I run main.py the terminal states that there is no module named twitter. I saw a similar issue stated previously that was resolved using pip3 install python-twitter, but when I try that I get the same outcome.

u Rate limit exceeded u code 88 -Issue

Hi,
i use your bot now for 2 weeks and it is the best i ever used.
sadly since 3 days i allways get this error:
i tryed changing my Tokens created a new app and tryed to do some other things
it never worked again. by now i follow 3.000 accounts and i have 1.000 followers so it shouldnt be a problem.

sorry for my fucked up typing but i do that from an PI with the cheapes keyboard i could found.. was definitly not the best investment

sudo python main.py
Remember you can change the settings in config.py!
[{u'message': u'Rate limit exceeded', u'code': 88}]
Couldn't retrieve friends. The bot won't unfollow someone random when we start following someone else. So your account might reach the limit (following 2000 users)

Started Analyzing (15:21:15)
Retweeted 819951397596696576
Retweeted 855081198347059202
Followed: @HughesDirect
Followed: @BoschHomeUK
empty range for randrange() (0,0, 0)
""goes on with Empy range for a long time than

Ignore adult tweets [Solved]!

It works perfectly!

I'd really appreciate it if you could add a function that skips inappropriate tweets, like those include "nudes", "sex" etc.
Because the bot keeps retweeting those kinds of tweets.
Thanks a lot for your great work!

Update:
I did it myself! it turned out to be pretty easy :)

  1. in main.py scroll down to find this line for tweet in searched_tweets:
    and just paste this line below it: if not any(y in tweet.text.lower().split() for y in config.skip_retweet_tags):
    make sure to add indentation before and after the above line.

  2. in config.py
    before the retweet_tags list
    add this list skip_retweet_tags = ["nude", "nudes" ,"tits" ,"booty" ,"boobs", "cum"] you can add any more words you want the bot to ignore.

Attribute Error

Hey! This is my first time working with python, and Im a bit lost. I copied your entire code, and changed what I needed to, as directed. As I went to run it, I was met with the following error:

Traceback (most recent call last):
File "main.py", line 8, in
class colors:
File "main.py", line 9, in colors
HEADER = '\033[95m' if config.print_in_color else ""
AttributeError: module 'config' has no attribute 'print_in_color'

Anyone able to help?

Getting Error when running Main.py

I have installed the required dependencies using pip install python-twitter, but when I run main.py I get the following error.
Traceback (most recent call last): File "main.py", line 4 in <module> import twitter ModuleNotFoundError: No Module names 'twitter'

Any advice would be appreciated.

How i solve this?

Traceback (most recent call last):
File "c:\Users\Kevin\Downloads\Twitter-Giveaways-Bot-master\Twitter-Giveaways-Bot-master\https://t.co/WUY3kY0BKX", line 20, in
twitter_api = twitter.Api(consumer_key=config.twitter_credentials["yJnrj6kl9WwSKdK9XWlC1wtUv"],
KeyError: 'yJnrj6kl9WwSKdK9XWlC1wtUv'
PS C:\Users\Kevin>

I get this error when I try to run main.py

D:\Python\Scripts>main.py
Remember you can change the settings in config.py!
Traceback (most recent call last):
File "D:\Python\Scripts\main.py", line 19, in
twitter_api = twitter.Api(consumer_key=config.twitter_credentials["consumer_key"],
AttributeError: module 'twitter' has no attribute 'Api'

D:\Python\Scripts>main.py
Remember you can change the settings in config.py!
Traceback (most recent call last):
File "D:\Python\Scripts\main.py", line 19, in
twitter_api = twitter.Api(consumer_key=config.twitter_credentials["consumer_key"],
AttributeError: module 'twitter' has no attribute 'Api'

D:\Python\Scripts>

pip install python-twitter error

Having a error while trying to install pip install python-twitter
It says: "ERROR: Could not install packages due to an OSError: Could not find a suitable TLS CA certificate bundle, invalid path:"

"WARNING: There was an error checking the latest version of pip."

How can I solve this problem?

no module named twitter

Sorry for reporting an already solved issue but i'm really dumb and I can't run it in a virtual environment because i don't know how to. I may have already did it but the bot doesn't do its job (I already checked the credentials). Please someone tell me how to run this script in a virtual environment. (I,m using a mac btw)
Thank you for helping me

Better Search Keywords

Can't we use twitter advanced search operators to make the search better.
it now collects many tweets that are not needed, and because of the searching tags one can not do change from only the config.

it would be better if the AND OR searching operators can be used in the config

Misleading guide

So when I clicked the link and clicked "Create an App" it made me apply for some developer-program so I just filled it out but now there is no way to make an app, not even clicking the link takes me to the place it used to, it takes me to https://developer.twitter.com/en/portal/projects-and-apps
After just looking around I found accesstoken and accesssecret but no consumerkeys and secrets so I just copy-pasted those two and running main doesn't seem to work when I check my profile. So yeah please update the tutorial and another feature could be comments, NVIDIA wants you to comment #RTX4060 on their giveaways for example.

Unfollowing

Hi,

Why does the bot unfollow some users?

Search for general words instead of tags

Hello lovely team,
Lately i see a lot of contests like @GA_Contest that does giveaways without tags. Can we change the code to also define words without the # to search?
Thanks

You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal.

Hi, it says:
Traceback (most recent call last):
File "main.py", line 25, in
screen_name = twitter_api.VerifyCredentials().screen_name
File "/home/pi/.local/lib/python3.7/site-packages/twitter/api.py", line 4700, in VerifyCredentials
data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
File "/home/pi/.local/lib/python3.7/site-packages/twitter/api.py", line 4908, in _ParseAndCheckTwitter
self._CheckForTwitterError(data)
File "/home/pi/.local/lib/python3.7/site-packages/twitter/api.py", line 4928, in _CheckForTwitterError
raise TwitterError(data['errors'])
twitter.error.TwitterError: [{'message': 'You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve', 'code': 453}]

Is there any way to go around this issue without applying for elevated access? If there is no way, what do you have to say in the application of "How will you use the Twitter API or Twitter Data?", that will get approved, because I don't think saying that its for a giveaway bot will get it approved.

Thanks

Don't follow always all people quoted

Hello , this bot is pretty incredible (like its the best bot twitter i have seen for a long time) but there is a little problem , sometimes , the bot don't follow people quoted in the tweet.
I don't know if you will see this but if you know how fix this , it will be cool.
Thanks for this work and see ya !

problem

this line has problem:
twitter_api = twitter.Api(consumer_key=config.twitter_credentials["consumer_key"],

main.py

I have followed the read me all the way to the end with entering the credentials in the twitter key section and I tried to run main.py and it just shuts instantly. What did I do wrong?
I have tried double clicking the script and it just closes. Is there any special way I need to open it or have I done something wrong?

can you add the option to auto coment/reply

just as title says an option to reply the tweet for example some giveaways ask to reply done or to tag friends with that option we can do that required step and auto reply with tagged friends.

and just a little question: can we use the bot on essential? when i try execute the main.py it says i need elevated on developer portal y send the form to get that access but idk if i can get or maybe ill be rejected. thanks for reading and keep that good work on this bot ;)

giveaway bot wont start in linux

Hi is there any way you could do a video or something on a tutorial as I have followed the steps but errors keep occurring thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.