Code Monkey home page Code Monkey logo

twitter-contest-bot's Introduction

twitter-contest-bot

Will poll for Retweet Contests and retweet them. Inspired by http://www.hscott.net/twitter-contest-winning-as-a-service/

Build Status

Donate

If you're feeling kind, feel free to throw some cash my way for a beer!

Disclaimer

This bot is written purely for educational purposes. I hold no liability for what you do with this bot or what happens to you by using this bot. Abusing this bot can get you banned from Twitter, so make sure to read up on proper usage of the Twitter API.

License

You can fork this repository on GitHub as long as it links back to this original repository. Do not sell this script as I would like the code to remain free.

Prerequisites

  • TwitterAPI
  • Python 2.7

Python 2.7: https://www.python.org/download/releases/2.7/ For information on how to install python: https://www.howtogeek.com/197947/how-to-install-python-on-windows/

Configuration

Open up config.json and make the values correspond to your Twitter API credentials.

Change your Twitter Account settings to allow dm's from anybody.

Installation

1: Find and Open up Command Prompt

2: In Command Prompt Run: pip install TwitterAPI

Errors: Search Google. Typically it's about python not being installed correctly.

3: Using Notepad (recommended) or your preferred editor open config.json. Fill in with your credentials. For information on how to get Twitter Creds: http://docs.inboundnow.com/guide/create-twitter-application/

4: Then run main.py. (Double click on file or main.py in command prompt)

Alternatives

If you're looking for similar projects in alternative languages, check these out:

Useful Links:

https://steemit.com/twitter/@yoghurt/my-experiences-running-a-twitter-giveaway-bot

https://rpiai.com/retweeting-to-win/

https://steemit.com/programming/@kurozael/twitter-contest-bot

https://www.vox.com/2015/10/5/9409017/hack-online-contest-win

***Depending on how lucky you get you typically win around 0.1% of all contests entered***

twitter-contest-bot's People

Contributors

kurozael 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitter-contest-bot's Issues

Problem with favoriting

When the script gets to a tweet that asks for a favorite, such as this one, it throws this error:

File "main.py", line 93, in CheckForFavoriteRequest
    LogAndPrint("Favorite: " + item['id'])
TypeError: cannot concatenate 'str' and 'int' objects

Then it gets stuck into a loop where it retweets the same tweet over and over again until I kill it myself. I have no idea how to python so I can't fix it myself.

ImportError: cannot import name ReadTimeout

Bit of a newb when it comes to Python and can't seem to fix the following error.

Any ideas why I'm unable to run python main.py?

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    from TwitterAPI import TwitterAPI
  File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/TwitterAPI.py", line 9, in <module>
    from requests.exceptions import ConnectionError, ReadTimeout, SSLError
ImportError: cannot import name ReadTimeout

SNIMissingWarning Urllib3 error

Getting the following error about TLS profiles with urlb3. Any fixes?

/usr/local/bin/twitter-contest-bot/venv/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/bin/twitter-contest-bot/venv/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "main.py", line 242, in <module>
    CheckRateLimit()
  File "main.py", line 70, in CheckRateLimit
    for res_family in r['resources']:
KeyError: 'resources'

Getting Error while executing the code -

Message File Name Line Position
Traceback
C:\Python27\twitter-contest-bot-master\twitter-contest-bot-master\main.py 242
ScanForContests C:\Python27\twitter-contest-bot-master\twitter-contest-bot-master\main.py 235
TypeError: cannot concatenate 'str' and 'exceptions.UnboundLocalError' objects

image

Please guide

KeyError: 'resources'

I am running Pyhton 3.4 and getting the following error:

2015-12-12 13:01:19,924 - INFO - [2015-12-12 13:01:19.924021] - added last task at 2015-12-13 10:53:50.751188
Traceback (most recent call last):
  File "/home/ubuntu/workspace/main.py", line 435, in <module>
    CheckRateLimit()
  File "/home/ubuntu/workspace/main.py", line 182, in CheckRateLimit
    for res_family in r['resources']:
