Code Monkey home page Code Monkey logo

kicktipp-betbot's Introduction

kicktipp-img

kicktipp-betbot

A tool to place bets on www.kicktipp.de automatically

kicktipp-betbot is a python based command-line tool that will place bets on www.kicktipp.de for you.

Motivation

I sometimes forget to place bets for the upcomming matchday. Therefore I wanted to create a 'simple' tool that places bets on the matchday right before the deadline. In conjunction with a raspberry pi server this tool should continously check whether i placed the current matchdays bets and in case i didn't it should place them automatically for me.

Getting started

The tool is designed as python command-line application and is intended to be used in conjunction with e.g. cron jobs. It is also possible to use it interactively.

The main goal is to use this betbot non interactivly, therefore two steps are required to get it work.

  1. Generate a login token for later use
  2. Call the betbot with the generated login token

Generate a login token

If yout dont want to use the betbot interactively you must generate a login token. The first task is to generate a login token. Fortunately the kicktipp website provides a login cookie that is used for this purpose.

$ kicktippbb.py --get-login-token
Username: [email protected]
Password: ********

The result is a character seqence that is used as logint token for further requests.

Place bets

In order to let the tool place bets for you just invoke it and pass it the generated login token. It will use the token and navigate to the 'tippabgabe' sub URL where the bets for the next matchday are placed. The result will be shown on the console.

$ kicktippbb.py --use-login-token c3HfazFh6sd
Community: testspiel
02.10.2020 20:30 '1. FC Union Berlin' vs. 'FSV Mainz 05'  (2.15;3.5;3.3) - betting 1:2
03.10.2020 15:30 'VfB Stuttgart' vs. 'Bayer 04 Leverkusen'  (3.0;3.75;2.2) - betting 1:0
03.10.2020 15:30 'Eintracht Frankfurt' vs. '1899 Hoffenheim'  (2.8;3.75;2.35) - betting 1:1
03.10.2020 15:30 '1. FC Köln' vs. 'Bor. Mönchengladbach'  (3.9;3.9;1.87) - betting 2:0
03.10.2020 15:30 'Werder Bremen' vs. 'Arminia Bielefeld'  (2.15;3.6;3.3) - betting 3:1
03.10.2020 15:30 'Borussia Dortmund' vs. 'SC Freiburg'  (1.4;5.0;7.25) - betting 3:1
03.10.2020 18:30 'RB Leipzig' vs. 'FC Schalke 04'  (1.3;5.75;9.0) - betting 3:0
04.10.2020 15:30 'VfL Wolfsburg' vs. 'FC Augsburg'  (1.91;3.75;3.8) - betting 2:1
04.10.2020 18:00 'FC Bayern München' vs. 'Hertha BSC'  (1.14;9.25;16.5) - betting 3:1

All of your bet communities will be considered by the tool unless you specifiy the desired communities.

$ kicktippbb.py --use-login-token c3HfazFh6sd mycommunityname
...

Taming the daemon

Some useful options to tweak the behavior of the betbot.

Deadline:

If you want the betbot to pick up the slack only in the last minute, there are some options you might consider using.

$ kicktippbb.py --use-login-token c3HfazFh6sd --dealine 10m mycommunityname
...
04.10.2020 18:00 'FC Bayern München' vs. 'Hertha BSC'  (1.17;10.0;21.0) - not betting yet, due in 00:37
...

Override:

By default the betbot doesn't override bets you already placed. So you may see an output like this:

$ kicktippbb.py --use-login-token c3HfazFh6sd  mycommunityname
...
04.10.2020 18:00 'FC Bayern München' vs. 'Hertha BSC'  (1.16;8.5;14.5) - skipped, already placed 3:1
...

Specifying the --override-bets option will ignore already placed bets and override former placed bets.

Matchday

If you like to place bets on a specific matchday you can use the --matchday option. This comes in handy if a match is postponed and kicktipp.de just navigates to the matchday with the postponed open match instead of the current matchday. You can specify any matchday betweeen 1 and 34.

$ kicktippbb.py --matchday=12 mycommunityname
...

Testing the outcome:

If you don't want the betbot to carry out any operations on your games you can add the --dry-run parameter. This prevents the betbot from submitting any bets to your prediction games.

Match Predictor Functions

By default the betbot app uses the first (in alphabetically order) detected prediction algorithm in the prediction subfolder. You can also specify a predictor method by using the --predictor <predictorname> parameter.

$ kicktippbb.py --use-login-token c3HfazFh6sd --predictor CalculationPredictor mycommunityname
...

The prediction classes reside in the predictors subfolder. All predictors must be derived from PredictorBase class and must implement the predict method. The name of the predictor subclass can be used as --predictor input parameter.

Usage

Here the usage:

$ kicktippbb.py --help
KickTipp BetBot
Automated kicktipp.de bet palcement.

Places bets to the upcomming matchday.
Unless specified by parameter it places the bets on all prediction games of the account.

Usage:
    kicktippbb.py [ --get-login-token ]
    kicktippbb.py [ --list-predictors ]
    kicktippbb.py [--use-login-token <token> ] [--dry-run] [--override-bets] [--deadline <duration>] [--predictor <value>] [--matchday <value>] [COMMUNITY]...

Options:
    COMMUNITY                   Name of the prediction game comunity to place bets,
                                one or more names ca be specified
    --get-login-token           Just login and print the login token string
                                for later use with '--use-login-token' option
    --use-login-token <token>   Perform bets without interactive login, use login token insted.
    --override-bets             Override already placed bets.
    --deadline <duration>       Place bets only on matches starting within the given duration.
                                The duration format is <number><unit[m,h,d]>, e.g. 10m,5h or 1d
    --list-predictors           Display a list of predictors available to be used with '--predictor' option
    --predictor <value>         A specific predictor name to be used during calculation
    --dry-run                   Dont place any bet just print out predicitons
    --matchday <value>          Choose a specific matchday in the range of 1 to 34 to place bets on  

kicktipp-betbot's People

Contributors

dmham187 avatar schwalle 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

Watchers

 avatar  avatar

kicktipp-betbot's Issues

"IndexError: The matchday '35' is not valid, use only 1 to 34!"

Wenn man in einer Kicktipp Liga ist, in der mehrere Ligen zeitgleich getippt werden (z.B. bei mir 1. Bundesliga, 2. Bundesliga und der Pokal) kommt die Fehlermeldung, wenn man den "35ten" Spieltag tippen möchte. Also den 16ten Spieltag in der Bundesliga.

Python error "IndexError: list index out of range"

First of all, thanks for your awesome project!

Since a couple of days I receive the following error, any ideas (I'm not a python dev but it seems to be a easy one)?

FYI, I'm working on a Docker image to run your script which I will publish once I'm done.

Traceback (most recent call last):
File "/Users/egnerfl/Developer/kicktipp-betbot/./kicktippbb.py", line 267, in
main(arguments)
File "/Users/egnerfl/Developer/kicktipp-betbot/./kicktippbb.py", line 261, in main
place_bets(browser, communities, predictor,
File "/Users/egnerfl/Developer/kicktipp-betbot/./kicktippbb.py", line 171, in place_bets
matches = parse_match_rows(browser, com, matchday)
File "/Users/egnerfl/Developer/kicktipp-betbot/./kicktippbb.py", line 111, in parse_match_rows
), row[4].get_text(), row[5].get_text(), row[6].get_text())
IndexError: list index out of range
✘ egnerfl@MacBookPro  ~/Developer/

KeyError in get_predictors

I got the follwoing Error if i try to run your bot:

Traceback (most recent call last): File "kicktippbb.py", line 256, in <module> main(arguments) File "kicktippbb.py", line 217, in main predictors = get_predictors() File "kicktippbb.py", line 210, in get_predictors return dict((name, obj) for name, obj in inspect.getmembers(sys.modules['prediction'], predicate=inspect.isclass) if 'predict' in [x for x, y in inspect.getmembers(obj, predicate=inspect.isfunction) if x == 'predict']) KeyError: 'prediction'

Türkische Liga, ungerade Anzahl an Mannschafen und fehlende Quoten

Hi, ich hab ein bisschen herumprobiert und hoffe herausgefunden, wieso es in Communities mit Türkischer Süperlig nicht funktioniert.
ligatr
ligatrerror

oftmals fehlen einzelne Tipps in der Türkischen Liga auch dann z.B. wenn eine Mannschaft aussetzen muss, weil akt. 19 Mannschaften spielen.
Gibt es eine Möglichkeit das man diese tipps dann skipped? Ich bekomme wenn ich im try

try:
print(row[4].get_text())

hinzufüge eben genau dann einen abbruch wenn ein spiel gefunden wird ohne tipps.

Sorry für meine Wortwahl, bin kein Entwickler und das ist das erste mal das ich überhaupt was auf github mache.

vielen dank

Change with kicktipp? (Error: Not enough data, maybe there are no rates yet.)

For me parse_match_rows fails when creating a match.


match = Match(row[1].get_text(), row[2].get_text(), row[0].get_text(
            ), row[4].get_text().replace("/", ""), row[5].get_text().replace("/", ""), row[6].get_text())

Tried printing the rows to see where it fails and it seems like the rows list is of length 5 but should be at least 7

kicktippbb.py", line 117, in parse_match_rows
    row[5]: {row[5].get_text().replace('/', '')}\n
IndexError: list index out of range

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.