KeyError: 'resources'

It adds task and then at the last task it fails.

Remaining on line 73

Traceback (most recent call last):
File "/Users/admin/Desktop/twitter-contest-bot-master/main.py", line 240, in
CheckRateLimit()
File "/Users/admin/Desktop/twitter-contest-bot-master/main.py", line 73, in CheckRateLimit
percent = float(remaining)/float(limit)*100
NameError: global name 'remaining' is not defined

Exception in thread Thread-1:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 1073, in run
self.function(_self.args, *_self.kwargs)
File "/Users/admin/Desktop/twitter-contest-bot-master/main.py", line 73, in CheckRateLimit
percent = float(remaining)/float(limit)*100
NameError: global name 'remaining' is not defined

Any ideas?

Issue

=== SCANNING FOR NEW CONTESTS ===
Getting new results for: RT to win
Could not connect to TwitterAPI - are your credentials correct?
Traceback (most recent call last):
File "main.py, line 179, in
ScanForContests()
FILE "main.pyu", line 176, in ScanForContests
Print("Exception: " + e)
TypeError: cannot concatenate 'str' and 'exceptions.NameError' objects

Refactor the code and separate out into more readable classes

I wrote this bot almost 3 years ago and since then I haven't had much time to maintain it. So many people have forked the repository and created some really great variations of it now, including complete refactors and some even complete rewrites from the ground up. These forks really do a great job of showing the interest for this bot.

I'd like to clean up the core code of this original and make it more readable to newbies as well as for experienced developers looking to modify it for their own use.

With a million other things going on, I'm looking for help in splitting out main.py into classes that make sense and generally improving the code base.

Any help welcome!

Traceback Error

After correctly formatting I receive the following error:

Traceback (most recent call last):
  File "main.py", line 10, in <module>
    data = json.load(data_file)
  File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\json\__init__.py", line 299, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\willi\AppData\Local\Programs\Python\Python36-32\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 12 column 21 (char 442)

No module TwitterAPI

While trying to run the script it's giving me a error
File "/home/pi/Desktop/main.py", line 10, in
data = json.load(data_file)
File "/usr/lib/python2.7/json/init.py", line 291, in load
**kw)
File "/usr/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 3 column 54 (char 163)

I am pretty sure that I installed the twitter API but maybe I just screwed up with that.

Plan to tweak it?

Hello guys,
is there a plan to tweak this bot or is there a improved one forked??

Working?

How can I make sure it is working? I have gone through my Twitter and am yet to see any re tweets

Picking up old contests

For some reason this seems to be picking up old tweets. Saw one that was picked up from 2015. Is there a way to make sure nothing is picked up in the search before a set date?

.gitignore needs to ignore `log` and `config.json.example`

The log and the config.json.example should be ignored by .gitignore, so config.json should probably be renamed once again to config.json.example.

Do you think you may be able to fix this @forddasav? I've merged in your latest contribution but forgot to check these.

Thanks! ๐Ÿ‘

TypeError: cannot concatenate 'str' and 'exceptions.UnboundLocalError' objects

When run i receive the below errors:-

`Traceback (most recent call last):
File "main.py", line 243, in
ScanForContests()
File "main.py", line 235, in ScanForContests
print("Exception: " + e)
TypeError: cannot concatenate 'str' and 'exceptions.UnboundLocalError' objects
Exception in thread Thread-1 (most likely raised during interpreter shutdown):Exception in thread Thread-2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):

Traceback (most recent call last):
File "/usr/local/lib/python2.7/threading.py", line 810, in __bootstrap_inner File "/usr/local/lib/python2.7/threading.py", line 810, in __bootstrap_inner
File "/usr/local/lib/python2.7/threading.py", line 1082, in run
File "main.py", line 156, in ScanForContests
File "/usr/local/lib/python2.7/threading.py", line 1082, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Timer'
`

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.