├── sync_token.txt ├── .gitattributes ├── test.py ├── helpers ├── proxies_residential.txt ├── enums.py ├── proxies.txt └── BotBase.py ├── .gitignore ├── bet365_token.py ├── bot_master.py └── Bet365.py /sync_token.txt: -------------------------------------------------------------------------------- 1 | 45eqYQ==.vZghe9EP/lYfIXCygbdO5FvkscsalusHj+6uSS/N87o= -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | import mysql.connector 2 | db = mysql.connector.connect(user='prodev', database='ninjabet_dev', host='127.0.0.1',auth_plugin='mysql_native_password', ) -------------------------------------------------------------------------------- /helpers/proxies_residential.txt: -------------------------------------------------------------------------------- 1 | 195.154.161.81:9592 2 | 195.154.161.81:9593 3 | 195.154.161.81:9594 4 | 195.154.161.81:9595 5 | 195.154.161.81:9596 6 | 195.154.161.81:9597 7 | 195.154.161.81:9598 8 | 195.154.161.81:9599 9 | 195.154.161.81:9600 10 | 195.154.161.81:9601 11 | 195.154.161.81:9602 12 | 195.154.161.81:9603 13 | 195.154.161.81:9604 14 | 195.154.161.81:9605 15 | 195.154.161.81:9606 16 | 195.154.161.81:9607 17 | 195.154.161.81:9608 18 | 195.154.161.81:9609 19 | 195.154.161.81:9610 20 | 195.154.161.81:9611 21 | 195.154.161.81:9612 22 | 195.154.161.81:9613 23 | 195.154.161.81:9614 24 | 195.154.161.81:9615 25 | 195.154.161.81:9616 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .nox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *.cover 48 | .hypothesis/ 49 | .pytest_cache/ 50 | 51 | # Translations 52 | *.mo 53 | *.pot 54 | 55 | # Django stuff: 56 | *.log 57 | local_settings.py 58 | db.sqlite3 59 | 60 | # Flask stuff: 61 | instance/ 62 | .webassets-cache 63 | 64 | # Scrapy stuff: 65 | .scrapy 66 | 67 | # Sphinx documentation 68 | docs/_build/ 69 | 70 | # PyBuilder 71 | target/ 72 | 73 | # Jupyter Notebook 74 | .ipynb_checkpoints 75 | 76 | # IPython 77 | profile_default/ 78 | ipython_config.py 79 | 80 | # pyenv 81 | .python-version 82 | 83 | # celery beat schedule file 84 | celerybeat-schedule 85 | 86 | # SageMath parsed files 87 | *.sage.py 88 | 89 | # Environments 90 | .env 91 | .venv 92 | env/ 93 | venv/ 94 | ENV/ 95 | env.bak/ 96 | venv.bak/ 97 | 98 | # Spyder project settings 99 | .spyderproject 100 | .spyproject 101 | 102 | # Rope project settings 103 | .ropeproject 104 | 105 | # mkdocs documentation 106 | /site 107 | 108 | # mypy 109 | .mypy_cache/ 110 | .dmypy.json 111 | dmypy.json 112 | 113 | # Pyre type checker 114 | .pyre/ 115 | -------------------------------------------------------------------------------- /bet365_token.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import re 3 | from datetime import datetime 4 | import requests 5 | from time import time,sleep 6 | from pyppeteer import launch 7 | import random 8 | import sys 9 | import traceback 10 | import os 11 | 12 | 13 | proxies_residential = [] 14 | user_agents = [] 15 | proxies = [] 16 | 17 | # with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "proxies.txt"), "r") as f: 18 | # proxies = [line.strip() for line in f.readlines()] 19 | 20 | with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "user_agents.txt"), "r") as f: 21 | user_agents = [line.strip() for line in f.readlines()] 22 | 23 | 24 | with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "proxies_residential.txt"), "r") as f: 25 | proxies_residential = [line.strip() for line in f.readlines()] 26 | 27 | # def get_proxy(): 28 | # random_proxy = random.choice(proxies) 29 | # ip,port,username,password = random_proxy.split(":") 30 | # url_proxy = "http://{2}:{3}@{0}:{1}".format(ip,port,username,password) 31 | # return url_proxy 32 | 33 | def get_residential_proxy(): 34 | return "http://"+random.choice(proxies_residential) 35 | 36 | 37 | async def get_token(): 38 | browser = await launch( 39 | headless=True, 40 | # args=['--disable-blink-features=AutomationControlled','--no-sandbox','--proxy-server='+get_residential_proxy()], 41 | args=['--disable-blink-features=AutomationControlled','--no-sandbox'], 42 | 43 | ) 44 | try: 45 | page = (await browser.pages())[0] 46 | await page.setUserAgent( 47 | random.choice(user_agents) 48 | ) 49 | request = await page.goto("https://www.bet365.it") 50 | request = await page.waitForRequest(lambda r: 'SportsBook' in r.url) 51 | 52 | await browser.close() 53 | return request.headers["x-net-sync-term"] 54 | except Exception as e: 55 | exc_type, exc_obj, exc_tb = sys.exc_info() 56 | traceback.print_exception(exc_type, exc_obj, exc_tb) 57 | await browser.close() 58 | return "" 59 | 60 | 61 | while 1: 62 | try: 63 | token = asyncio.get_event_loop().run_until_complete(get_token()) 64 | print(token) 65 | if token: 66 | with open("./sync_token.txt", "w") as f: 67 | f.write(token) 68 | sleep(6*50) 69 | else: 70 | sleep(5) 71 | except Exception as e: 72 | exc_type, exc_obj, exc_tb = sys.exc_info() 73 | traceback.print_exception(exc_type, exc_obj, exc_tb) 74 | sleep(5) 75 | continue 76 | except KeyboardInterrupt: 77 | sys.exit() 78 | -------------------------------------------------------------------------------- /bot_master.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import importlib 3 | import importlib.util 4 | from helpers.enums import * 5 | from time import sleep,time 6 | import multiprocessing 7 | import os 8 | import requests 9 | import subprocess 10 | import mysql.connector 11 | import traceback 12 | import orjson 13 | import sys 14 | 15 | 16 | class BotMaster(): 17 | def __init(self): 18 | self.init_options() 19 | self.running_bots = [] 20 | self.all_bots = {} 21 | 22 | def start_bot(self,bot_filename,options): 23 | print('1111111111111111',bot_filename) 24 | bookie_name = bot_filename.replace(".py","") 25 | #spec = importlib.util.spec_from_file_location(bookie_name, "./bookies/"+bot_filename) 26 | #bot_module = importlib.util.module_from_spec(spec) 27 | print('222222222222222222',bookie_name) 28 | bot_module = getattr(importlib.import_module(bookie_name),bookie_name) 29 | print('333333333333333',bot_module) 30 | 31 | while 1: 32 | try: 33 | print("12222222222",options) 34 | bot = bot_module(options) 35 | bot.run() 36 | except Exception as e: 37 | exc_type, exc_obj, exc_tb = sys.exc_info() 38 | traceback.print_exception(exc_type, exc_obj, exc_tb) 39 | 40 | def start_all(self,options): 41 | self.running_bots = [] 42 | for bot_filename in os.listdir("./"): 43 | if ".py" in bot_filename and "bot_master" not in bot_filename and "enums" not in bot_filename: 44 | bookie_name = bot_filename.replace(".py","") 45 | if bookie_name.lower() == "betfairexchange": 46 | os.system("python3 bot_master.py {0} &> /dev/null &".format("--bookie="+bot_filename.replace(".py",""))) 47 | continue 48 | for sprt in Sport: 49 | if sprt.name != "CALCIO": 50 | continue 51 | options.sport = sprt.name 52 | cmd="python3 bot_master.py {0} {1} &> /dev/null &".format("--bookie="+bot_filename.replace(".py",""),"--sport="+sprt.name) 53 | if options.noproxies: 54 | cmd="python3 bot_master.py {0} {1} --noproxies &> /dev/null &".format("--bookie="+bot_filename.replace(".py",""),"--sport="+sprt.name) 55 | elif options.usetor: 56 | cmd="python3 bot_master.py {0} {1} --usetor &> /dev/null &".format("--bookie="+bot_filename.replace(".py",""),"--sport="+sprt.name) 57 | 58 | os.system(cmd) 59 | 60 | def init_options(): 61 | parser = argparse.ArgumentParser() 62 | parser.add_argument("-b", "--bookie", type=str) 63 | parser.add_argument("-t", "--threads", type=int) 64 | parser.add_argument("-c", "--cycle", type=int) 65 | parser.add_argument("-s", "--sport", type=str) 66 | parser.add_argument("-o", "--host", type=str) 67 | parser.add_argument("-u", "--username", type=str) 68 | parser.add_argument("-p", "--password", type=str) 69 | parser.add_argument("-d", "--database", type=str) 70 | parser.add_argument("-n", "--noproxies", action="store_true") 71 | parser.add_argument("-r", "--usetor", action="store_true") 72 | parser.add_argument("-l", "--residentials", action="store_true") 73 | parser.add_argument("-a", "--allstart", action="store_true") 74 | 75 | return parser.parse_args() 76 | 77 | def get_database_params(): 78 | url = "http://odds.ninjabet.it/get_ip.php?region=it" 79 | return orjson.loads('{"username":"prodev","password":"","database":"ninjabet_test","host":"localhost"}') 80 | # return orjson.loads('{"username":"83fdd02e71","password":"4e59d10211ad4d477b3","database":"ninjabet_dev","host":"localhost"}') 81 | 82 | 83 | 84 | if __name__ == '__main__': 85 | options = init_options() 86 | 87 | bot = BotMaster() 88 | if options.allstart: 89 | bot.start_all(options) 90 | elif options.bookie and (options.bookie.lower() == "betfairexchange" or options.sport): 91 | 92 | params = get_database_params() 93 | options.host = params["host"] 94 | options.username = params["username"] 95 | options.password = params["password"] 96 | options.database = params["database"] 97 | 98 | bot.start_bot(options.bookie,options) 99 | 100 | elif options.bookie and options.sport is None: 101 | for sprt in Sport: 102 | if sprt.name == "ESPORTS": 103 | continue 104 | cmd="nohup python3 bot_master.py {0} {1} &> /dev/null &".format("--bookie="+options.bookie,"--sport="+sprt.name) 105 | if options.noproxies: 106 | cmd="nohup python3 bot_master.py {0} {1} --noproxies &> /dev/null &".format("--bookie="+options.bookie,"--sport="+sprt.name) 107 | elif options.usetor: 108 | cmd="nohup python3 bot_master.py {0} {1} --usetor &> /dev/null &".format("--bookie="+options.bookie,"--sport="+sprt.name) 109 | 110 | os.system(cmd) 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /helpers/enums.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | class Market(Enum): 3 | M_1X2=1 4 | FH_1X2=2 5 | SH_1X2=3 6 | M_12=4 7 | DC=5 8 | FH_DC=6 9 | SH_DC=7 10 | OVER_UNDER=8 11 | TEAM1_OVER_UNDER=9 12 | TEAM2_OVER_UNDER=10 13 | FH_OVER_UNDER=11 14 | SH_OVER_UNDER=12 15 | GNG=13 16 | FH_GNG=14 17 | SH_GNG=15 18 | CORRECT_SCORE=16 19 | EVEN_ODD=17 20 | HT_FT=18 21 | PENALTY_NOPENALTY=19 22 | SET1_HH = 20 23 | SET2_HH = 21 24 | TB_OU = 22 25 | GAMES_OU = 23 26 | SET1_GAMES_OU = 24 27 | SET2_GAMES_OU = 25 28 | PLAYER1_GAMES_OU = 26 29 | PLAYER2_GAMES_OU = 27 30 | 31 | class Exchange(Enum): 32 | BETFAIR=1 33 | BETFLAG=2 34 | 35 | class Sport(Enum): 36 | CALCIO=1 37 | TENNIS=2 38 | BASKET=3 39 | TENNISTAVOLO=4 40 | ESPORTS=5 41 | 42 | class Selection(Enum): 43 | HOME=1 44 | AWAY=2 45 | DRAW=3 46 | FH_HOME=4 47 | FH_AWAY=5 48 | FH_DRAW=6 49 | SH_HOME=7 50 | SH_AWAY=8 51 | SH_DRAW=9 52 | EVEN=10 53 | ODD=11 54 | CS_00=12 55 | CS_01=13 56 | CS_02=14 57 | CS_03=15 58 | CS_04=16 59 | CS_05=17 60 | CS_06=18 61 | CS_07=19 62 | CS_08=20 63 | CS_09=21 64 | CS_10=22 65 | CS_11=23 66 | CS_12=24 67 | CS_13=25 68 | CS_14=26 69 | CS_15=27 70 | CS_16=28 71 | CS_17=29 72 | CS_18=30 73 | CS_19=31 74 | CS_20=32 75 | CS_21=33 76 | CS_22=34 77 | CS_23=35 78 | CS_24=36 79 | CS_25=37 80 | CS_26=38 81 | CS_27=39 82 | CS_28=40 83 | CS_29=41 84 | CS_30=42 85 | CS_31=43 86 | CS_32=44 87 | CS_33=45 88 | CS_34=46 89 | CS_35=47 90 | CS_36=48 91 | CS_37=49 92 | CS_38=50 93 | CS_40=51 94 | CS_41=52 95 | CS_42=53 96 | CS_43=54 97 | CS_44=55 98 | CS_45=56 99 | CS_46=57 100 | CS_47=58 101 | CS_48=59 102 | CS_50=60 103 | CS_51=61 104 | CS_52=62 105 | CS_53=63 106 | CS_54=64 107 | CS_55=65 108 | CS_56=66 109 | CS_60=67 110 | CS_61=68 111 | CS_62=69 112 | CS_63=70 113 | CS_64=71 114 | CS_65=72 115 | CS_70=73 116 | CS_71=74 117 | CS_72=75 118 | CS_73=76 119 | CS_74=77 120 | CS_80=78 121 | CS_81=79 122 | CS_82=80 123 | CS_83=81 124 | CS_84=82 125 | CS_90=83 126 | CS_91=84 127 | CS_92=85 128 | CS_93=86 129 | CS_94=87 130 | CS_95=88 131 | CS_96=89 132 | CS_97=90 133 | CS_98=91 134 | CS_99=92 135 | DC_HOME_AWAY=93 136 | DC_HOME_DRAW=94 137 | DC_DRAW_AWAY=95 138 | FH_DC_HOME_AWAY=96 139 | FH_DC_HOME_DRAW=97 140 | FH_DC_DRAW_AWAY=98 141 | SH_DC_HOME_AWAY=99 142 | SH_DC_HOME_DRAW=100 143 | SH_DC_DRAW_AWAY=101 144 | PENALTY=102 145 | NO_PENALTY=103 146 | GOAL=104 147 | NO_GOAL=105 148 | FH_GOAL=106 149 | FH_NO_GOAL=107 150 | SH_GOAL=108 151 | SH_NO_GOAL=109 152 | OVER_05=110 153 | OVER_15=111 154 | OVER_25=112 155 | OVER_35=113 156 | OVER_45=114 157 | OVER_55=115 158 | OVER_65=116 159 | OVER_75=117 160 | OVER_85=118 161 | OVER_95=119 162 | UNDER_05=120 163 | UNDER_15=121 164 | UNDER_25=122 165 | UNDER_35=123 166 | UNDER_45=124 167 | UNDER_55=125 168 | UNDER_65=126 169 | UNDER_75=127 170 | UNDER_85=128 171 | UNDER_95=129 172 | FH_OVER_05=130 173 | FH_OVER_15=131 174 | FH_OVER_25=132 175 | FH_OVER_35=133 176 | FH_OVER_45=134 177 | FH_OVER_55=135 178 | FH_OVER_65=136 179 | FH_OVER_75=137 180 | FH_OVER_85=138 181 | FH_OVER_95=139 182 | FH_UNDER_05=140 183 | FH_UNDER_15=141 184 | FH_UNDER_25=142 185 | FH_UNDER_35=143 186 | FH_UNDER_45=144 187 | FH_UNDER_55=145 188 | FH_UNDER_65=146 189 | FH_UNDER_75=147 190 | FH_UNDER_85=148 191 | FH_UNDER_95=149 192 | SH_OVER_05=150 193 | SH_OVER_15=151 194 | SH_OVER_25=152 195 | SH_OVER_35=153 196 | SH_OVER_45=154 197 | SH_OVER_55=155 198 | SH_OVER_65=156 199 | SH_OVER_75=157 200 | SH_OVER_85=158 201 | SH_OVER_95=159 202 | SH_UNDER_05=160 203 | SH_UNDER_15=161 204 | SH_UNDER_25=162 205 | SH_UNDER_35=163 206 | SH_UNDER_45=164 207 | SH_UNDER_55=165 208 | SH_UNDER_65=166 209 | SH_UNDER_75=167 210 | SH_UNDER_85=168 211 | SH_UNDER_95=169 212 | TEAM1_OVER_05=170 213 | TEAM1_OVER_15=171 214 | TEAM1_OVER_25=172 215 | TEAM1_OVER_35=173 216 | TEAM1_OVER_45=174 217 | TEAM1_OVER_55=175 218 | TEAM1_OVER_65=176 219 | TEAM1_OVER_75=177 220 | TEAM1_OVER_85=178 221 | TEAM1_OVER_95=179 222 | TEAM1_UNDER_05=180 223 | TEAM1_UNDER_15=181 224 | TEAM1_UNDER_25=182 225 | TEAM1_UNDER_35=183 226 | TEAM1_UNDER_45=184 227 | TEAM1_UNDER_55=185 228 | TEAM1_UNDER_65=186 229 | TEAM1_UNDER_75=187 230 | TEAM1_UNDER_85=188 231 | TEAM1_UNDER_95=189 232 | TEAM2_OVER_05=190 233 | TEAM2_OVER_15=191 234 | TEAM2_OVER_25=192 235 | TEAM2_OVER_35=193 236 | TEAM2_OVER_45=194 237 | TEAM2_OVER_55=195 238 | TEAM2_OVER_65=196 239 | TEAM2_OVER_75=197 240 | TEAM2_OVER_85=198 241 | TEAM2_OVER_95=199 242 | TEAM2_UNDER_05=200 243 | TEAM2_UNDER_15=201 244 | TEAM2_UNDER_25=202 245 | TEAM2_UNDER_35=203 246 | TEAM2_UNDER_45=204 247 | TEAM2_UNDER_55=205 248 | TEAM2_UNDER_65=206 249 | TEAM2_UNDER_75=207 250 | TEAM2_UNDER_85=208 251 | TEAM2_UNDER_95=209 252 | HT_FT_AWAY_AWAY = 216 253 | HT_FT_AWAY_DRAW = 217 254 | HT_FT_AWAY_HOME = 218 255 | HT_FT_DRAW_AWAY = 219 256 | HT_FT_DRAW_DRAW = 220 257 | HT_FT_DRAW_HOME = 221 258 | HT_FT_HOME_AWAY = 222 259 | HT_FT_HOME_DRAW = 223 260 | HT_FT_HOME_HOME = 224 261 | SET1_HOME=225 262 | SET1_AWAY=226 263 | SET2_AWAY=227 264 | SET2_HOME=228 265 | TB_OVER_05=229 266 | TB_UNDER_05=230 267 | GAMES_OVER_165=231 268 | GAMES_OVER_175=232 269 | GAMES_OVER_185=233 270 | GAMES_OVER_195=234 271 | GAMES_OVER_205=235 272 | GAMES_OVER_215=236 273 | GAMES_OVER_225=237 274 | GAMES_OVER_235=238 275 | GAMES_OVER_245=239 276 | GAMES_OVER_255=240 277 | GAMES_OVER_265=241 278 | GAMES_OVER_275=242 279 | GAMES_OVER_285=243 280 | GAMES_OVER_295=244 281 | GAMES_OVER_305=245 282 | GAMES_OVER_315=246 283 | GAMES_OVER_335=247 284 | GAMES_OVER_345=248 285 | GAMES_OVER_355=249 286 | GAMES_OVER_365=250 287 | GAMES_OVER_375=251 288 | GAMES_OVER_385=252 289 | GAMES_OVER_395=253 290 | GAMES_OVER_405=254 291 | GAMES_OVER_415=255 292 | GAMES_OVER_425=256 293 | GAMES_OVER_435=257 294 | GAMES_OVER_455=258 295 | GAMES_OVER_465=259 296 | GAMES_UNDER_165=260 297 | GAMES_UNDER_175=261 298 | GAMES_UNDER_185=262 299 | GAMES_UNDER_195=263 300 | GAMES_UNDER_205=264 301 | GAMES_UNDER_215=265 302 | GAMES_UNDER_225=266 303 | GAMES_UNDER_235=267 304 | GAMES_UNDER_245=268 305 | GAMES_UNDER_255=269 306 | GAMES_UNDER_265=270 307 | GAMES_UNDER_275=271 308 | GAMES_UNDER_285=272 309 | GAMES_UNDER_295=273 310 | GAMES_UNDER_305=274 311 | GAMES_UNDER_315=275 312 | GAMES_UNDER_335=276 313 | GAMES_UNDER_345=277 314 | GAMES_UNDER_355=278 315 | GAMES_UNDER_365=279 316 | GAMES_UNDER_375=280 317 | GAMES_UNDER_385=281 318 | GAMES_UNDER_395=282 319 | GAMES_UNDER_405=283 320 | GAMES_UNDER_415=284 321 | GAMES_UNDER_425=285 322 | GAMES_UNDER_435=286 323 | GAMES_UNDER_455=287 324 | GAMES_UNDER_465=288 325 | PLAYER1_GAMES_OVER_105=289 326 | PLAYER1_GAMES_OVER_115=290 327 | PLAYER1_GAMES_OVER_125=291 328 | PLAYER1_GAMES_OVER_185=292 329 | PLAYER1_GAMES_OVER_205=293 330 | PLAYER1_GAMES_UNDER_105=294 331 | PLAYER1_GAMES_UNDER_115=295 332 | PLAYER1_GAMES_UNDER_125=296 333 | PLAYER1_GAMES_UNDER_185=297 334 | PLAYER1_GAMES_UNDER_205=298 335 | PLAYER2_GAMES_OVER_105=299 336 | PLAYER2_GAMES_OVER_115=300 337 | PLAYER2_GAMES_OVER_125=301 338 | PLAYER2_GAMES_OVER_165=302 339 | PLAYER2_GAMES_OVER_205=303 340 | PLAYER2_GAMES_OVER_75=304 341 | PLAYER2_GAMES_OVER_85=305 342 | PLAYER2_GAMES_OVER_95=306 343 | PLAYER2_GAMES_UNDER_105=307 344 | PLAYER2_GAMES_UNDER_115=308 345 | PLAYER2_GAMES_UNDER_125=309 346 | PLAYER2_GAMES_UNDER_165=310 347 | PLAYER2_GAMES_UNDER_205=311 348 | PLAYER2_GAMES_UNDER_75=312 349 | PLAYER2_GAMES_UNDER_85=313 350 | PLAYER2_GAMES_UNDER_95=314 351 | SET1_GAMES_OVER_105=315 352 | SET1_GAMES_OVER_125=316 353 | SET1_GAMES_OVER_65=317 354 | SET1_GAMES_OVER_75=318 355 | SET1_GAMES_OVER_85=319 356 | SET1_GAMES_OVER_95=320 357 | SET1_GAMES_UNDER_105=321 358 | SET1_GAMES_UNDER_125=322 359 | SET1_GAMES_UNDER_65=323 360 | SET1_GAMES_UNDER_75=324 361 | SET1_GAMES_UNDER_85=325 362 | SET1_GAMES_UNDER_95=326 -------------------------------------------------------------------------------- /helpers/proxies.txt: -------------------------------------------------------------------------------- 1 | 165.231.225.8:12345:ninjabet:Ninja2018! 2 | 196.196.164.87:12345:ninjabet:Ninja2018! 3 | 192.109.110.178:12345:ninjabet:Ninja2018! 4 | 192.109.110.110:12345:ninjabet:Ninja2018! 5 | 196.196.160.132:12345:ninjabet:Ninja2018! 6 | 196.196.164.83:12345:ninjabet:Ninja2018! 7 | 196.196.164.85:12345:ninjabet:Ninja2018! 8 | 196.196.164.141:12345:ninjabet:Ninja2018! 9 | 192.109.110.127:12345:ninjabet:Ninja2018! 10 | 165.231.225.17:12345:ninjabet:Ninja2018! 11 | 196.196.160.181:12345:ninjabet:Ninja2018! 12 | 196.196.164.226:12345:ninjabet:Ninja2018! 13 | 192.109.110.141:12345:ninjabet:Ninja2018! 14 | 165.231.225.18:12345:ninjabet:Ninja2018! 15 | 192.109.110.152:12345:ninjabet:Ninja2018! 16 | 192.109.110.208:12345:ninjabet:Ninja2018! 17 | 192.109.110.237:12345:ninjabet:Ninja2018! 18 | 192.109.110.82:12345:ninjabet:Ninja2018! 19 | 192.109.110.36:12345:ninjabet:Ninja2018! 20 | 165.231.225.124:12345:ninjabet:Ninja2018! 21 | 165.231.225.215:12345:ninjabet:Ninja2018! 22 | 165.231.225.117:12345:ninjabet:Ninja2018! 23 | 196.196.164.79:12345:ninjabet:Ninja2018! 24 | 196.196.164.95:12345:ninjabet:Ninja2018! 25 | 165.231.225.53:12345:ninjabet:Ninja2018! 26 | 192.109.110.219:12345:ninjabet:Ninja2018! 27 | 192.109.110.220:12345:ninjabet:Ninja2018! 28 | 192.109.110.64:12345:ninjabet:Ninja2018! 29 | 165.231.225.50:12345:ninjabet:Ninja2018! 30 | 192.109.110.4:12345:ninjabet:Ninja2018! 31 | 165.231.225.191:12345:ninjabet:Ninja2018! 32 | 196.196.160.38:12345:ninjabet:Ninja2018! 33 | 192.109.110.234:12345:ninjabet:Ninja2018! 34 | 212.237.0.118:12345:ninjabet:Ninja2018! 35 | 196.196.164.199:12345:ninjabet:Ninja2018! 36 | 196.196.160.90:12345:ninjabet:Ninja2018! 37 | 192.109.110.247:12345:ninjabet:Ninja2018! 38 | 196.196.160.99:12345:ninjabet:Ninja2018! 39 | 196.196.160.197:12345:ninjabet:Ninja2018! 40 | 165.231.225.33:12345:ninjabet:Ninja2018! 41 | 192.109.110.59:12345:ninjabet:Ninja2018! 42 | 192.109.110.199:12345:ninjabet:Ninja2018! 43 | 196.196.164.75:12345:ninjabet:Ninja2018! 44 | 192.109.110.215:12345:ninjabet:Ninja2018! 45 | 196.196.160.158:12345:ninjabet:Ninja2018! 46 | 165.231.225.180:12345:ninjabet:Ninja2018! 47 | 196.196.164.236:12345:ninjabet:Ninja2018! 48 | 196.196.160.205:12345:ninjabet:Ninja2018! 49 | 196.196.160.159:12345:ninjabet:Ninja2018! 50 | 192.109.110.201:12345:ninjabet:Ninja2018! 51 | 196.196.164.228:12345:ninjabet:Ninja2018! 52 | 196.196.160.177:12345:ninjabet:Ninja2018! 53 | 196.196.164.105:12345:ninjabet:Ninja2018! 54 | 165.231.225.165:12345:ninjabet:Ninja2018! 55 | 196.196.160.173:12345:ninjabet:Ninja2018! 56 | 192.109.110.100:12345:ninjabet:Ninja2018! 57 | 196.196.164.196:12345:ninjabet:Ninja2018! 58 | 192.109.110.205:12345:ninjabet:Ninja2018! 59 | 192.109.110.97:12345:ninjabet:Ninja2018! 60 | 196.196.160.230:12345:ninjabet:Ninja2018! 61 | 165.231.225.114:12345:ninjabet:Ninja2018! 62 | 165.231.225.199:12345:ninjabet:Ninja2018! 63 | 165.231.225.182:12345:ninjabet:Ninja2018! 64 | 196.196.164.116:12345:ninjabet:Ninja2018! 65 | 192.109.110.103:12345:ninjabet:Ninja2018! 66 | 196.196.160.130:12345:ninjabet:Ninja2018! 67 | 196.196.160.198:12345:ninjabet:Ninja2018! 68 | 196.196.160.33:12345:ninjabet:Ninja2018! 69 | 165.231.225.192:12345:ninjabet:Ninja2018! 70 | 196.196.164.222:12345:ninjabet:Ninja2018! 71 | 196.196.160.136:12345:ninjabet:Ninja2018! 72 | 192.109.110.214:12345:ninjabet:Ninja2018! 73 | 165.231.225.87:12345:ninjabet:Ninja2018! 74 | 165.231.225.112:12345:ninjabet:Ninja2018! 75 | 192.109.110.7:12345:ninjabet:Ninja2018! 76 | 192.109.110.165:12345:ninjabet:Ninja2018! 77 | 165.231.225.85:12345:ninjabet:Ninja2018! 78 | 192.109.110.242:12345:ninjabet:Ninja2018! 79 | 192.109.110.11:12345:ninjabet:Ninja2018! 80 | 192.109.110.192:12345:ninjabet:Ninja2018! 81 | 192.109.110.200:12345:ninjabet:Ninja2018! 82 | 192.109.110.156:12345:ninjabet:Ninja2018! 83 | 165.231.225.168:12345:ninjabet:Ninja2018! 84 | 192.109.110.133:12345:ninjabet:Ninja2018! 85 | 196.196.164.221:12345:ninjabet:Ninja2018! 86 | 196.196.164.130:12345:ninjabet:Ninja2018! 87 | 165.231.225.128:12345:ninjabet:Ninja2018! 88 | 165.231.225.37:12345:ninjabet:Ninja2018! 89 | 196.196.164.86:12345:ninjabet:Ninja2018! 90 | 196.196.164.80:12345:ninjabet:Ninja2018! 91 | 196.196.160.19:12345:ninjabet:Ninja2018! 92 | 192.109.110.108:12345:ninjabet:Ninja2018! 93 | 196.196.160.253:12345:ninjabet:Ninja2018! 94 | 165.231.225.34:12345:ninjabet:Ninja2018! 95 | 196.196.164.217:12345:ninjabet:Ninja2018! 96 | 192.109.110.213:12345:ninjabet:Ninja2018! 97 | 196.196.160.70:12345:ninjabet:Ninja2018! 98 | 192.109.110.204:12345:ninjabet:Ninja2018! 99 | 165.231.225.25:12345:ninjabet:Ninja2018! 100 | 192.109.110.115:12345:ninjabet:Ninja2018! 101 | 192.109.110.56:12345:ninjabet:Ninja2018! 102 | 196.196.164.114:12345:ninjabet:Ninja2018! 103 | 196.196.164.195:12345:ninjabet:Ninja2018! 104 | 192.109.110.116:12345:ninjabet:Ninja2018! 105 | 196.196.160.18:12345:ninjabet:Ninja2018! 106 | 196.196.160.60:12345:ninjabet:Ninja2018! 107 | 196.196.164.225:12345:ninjabet:Ninja2018! 108 | 196.196.160.34:12345:ninjabet:Ninja2018! 109 | 196.196.164.133:12345:ninjabet:Ninja2018! 110 | 196.196.164.148:12345:ninjabet:Ninja2018! 111 | 165.231.225.248:12345:ninjabet:Ninja2018! 112 | 165.231.225.238:12345:ninjabet:Ninja2018! 113 | 196.196.160.78:12345:ninjabet:Ninja2018! 114 | 192.109.110.16:12345:ninjabet:Ninja2018! 115 | 192.109.110.32:12345:ninjabet:Ninja2018! 116 | 165.231.225.62:12345:ninjabet:Ninja2018! 117 | 196.196.160.58:12345:ninjabet:Ninja2018! 118 | 192.109.110.181:12345:ninjabet:Ninja2018! 119 | 192.109.110.125:12345:ninjabet:Ninja2018! 120 | 165.231.225.227:12345:ninjabet:Ninja2018! 121 | 192.109.110.21:12345:ninjabet:Ninja2018! 122 | 196.196.164.35:12345:ninjabet:Ninja2018! 123 | 192.109.110.235:12345:ninjabet:Ninja2018! 124 | 196.196.164.53:12345:ninjabet:Ninja2018! 125 | 165.231.225.147:12345:ninjabet:Ninja2018! 126 | 196.196.164.139:12345:ninjabet:Ninja2018! 127 | 196.196.160.66:12345:ninjabet:Ninja2018! 128 | 196.196.160.175:12345:ninjabet:Ninja2018! 129 | 192.109.110.106:12345:ninjabet:Ninja2018! 130 | 196.196.160.51:12345:ninjabet:Ninja2018! 131 | 192.109.110.50:12345:ninjabet:Ninja2018! 132 | 196.196.164.227:12345:ninjabet:Ninja2018! 133 | 165.231.225.121:12345:ninjabet:Ninja2018! 134 | 165.231.225.246:12345:ninjabet:Ninja2018! 135 | 192.109.110.96:12345:ninjabet:Ninja2018! 136 | 196.196.164.144:12345:ninjabet:Ninja2018! 137 | 196.196.160.138:12345:ninjabet:Ninja2018! 138 | 192.109.110.41:12345:ninjabet:Ninja2018! 139 | 196.196.164.224:12345:ninjabet:Ninja2018! 140 | 196.196.164.202:12345:ninjabet:Ninja2018! 141 | 196.196.164.123:12345:ninjabet:Ninja2018! 142 | 192.109.110.216:12345:ninjabet:Ninja2018! 143 | 165.231.225.75:12345:ninjabet:Ninja2018! 144 | 196.196.164.215:12345:ninjabet:Ninja2018! 145 | 165.231.225.161:12345:ninjabet:Ninja2018! 146 | 196.196.160.124:12345:ninjabet:Ninja2018! 147 | 192.109.110.212:12345:ninjabet:Ninja2018! 148 | 192.109.110.154:12345:ninjabet:Ninja2018! 149 | 165.231.225.236:12345:ninjabet:Ninja2018! 150 | 165.231.225.66:12345:ninjabet:Ninja2018! 151 | 165.231.225.59:12345:ninjabet:Ninja2018! 152 | 192.109.110.101:12345:ninjabet:Ninja2018! 153 | 192.109.110.37:12345:ninjabet:Ninja2018! 154 | 192.109.110.86:12345:ninjabet:Ninja2018! 155 | 165.231.225.41:12345:ninjabet:Ninja2018! 156 | 165.231.225.251:12345:ninjabet:Ninja2018! 157 | 165.231.225.213:12345:ninjabet:Ninja2018! 158 | 192.109.110.188:12345:ninjabet:Ninja2018! 159 | 192.109.110.51:12345:ninjabet:Ninja2018! 160 | 196.196.160.45:12345:ninjabet:Ninja2018! 161 | 196.196.160.216:12345:ninjabet:Ninja2018! 162 | 196.196.160.127:12345:ninjabet:Ninja2018! 163 | 192.109.110.225:12345:ninjabet:Ninja2018! 164 | 196.196.164.18:12345:ninjabet:Ninja2018! 165 | 196.196.160.218:12345:ninjabet:Ninja2018! 166 | 196.196.164.186:12345:ninjabet:Ninja2018! 167 | 196.196.164.92:12345:ninjabet:Ninja2018! 168 | 165.231.225.90:12345:ninjabet:Ninja2018! 169 | 192.109.110.136:12345:ninjabet:Ninja2018! 170 | 192.109.110.169:12345:ninjabet:Ninja2018! 171 | 192.109.110.13:12345:ninjabet:Ninja2018! 172 | 196.196.164.82:12345:ninjabet:Ninja2018! 173 | 196.196.160.161:12345:ninjabet:Ninja2018! 174 | 192.109.110.53:12345:ninjabet:Ninja2018! 175 | 196.196.164.174:12345:ninjabet:Ninja2018! 176 | 192.109.110.164:12345:ninjabet:Ninja2018! 177 | 196.196.160.206:12345:ninjabet:Ninja2018! 178 | 165.231.225.155:12345:ninjabet:Ninja2018! 179 | 192.109.110.182:12345:ninjabet:Ninja2018! 180 | 196.196.160.114:12345:ninjabet:Ninja2018! 181 | 165.231.225.221:12345:ninjabet:Ninja2018! 182 | 192.109.110.44:12345:ninjabet:Ninja2018! 183 | 165.231.225.105:12345:ninjabet:Ninja2018! 184 | 196.196.160.118:12345:ninjabet:Ninja2018! 185 | 196.196.164.229:12345:ninjabet:Ninja2018! 186 | 192.109.110.6:12345:ninjabet:Ninja2018! 187 | 196.196.164.175:12345:ninjabet:Ninja2018! 188 | 192.109.110.26:12345:ninjabet:Ninja2018! 189 | 196.196.164.76:12345:ninjabet:Ninja2018! 190 | 192.109.110.71:12345:ninjabet:Ninja2018! 191 | 192.109.110.129:12345:ninjabet:Ninja2018! 192 | 196.196.164.250:12345:ninjabet:Ninja2018! 193 | 196.196.164.159:12345:ninjabet:Ninja2018! 194 | 165.231.225.244:12345:ninjabet:Ninja2018! 195 | 165.231.225.84:12345:ninjabet:Ninja2018! 196 | 196.196.164.2:12345:ninjabet:Ninja2018! 197 | 192.109.110.105:12345:ninjabet:Ninja2018! 198 | 196.196.164.103:12345:ninjabet:Ninja2018! 199 | 196.196.160.44:12345:ninjabet:Ninja2018! 200 | 165.231.225.136:12345:ninjabet:Ninja2018! 201 | 196.196.160.243:12345:ninjabet:Ninja2018! 202 | 196.196.164.172:12345:ninjabet:Ninja2018! 203 | 196.196.164.207:12345:ninjabet:Ninja2018! 204 | 192.109.110.198:12345:ninjabet:Ninja2018! 205 | 192.109.110.3:12345:ninjabet:Ninja2018! 206 | 192.109.110.46:12345:ninjabet:Ninja2018! 207 | 192.109.110.230:12345:ninjabet:Ninja2018! 208 | 192.109.110.94:12345:ninjabet:Ninja2018! 209 | 196.196.160.125:12345:ninjabet:Ninja2018! 210 | 196.196.164.252:12345:ninjabet:Ninja2018! 211 | 196.196.164.13:12345:ninjabet:Ninja2018! 212 | 196.196.164.34:12345:ninjabet:Ninja2018! 213 | 192.109.110.238:12345:ninjabet:Ninja2018! 214 | 196.196.160.191:12345:ninjabet:Ninja2018! 215 | 192.109.110.38:12345:ninjabet:Ninja2018! 216 | 196.196.160.120:12345:ninjabet:Ninja2018! 217 | 192.109.110.104:12345:ninjabet:Ninja2018! 218 | 165.231.225.42:12345:ninjabet:Ninja2018! 219 | 196.196.164.177:12345:ninjabet:Ninja2018! 220 | 192.109.110.128:12345:ninjabet:Ninja2018! 221 | 196.196.160.244:12345:ninjabet:Ninja2018! 222 | 196.196.164.209:12345:ninjabet:Ninja2018! 223 | 196.196.160.172:12345:ninjabet:Ninja2018! 224 | 192.109.110.9:12345:ninjabet:Ninja2018! 225 | 196.196.164.176:12345:ninjabet:Ninja2018! 226 | 196.196.164.131:12345:ninjabet:Ninja2018! 227 | 165.231.225.141:12345:ninjabet:Ninja2018! 228 | 192.109.110.139:12345:ninjabet:Ninja2018! 229 | 192.109.110.194:12345:ninjabet:Ninja2018! 230 | 192.109.110.187:12345:ninjabet:Ninja2018! 231 | 192.109.110.252:12345:ninjabet:Ninja2018! 232 | 165.231.225.82:12345:ninjabet:Ninja2018! 233 | 196.196.164.246:12345:ninjabet:Ninja2018! 234 | 165.231.225.254:12345:ninjabet:Ninja2018! 235 | 192.109.110.131:12345:ninjabet:Ninja2018! 236 | 192.109.110.24:12345:ninjabet:Ninja2018! 237 | 196.196.164.146:12345:ninjabet:Ninja2018! 238 | 196.196.160.251:12345:ninjabet:Ninja2018! 239 | 165.231.225.99:12345:ninjabet:Ninja2018! 240 | 196.196.160.48:12345:ninjabet:Ninja2018! 241 | 196.196.160.217:12345:ninjabet:Ninja2018! 242 | 196.196.160.56:12345:ninjabet:Ninja2018! 243 | 196.196.160.252:12345:ninjabet:Ninja2018! 244 | 165.231.225.64:12345:ninjabet:Ninja2018! 245 | 196.196.164.73:12345:ninjabet:Ninja2018! 246 | 192.109.110.43:12345:ninjabet:Ninja2018! 247 | 192.109.110.190:12345:ninjabet:Ninja2018! 248 | 192.109.110.12:12345:ninjabet:Ninja2018! 249 | 192.109.110.45:12345:ninjabet:Ninja2018! 250 | 196.196.164.27:12345:ninjabet:Ninja2018! 251 | 192.109.110.186:12345:ninjabet:Ninja2018! 252 | 196.196.164.112:12345:ninjabet:Ninja2018! 253 | 192.109.110.77:12345:ninjabet:Ninja2018! 254 | 196.196.160.12:12345:ninjabet:Ninja2018! 255 | 196.196.160.67:12345:ninjabet:Ninja2018! 256 | 196.196.160.176:12345:ninjabet:Ninja2018! 257 | 192.109.110.217:12345:ninjabet:Ninja2018! 258 | 196.196.160.13:12345:ninjabet:Ninja2018! 259 | 196.196.160.84:12345:ninjabet:Ninja2018! 260 | 196.196.164.254:12345:ninjabet:Ninja2018! 261 | 192.109.110.33:12345:ninjabet:Ninja2018! 262 | 196.196.160.100:12345:ninjabet:Ninja2018! 263 | 165.231.225.73:12345:ninjabet:Ninja2018! 264 | 165.231.225.67:12345:ninjabet:Ninja2018! 265 | 196.196.164.244:12345:ninjabet:Ninja2018! 266 | 196.196.160.27:12345:ninjabet:Ninja2018! 267 | 196.196.160.21:12345:ninjabet:Ninja2018! 268 | 192.109.110.218:12345:ninjabet:Ninja2018! 269 | 165.231.225.154:12345:ninjabet:Ninja2018! 270 | 196.196.164.91:12345:ninjabet:Ninja2018! 271 | 165.231.225.194:12345:ninjabet:Ninja2018! 272 | 196.196.160.108:12345:ninjabet:Ninja2018! 273 | 165.231.225.217:12345:ninjabet:Ninja2018! 274 | 165.231.225.13:12345:ninjabet:Ninja2018! 275 | 196.196.164.164:12345:ninjabet:Ninja2018! 276 | 192.109.110.203:12345:ninjabet:Ninja2018! 277 | 165.231.225.139:12345:ninjabet:Ninja2018! 278 | 192.109.110.246:12345:ninjabet:Ninja2018! 279 | 192.109.110.249:12345:ninjabet:Ninja2018! 280 | 196.196.164.242:12345:ninjabet:Ninja2018! 281 | 192.109.110.78:12345:ninjabet:Ninja2018! 282 | 196.196.164.81:12345:ninjabet:Ninja2018! 283 | 192.109.110.153:12345:ninjabet:Ninja2018! 284 | 192.109.110.173:12345:ninjabet:Ninja2018! 285 | 192.109.110.29:12345:ninjabet:Ninja2018! 286 | 165.231.225.130:12345:ninjabet:Ninja2018! 287 | 165.231.225.104:12345:ninjabet:Ninja2018! 288 | 196.196.160.187:12345:ninjabet:Ninja2018! 289 | 196.196.164.194:12345:ninjabet:Ninja2018! 290 | 196.196.160.167:12345:ninjabet:Ninja2018! 291 | 165.231.225.220:12345:ninjabet:Ninja2018! 292 | 165.231.225.148:12345:ninjabet:Ninja2018! 293 | 196.196.164.29:12345:ninjabet:Ninja2018! 294 | 196.196.160.166:12345:ninjabet:Ninja2018! 295 | 196.196.164.158:12345:ninjabet:Ninja2018! 296 | 196.196.160.87:12345:ninjabet:Ninja2018! 297 | 165.231.225.152:12345:ninjabet:Ninja2018! 298 | 192.109.110.126:12345:ninjabet:Ninja2018! 299 | 196.196.164.67:12345:ninjabet:Ninja2018! 300 | 196.196.160.196:12345:ninjabet:Ninja2018! 301 | 165.231.225.219:12345:ninjabet:Ninja2018! 302 | 196.196.160.117:12345:ninjabet:Ninja2018! 303 | 192.109.110.18:12345:ninjabet:Ninja2018! 304 | 165.231.225.131:12345:ninjabet:Ninja2018! 305 | 165.231.225.46:12345:ninjabet:Ninja2018! 306 | 165.231.225.27:12345:ninjabet:Ninja2018! 307 | 196.196.164.124:12345:ninjabet:Ninja2018! 308 | 165.231.225.49:12345:ninjabet:Ninja2018! 309 | 196.196.160.213:12345:ninjabet:Ninja2018! 310 | 192.109.110.35:12345:ninjabet:Ninja2018! 311 | 196.196.160.11:12345:ninjabet:Ninja2018! 312 | 196.196.164.107:12345:ninjabet:Ninja2018! 313 | 165.231.225.185:12345:ninjabet:Ninja2018! 314 | 196.196.160.137:12345:ninjabet:Ninja2018! 315 | 196.196.164.64:12345:ninjabet:Ninja2018! 316 | 165.231.225.63:12345:ninjabet:Ninja2018! 317 | 165.231.225.4:12345:ninjabet:Ninja2018! 318 | 165.231.225.19:12345:ninjabet:Ninja2018! 319 | 192.109.110.98:12345:ninjabet:Ninja2018! 320 | 192.109.110.54:12345:ninjabet:Ninja2018! 321 | 196.196.160.150:12345:ninjabet:Ninja2018! 322 | 196.196.164.22:12345:ninjabet:Ninja2018! 323 | 192.109.110.73:12345:ninjabet:Ninja2018! 324 | 165.231.225.234:12345:ninjabet:Ninja2018! 325 | 192.109.110.88:12345:ninjabet:Ninja2018! 326 | 165.231.225.44:12345:ninjabet:Ninja2018! 327 | 165.231.225.214:12345:ninjabet:Ninja2018! 328 | 196.196.164.184:12345:ninjabet:Ninja2018! 329 | 192.109.110.74:12345:ninjabet:Ninja2018! 330 | 192.109.110.107:12345:ninjabet:Ninja2018! 331 | 192.109.110.170:12345:ninjabet:Ninja2018! 332 | 196.196.164.143:12345:ninjabet:Ninja2018! 333 | 196.196.160.47:12345:ninjabet:Ninja2018! 334 | 192.109.110.134:12345:ninjabet:Ninja2018! 335 | 196.196.160.9:12345:ninjabet:Ninja2018! 336 | 192.109.110.251:12345:ninjabet:Ninja2018! 337 | 192.109.110.79:12345:ninjabet:Ninja2018! 338 | 196.196.164.179:12345:ninjabet:Ninja2018! 339 | 192.109.110.114:12345:ninjabet:Ninja2018! 340 | 192.109.110.57:12345:ninjabet:Ninja2018! 341 | 165.231.225.36:12345:ninjabet:Ninja2018! 342 | 196.196.164.33:12345:ninjabet:Ninja2018! 343 | 196.196.160.240:12345:ninjabet:Ninja2018! 344 | 165.231.225.58:12345:ninjabet:Ninja2018! 345 | 192.109.110.34:12345:ninjabet:Ninja2018! 346 | 196.196.160.50:12345:ninjabet:Ninja2018! 347 | 196.196.160.46:12345:ninjabet:Ninja2018! 348 | 196.196.160.200:12345:ninjabet:Ninja2018! 349 | 192.109.110.229:12345:ninjabet:Ninja2018! 350 | 196.196.164.93:12345:ninjabet:Ninja2018! 351 | 192.109.110.150:12345:ninjabet:Ninja2018! 352 | 192.109.110.180:12345:ninjabet:Ninja2018! 353 | 165.231.225.106:12345:ninjabet:Ninja2018! 354 | 192.109.110.231:12345:ninjabet:Ninja2018! 355 | 165.231.225.74:12345:ninjabet:Ninja2018! 356 | 165.231.225.134:12345:ninjabet:Ninja2018! 357 | 196.196.164.78:12345:ninjabet:Ninja2018! 358 | 192.109.110.84:12345:ninjabet:Ninja2018! 359 | 196.196.160.194:12345:ninjabet:Ninja2018! 360 | 192.109.110.162:12345:ninjabet:Ninja2018! 361 | 192.109.110.130:12345:ninjabet:Ninja2018! 362 | 196.196.160.5:12345:ninjabet:Ninja2018! 363 | 165.231.225.20:12345:ninjabet:Ninja2018! 364 | 165.231.225.166:12345:ninjabet:Ninja2018! 365 | 165.231.225.11:12345:ninjabet:Ninja2018! 366 | 196.196.160.237:12345:ninjabet:Ninja2018! 367 | 196.196.164.118:12345:ninjabet:Ninja2018! 368 | 165.231.225.247:12345:ninjabet:Ninja2018! 369 | 196.196.160.31:12345:ninjabet:Ninja2018! 370 | 165.231.225.129:12345:ninjabet:Ninja2018! 371 | 165.231.225.69:12345:ninjabet:Ninja2018! 372 | 165.231.225.118:12345:ninjabet:Ninja2018! 373 | 196.196.160.64:12345:ninjabet:Ninja2018! 374 | 192.109.110.109:12345:ninjabet:Ninja2018! 375 | 196.196.160.141:12345:ninjabet:Ninja2018! 376 | 165.231.225.93:12345:ninjabet:Ninja2018! 377 | 196.196.160.224:12345:ninjabet:Ninja2018! 378 | 196.196.160.16:12345:ninjabet:Ninja2018! 379 | 165.231.225.110:12345:ninjabet:Ninja2018! 380 | 192.109.110.65:12345:ninjabet:Ninja2018! 381 | 196.196.160.169:12345:ninjabet:Ninja2018! 382 | 165.231.225.177:12345:ninjabet:Ninja2018! 383 | 165.231.225.14:12345:ninjabet:Ninja2018! 384 | 196.196.160.35:12345:ninjabet:Ninja2018! 385 | 192.109.110.144:12345:ninjabet:Ninja2018! 386 | 196.196.164.153:12345:ninjabet:Ninja2018! 387 | 192.109.110.224:12345:ninjabet:Ninja2018! 388 | 192.109.110.95:12345:ninjabet:Ninja2018! 389 | 196.196.160.223:12345:ninjabet:Ninja2018! 390 | 165.231.225.78:12345:ninjabet:Ninja2018! 391 | 196.196.164.121:12345:ninjabet:Ninja2018! 392 | 165.231.225.76:12345:ninjabet:Ninja2018! 393 | 192.109.110.76:12345:ninjabet:Ninja2018! 394 | 196.196.164.163:12345:ninjabet:Ninja2018! 395 | 196.196.160.174:12345:ninjabet:Ninja2018! 396 | 196.196.160.26:12345:ninjabet:Ninja2018! 397 | 196.196.164.213:12345:ninjabet:Ninja2018! 398 | 196.196.164.57:12345:ninjabet:Ninja2018! 399 | 165.231.225.181:12345:ninjabet:Ninja2018! 400 | 196.196.164.200:12345:ninjabet:Ninja2018! 401 | 196.196.164.16:12345:ninjabet:Ninja2018! 402 | 196.196.164.31:12345:ninjabet:Ninja2018! 403 | 196.196.160.146:12345:ninjabet:Ninja2018! 404 | 192.109.110.14:12345:ninjabet:Ninja2018! 405 | 196.196.164.219:12345:ninjabet:Ninja2018! 406 | 192.109.110.87:12345:ninjabet:Ninja2018! 407 | 192.109.110.89:12345:ninjabet:Ninja2018! 408 | 196.196.160.39:12345:ninjabet:Ninja2018! 409 | 192.109.110.211:12345:ninjabet:Ninja2018! 410 | 196.196.164.151:12345:ninjabet:Ninja2018! 411 | 165.231.225.172:12345:ninjabet:Ninja2018! 412 | 196.196.164.180:12345:ninjabet:Ninja2018! 413 | 80.211.110.57:12345:ninjabet:Ninja2018! 414 | 196.196.160.149:12345:ninjabet:Ninja2018! 415 | 165.231.225.127:12345:ninjabet:Ninja2018! 416 | 192.109.110.22:12345:ninjabet:Ninja2018! 417 | 196.196.160.4:12345:ninjabet:Ninja2018! 418 | 196.196.164.170:12345:ninjabet:Ninja2018! 419 | 196.196.164.40:12345:ninjabet:Ninja2018! 420 | 192.109.110.112:12345:ninjabet:Ninja2018! 421 | 196.196.164.102:12345:ninjabet:Ninja2018! 422 | 196.196.160.179:12345:ninjabet:Ninja2018! 423 | 192.109.110.160:12345:ninjabet:Ninja2018! 424 | 196.196.164.187:12345:ninjabet:Ninja2018! 425 | 192.109.110.25:12345:ninjabet:Ninja2018! 426 | 192.109.110.47:12345:ninjabet:Ninja2018! 427 | 192.109.110.184:12345:ninjabet:Ninja2018! 428 | 192.109.110.52:12345:ninjabet:Ninja2018! 429 | 165.231.225.239:12345:ninjabet:Ninja2018! 430 | 165.231.225.207:12345:ninjabet:Ninja2018! 431 | 192.109.110.210:12345:ninjabet:Ninja2018! 432 | 165.231.225.135:12345:ninjabet:Ninja2018! 433 | 192.109.110.27:12345:ninjabet:Ninja2018! 434 | 165.231.225.184:12345:ninjabet:Ninja2018! 435 | 165.231.225.102:12345:ninjabet:Ninja2018! 436 | 192.109.110.161:12345:ninjabet:Ninja2018! 437 | 165.231.225.68:12345:ninjabet:Ninja2018! 438 | 165.231.225.126:12345:ninjabet:Ninja2018! 439 | 165.231.225.10:12345:ninjabet:Ninja2018! 440 | 196.196.164.142:12345:ninjabet:Ninja2018! 441 | 196.196.160.122:12345:ninjabet:Ninja2018! 442 | 192.109.110.240:12345:ninjabet:Ninja2018! 443 | 196.196.160.113:12345:ninjabet:Ninja2018! 444 | 196.196.164.88:12345:ninjabet:Ninja2018! 445 | 196.196.164.237:12345:ninjabet:Ninja2018! 446 | 196.196.160.164:12345:ninjabet:Ninja2018! 447 | 80.211.224.184:12345:ninjabet:Ninja2018! 448 | 165.231.225.218:12345:ninjabet:Ninja2018! 449 | 196.196.164.238:12345:ninjabet:Ninja2018! 450 | 196.196.164.161:12345:ninjabet:Ninja2018! 451 | 192.109.110.158:12345:ninjabet:Ninja2018! 452 | 196.196.164.241:12345:ninjabet:Ninja2018! 453 | 192.109.110.99:12345:ninjabet:Ninja2018! 454 | 192.109.110.175:12345:ninjabet:Ninja2018! 455 | 192.109.110.159:12345:ninjabet:Ninja2018! 456 | 196.196.160.165:12345:ninjabet:Ninja2018! 457 | 196.196.160.195:12345:ninjabet:Ninja2018! 458 | 196.196.160.88:12345:ninjabet:Ninja2018! 459 | 196.196.164.74:12345:ninjabet:Ninja2018! 460 | 192.109.110.243:12345:ninjabet:Ninja2018! 461 | 196.196.160.147:12345:ninjabet:Ninja2018! 462 | 192.109.110.146:12345:ninjabet:Ninja2018! 463 | 192.109.110.39:12345:ninjabet:Ninja2018! 464 | 196.196.160.210:12345:ninjabet:Ninja2018! 465 | 165.231.225.225:12345:ninjabet:Ninja2018! 466 | 196.196.160.212:12345:ninjabet:Ninja2018! 467 | 192.109.110.40:12345:ninjabet:Ninja2018! 468 | 165.231.225.89:12345:ninjabet:Ninja2018! 469 | 196.196.164.208:12345:ninjabet:Ninja2018! 470 | 192.109.110.19:12345:ninjabet:Ninja2018! 471 | 192.109.110.202:12345:ninjabet:Ninja2018! 472 | 165.231.225.48:12345:ninjabet:Ninja2018! 473 | 192.109.110.90:12345:ninjabet:Ninja2018! 474 | 196.196.164.69:12345:ninjabet:Ninja2018! 475 | 192.109.110.124:12345:ninjabet:Ninja2018! 476 | 165.231.225.61:12345:ninjabet:Ninja2018! 477 | 192.109.110.83:12345:ninjabet:Ninja2018! 478 | 192.109.110.253:12345:ninjabet:Ninja2018! 479 | 192.109.110.81:12345:ninjabet:Ninja2018! 480 | 196.196.160.131:12345:ninjabet:Ninja2018! 481 | 196.196.160.183:12345:ninjabet:Ninja2018! 482 | 165.231.225.137:12345:ninjabet:Ninja2018! 483 | 165.231.225.142:12345:ninjabet:Ninja2018! 484 | 192.109.110.119:12345:ninjabet:Ninja2018! 485 | 192.109.110.206:12345:ninjabet:Ninja2018! 486 | 165.231.225.243:12345:ninjabet:Ninja2018! 487 | 196.196.164.50:12345:ninjabet:Ninja2018! 488 | 192.109.110.138:12345:ninjabet:Ninja2018! 489 | 192.109.110.66:12345:ninjabet:Ninja2018! 490 | 196.196.160.8:12345:ninjabet:Ninja2018! 491 | 165.231.225.111:12345:ninjabet:Ninja2018! 492 | 196.196.164.94:12345:ninjabet:Ninja2018! 493 | 192.109.110.196:12345:ninjabet:Ninja2018! 494 | 192.109.110.69:12345:ninjabet:Ninja2018! 495 | 165.231.225.7:12345:ninjabet:Ninja2018! 496 | 192.109.110.232:12345:ninjabet:Ninja2018! 497 | 165.231.225.103:12345:ninjabet:Ninja2018! 498 | 196.196.164.168:12345:ninjabet:Ninja2018! 499 | 196.196.164.150:12345:ninjabet:Ninja2018! 500 | 196.196.160.24:12345:ninjabet:Ninja2018! -------------------------------------------------------------------------------- /helpers/BotBase.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import argparse 3 | import datetime 4 | import hashlib 5 | import itertools 6 | import os 7 | import random 8 | import re 9 | import orjson 10 | import sys 11 | import traceback 12 | import urllib 13 | from contextlib import closing 14 | import dateparser 15 | import mysql.connector 16 | import requests 17 | from bs4 import BeautifulSoup 18 | from unidecode import unidecode 19 | import pathos 20 | import multiprocessing 21 | from time import sleep,time 22 | import urllib3 23 | import operator 24 | import functools 25 | import math 26 | import pytz 27 | import gc 28 | from helpers.enums import * 29 | from fuzzywuzzy import fuzz 30 | import fcntl 31 | 32 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) 33 | class BotBase(object): 34 | def __init__(self,options): 35 | if options.sport is None: 36 | raise("Specify --sport parameter") 37 | 38 | for sprt in Sport: 39 | if sprt.name.lower() == options.sport.lower(): 40 | self.sprt = sprt.value 41 | print("#############",self.__class__.__name__) 42 | self.bot_data = {"region":"it","book_name":self.__class__.__name__} 43 | 44 | self.options = options 45 | self.s = requests.session() 46 | self.event_keys = {} 47 | self.competition_keys = {} 48 | self.pinterbet_events = {} 49 | self.pinterbet_competitions = {} 50 | 51 | self.odds_keys = {} 52 | self.init_proxies() 53 | self.init_useragents() 54 | self.init_book_data() 55 | self.set_running() 56 | 57 | self.threads = self.options.threads or 1 58 | self.blacklist_proxies = [] 59 | 60 | self.custom_headers = { 61 | "Accept": "*/*", 62 | "Accept-Encoding": "gzip, deflate, br", 63 | "Accept-Language": "en-US,en;q=0.8", 64 | "Connection": "keep-alive", 65 | "User-Agent":self.get_useragent(), 66 | } 67 | self.s=requests.session() 68 | self.data_directory = "/tmp/Db/"+self.bot_data["book_data"]["id"]+"/" 69 | if not os.path.exists(self.data_directory): 70 | os.makedirs(self.data_directory) 71 | 72 | def init_useragents(self): 73 | with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "user_agents.txt"), "r") as f: 74 | self.user_agents = [line.strip() for line in f.readlines()] 75 | 76 | def init_proxies(self): 77 | self.proxies = [] 78 | 79 | try: 80 | url = "http://api.buyproxies.org/?a=showProxies&pid=108979&key=15ee901de3c3b22ac319f3d6d74d5c36&port=12345" 81 | self.proxies = requests.get(url).text.strip().split("\n") 82 | if len(self.proxies) >10: 83 | with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "proxies.txt"), "w") as f: 84 | f.write("\n".join(self.proxies)) 85 | except Exception as e: 86 | exc_type, exc_obj, exc_tb = sys.exc_info() 87 | traceback.print_exception(exc_type, exc_obj, exc_tb) 88 | 89 | if len(self.proxies) <10: 90 | with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "proxies.txt"), "r") as f: 91 | self.proxies = [line.strip() for line in f.readlines()] 92 | 93 | with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "proxies_residential.txt"), "r") as f: 94 | self.proxies_residential = [line.strip() for line in f.readlines()] 95 | 96 | def get_db(self): 97 | db = mysql.connector.connect(user=self.options.username, password=self.options.password, database=self.options.database, host=self.options.host) 98 | db.autocommit = False 99 | 100 | return db 101 | 102 | def init_book_data(self): 103 | db = self.get_db() 104 | try: 105 | sql = "SELECT id, name FROM bookies WHERE name LIKE '{0}'".format(self.bot_data["book_name"].lower()) 106 | cur = db.cursor() 107 | cur.execute(sql) 108 | rows = cur.fetchall() 109 | cur.close() 110 | 111 | self.bot_data["book_data"] = { 112 | "id": str(rows[0][0]), 113 | "name": rows[0][1], 114 | } 115 | finally: 116 | db.close() 117 | 118 | def set_running(self): 119 | db = self.get_db() 120 | try: 121 | sql = "UPDATE bookies SET status=1, start_time=NOW() WHERE id={0}".format(self.bot_data["book_data"]["id"]) 122 | cur = db.cursor() 123 | cur.execute(sql) 124 | db.commit() 125 | cur.close() 126 | finally: 127 | db.close() 128 | 129 | def get_response(self, url, headers, proxy=None, use_residential_proxies=False, post_data=None, post_is_json=False,no_proxy=False, timeout=4, cookies=None, use_tor=False): 130 | if no_proxy is False: 131 | if use_tor: 132 | proxy = {"http":"socks5h://localhost:9050","https":"socks5h://localhost:9050"} 133 | elif use_residential_proxies: 134 | proxy = self.get_residential_proxy() 135 | else: 136 | proxy = self.get_proxy() 137 | 138 | elif no_proxy: 139 | proxy = None 140 | 141 | if self.options.noproxies: 142 | proxy = None 143 | elif self.options.usetor: 144 | proxy = {"http":"socks5h://localhost:9050","https":"socks5h://localhost:9050"} 145 | elif self.options.residentials: 146 | proxy = self.get_residential_proxy() 147 | 148 | response = None 149 | start = time() 150 | try: 151 | if post_data is None: 152 | response = self.s.get(url, headers=headers, proxies=proxy, cookies=cookies, verify=False, timeout=timeout) 153 | else: 154 | if not post_is_json: 155 | response = self.s.post(url, data=post_data, headers=headers, proxies=proxy, cookies=cookies, verify=False, timeout=timeout) 156 | else: 157 | response = self.s.post(url, json=post_data, headers=headers, proxies=proxy, cookies=cookies, verify=False, timeout=timeout) 158 | #if response.status_code in [400,403,401,405,406,407]: 159 | # raise Exception("error "+str(response.status_code)) 160 | 161 | except Exception as e: 162 | exc_type, exc_obj, exc_tb = sys.exc_info() 163 | #traceback.print_exception(exc_type, exc_obj, exc_tb) 164 | print(exc_obj) 165 | return response 166 | 167 | def get_empty_odds_dict(self): 168 | empty_odds = {'even': '','odd': '', 'no_penalty': '','penalty': '', 'sh_goal': '','sh_no_goal': '','fh_goal': '','fh_no_goal': '', 'team2_under_75': '', 'team1_over_35': '', 'team1_under_55': '', 'team1_under_35': '', 'team1_over_55': '', 'team1_under_75': '', 'team1_over_15': '', 'team2_under_55': '', 'team2_under_15': '', 'team2_under_35': '', 'team2_over_85': '', 'team1_under_85': '', 'team2_over_25': '', 'team1_over_85': '', 'team2_over_65': '', 'team2_over_05': '', 'team1_under_05': '', 'team1_over_65': '', 'team2_over_45': '', 'team1_over_45': '', 'team2_under_65': '', 'team1_under_25': '', 'team1_over_05': '', 'team2_under_25': '', 'team1_under_65': '', 'team2_under_45': '', 'team1_under_45': '', 'team1_over_25':'', 'team2_under_05': '', 'team2_under_85': '', 'team2_over_35': '', 'team2_over_15': '', 'team2_over_75': '', 'team2_over_55': '', 'team1_over_75': '', 'team1_under_15': '','sh_over_15': '', 'sh_under_35': '', 'sh_over_75': '', 'sh_over_25': '', 'sh_under_25': '', 'sh_under_55': '', 'sh_over_35': '', 'sh_over_45': '', 'sh_under_75': '', 'sh_under_65': '', 'sh_under_45': '', 'sh_under_85': '', 'sh_over_55': '', 'sh_over_85': '', 'sh_over_65': '', 'sh_under_05': '', 'sh_under_15': '', 'sh_over_05': '','sh_dc_home_draw': '','sh_dc_home_away': '','sh_dc_draw_away': '','fh_dc_home_draw': '','fh_dc_home_away': '','fh_dc_draw_away': '','dc_home_draw': '','dc_home_away': '','dc_draw_away': '', 'over_85': '', 'ht_ft_away_away': '', 'ht_ft_home_away': '', 'fh_over_35': '', 'ht_ft_draw_away': '', 'fh_away': '', 'fh_under_55': '', 'ht_ft_home_home': '', 'fh_over_75': '', 'fh_under_15': '', 'under_55': '', 'over_15': '', 'under_35': '', 'ht_ft_away_home': '', 'over_75': '', 'fh_over_05': '', 'fh_under_85': '', 'ht_ft_draw_home': '', 'ht_ft_away_draw': '', 'fh_home': '', 'fh_draw': '', 'sh_home': '', 'sh_draw': '', 'sh_away' : '', 'fh_under_65': '', 'fh_over_85': '', 'ht_ft_draw_draw': '', 'fh_under_25': '', 'over_45': '', 'under_85': '', 'under_05': '', 'over_05': '', 'fh_over_55': '', 'under_25': '', 'over_65': '', 'fh_over_15': '', 'home': '', 'fh_over_45': '', 'under_45': '', 'fh_under_75': '', 'goal': '', 'away': '', 'fh_under_35': '', 'over_35': '', 'under_75': '', 'ht_ft_home_draw': '', 'draw': '', 'under_15': '', 'fh_over_65': '', 'over_55': '', 'no_goal': '', 'fh_over_25': '', 'fh_under_45': '', 'over_25': '', 'fh_under_05': '', 'under_65': '', 'cs_00': '','cs_01': '','cs_02': '','cs_03': '','cs_04': '','cs_10': '','cs_11': '','cs_12': '','cs_13': '','cs_14': '','cs_20': '','cs_21': '','cs_22': '','cs_23': '','cs_24': '','cs_30': '','cs_31': '','cs_32': '','cs_33': '','cs_34': '','cs_40': '','cs_41': '','cs_42': '','cs_43': '','cs_44' : ''} 169 | return empty_odds 170 | 171 | def init_pinterbet_keys(self): 172 | self.pinterbet_competitions = {} 173 | db = self.get_db() 174 | try: 175 | sql = "select b.id,p.id from competitions b inner join competitions p on b.params=REPLACE(p.params,'|33','') where b.bookie_id = 27 and p.bookie_id = 33" 176 | cur = db.cursor() 177 | cur.execute(sql) 178 | rows = cur.fetchall() 179 | cur.close() 180 | 181 | for row in rows: 182 | self.pinterbet_competitions[row[0]] = row[1] 183 | 184 | except Exception: 185 | exc_type, exc_obj, exc_tb = sys.exc_info() 186 | traceback.print_exception(exc_type, exc_obj, exc_tb) 187 | finally: 188 | db.close() 189 | 190 | self.pinterbet_events = {} 191 | db = self.get_db() 192 | try: 193 | sql = "select b.id,p.id from events b inner join events p on b.event =p.event and b.open_date = p.open_date and b.betradar_id = p.betradar_id where b.bookie_id = 27 and p.bookie_id = 33" 194 | cur = db.cursor() 195 | cur.execute(sql) 196 | rows = cur.fetchall() 197 | cur.close() 198 | 199 | for row in rows: 200 | self.pinterbet_events[row[0]] = row[1] 201 | 202 | except Exception: 203 | exc_type, exc_obj, exc_tb = sys.exc_info() 204 | traceback.print_exception(exc_type, exc_obj, exc_tb) 205 | finally: 206 | db.close() 207 | 208 | def get_sql_file(self, file_type, book_id): 209 | try: 210 | latest_file = sorted([[os.path.join(i[0], j) for j in i[2] if file_type in j] for i in os.walk(self.data_directory)][0])[-1] 211 | if os.stat(latest_file).st_size > 20000: 212 | latest_file = os.path.join(self.data_directory, file_type+"_"+str(book_id)+"_"+str(int(time()*1000))+".sql") 213 | except Exception: 214 | latest_file = os.path.join(self.data_directory, file_type+"_"+str(book_id)+"_"+str(int(time()*1000))+".sql") 215 | 216 | return latest_file 217 | 218 | 219 | def commit_sql2(self,sql): 220 | sql_file = self.get_sql_file("save_data", self.bot_data["book_data"]["id"]) 221 | with open(sql_file, "a+") as myfile: 222 | myfile.write(sql) 223 | 224 | ''' 225 | db = self.get_db() 226 | try: 227 | cur = db.cursor() 228 | results = cur.execute(sql, multi=True) 229 | for result in results: 230 | pass 231 | db.commit() 232 | cur.close() 233 | except Exception as e: 234 | exc_type, exc_obj, exc_tb = sys.exc_info() 235 | traceback.print_exception(exc_type, exc_obj, exc_tb) 236 | finally: 237 | db.close() 238 | ''' 239 | 240 | def commit_sql(self,sql): 241 | db = self.get_db() 242 | try: 243 | cur = db.cursor() 244 | results = cur.execute(sql, multi=True) 245 | for result in results: 246 | pass 247 | db.commit() 248 | cur.close() 249 | except Exception as e: 250 | exc_type, exc_obj, exc_tb = sys.exc_info() 251 | traceback.print_exception(exc_type, exc_obj, exc_tb) 252 | finally: 253 | db.close() 254 | 255 | 256 | def save_data(self, data): 257 | try: 258 | region = "it" 259 | if data and "type" in data: 260 | odds_data = "" 261 | events_data = "" 262 | competitions_data = "" 263 | update_time = datetime.datetime.now(pytz.timezone('Europe/Rome')).strftime('%Y-%m-%d %H:%M:%S') 264 | if data["type"] == "odds_data": 265 | if str(data["bookie_id"]) == '27': 266 | self.init_pinterbet_keys() 267 | 268 | locked_odds = [] 269 | for bet_type, book_odds in data["odds"].items(): 270 | if not book_odds: 271 | continue 272 | if book_odds == "-": 273 | for s in Selection: 274 | if s.name == bet_type.upper(): 275 | locked_odds.append(s.value) 276 | continue 277 | try: 278 | book_odds = float(book_odds) 279 | if book_odds ==0: 280 | for s in Selection: 281 | if s.name == bet_type.upper(): 282 | locked_odds.append(s.value) 283 | continue 284 | except ValueError: 285 | continue 286 | 287 | market=-1 288 | selection = -1 289 | if bet_type == "home": 290 | market = Market.M_1X2.value 291 | selection = Selection.HOME.value 292 | if self.sprt != Sport.CALCIO.value: 293 | market = Market.M_12.value 294 | elif bet_type == "away": 295 | market = Market.M_1X2.value 296 | selection = Selection.AWAY.value 297 | if self.sprt != Sport.CALCIO.value: 298 | market = Market.M_12.value 299 | elif bet_type == "draw": 300 | market = Market.M_1X2.value 301 | selection = Selection.DRAW.value 302 | elif bet_type == "fh_home": 303 | market = Market.FH_1X2.value 304 | selection = Selection.FH_HOME.value 305 | elif bet_type == "fh_away": 306 | market = Market.FH_1X2.value 307 | selection = Selection.FH_AWAY.value 308 | elif bet_type == "fh_draw": 309 | market = Market.FH_1X2.value 310 | selection = Selection.FH_DRAW.value 311 | elif bet_type == "sh_home": 312 | market = Market.SH_1X2.value 313 | selection = Selection.SH_HOME.value 314 | elif bet_type == "sh_away": 315 | market = Market.SH_1X2.value 316 | selection = Selection.SH_AWAY.value 317 | elif bet_type == "sh_draw": 318 | market = Market.SH_1X2.value 319 | selection = Selection.SH_DRAW.value 320 | elif bet_type == "penalty": 321 | market = Market.PENALTY_NOPENALTY.value 322 | selection = Selection.PENALTY.value 323 | elif bet_type == "no_penalty": 324 | market = Market.PENALTY_NOPENALTY.value 325 | selection = Selection.NO_PENALTY.value 326 | elif bet_type == "even": 327 | market = Market.EVEN_ODD.value 328 | selection = Selection.EVEN.value 329 | elif bet_type == "odd": 330 | market = Market.EVEN_ODD.value 331 | selection = Selection.ODD.value 332 | elif bet_type == "goal": 333 | market = Market.GNG.value 334 | selection = Selection.GOAL.value 335 | elif bet_type == "no_goal": 336 | market = Market.GNG.value 337 | selection = Selection.NO_GOAL.value 338 | elif bet_type == "fh_goal": 339 | market = Market.FH_GNG.value 340 | selection = Selection.FH_GOAL.value 341 | elif bet_type == "fh_no_goal": 342 | market = Market.FH_GNG.value 343 | selection = Selection.FH_NO_GOAL.value 344 | elif bet_type == "sh_goal": 345 | market = Market.SH_GNG.value 346 | selection = Selection.SH_GOAL.value 347 | elif bet_type == "sh_no_goal": 348 | market = Market.SH_GNG.value 349 | selection = Selection.SH_NO_GOAL.value 350 | elif bet_type.startswith("dc_"): 351 | market = Market.DC.value 352 | elif bet_type.startswith("fh_dc_"): 353 | market = Market.FH_DC.value 354 | elif bet_type.startswith("sh_dc_"): 355 | market = Market.SH_DC.value 356 | elif bet_type.lower().startswith("under_") or bet_type.lower().startswith("over_"): 357 | market = Market.OVER_UNDER.value 358 | elif bet_type.lower().startswith("fh_under_") or bet_type.lower().startswith("fh_over_"): 359 | market = Market.FH_OVER_UNDER.value 360 | elif bet_type.lower().startswith("sh_under_") or bet_type.lower().startswith("sh_over_"): 361 | market = Market.SH_OVER_UNDER.value 362 | elif bet_type.lower().startswith("team1_under_") or bet_type.lower().startswith("team1_over_"): 363 | market = Market.TEAM1_OVER_UNDER.value 364 | elif bet_type.lower().startswith("team2_under_") or bet_type.lower().startswith("team2_over_"): 365 | market = Market.TEAM2_OVER_UNDER.value 366 | elif bet_type.lower().startswith("cs_"): 367 | market = Market.CORRECT_SCORE.value 368 | elif bet_type.lower().startswith("ht_ft_"): 369 | market = Market.HT_FT.value 370 | elif bet_type == "set1_home": 371 | market = Market.SET1_HH.value 372 | elif bet_type == "set1_away": 373 | market = Market.SET1_HH.value 374 | elif bet_type == "set2_home": 375 | market = Market.SET2_HH.value 376 | elif bet_type == "set2_away": 377 | market = Market.SET2_HH.value 378 | elif bet_type.lower().startswith("tb_under_") or bet_type.lower().startswith("tb_over_"): 379 | market = Market.TB_OU.value 380 | elif bet_type.lower().startswith("games_under_") or bet_type.lower().startswith("games_over_"): 381 | market = Market.GAMES_OU.value 382 | elif bet_type.lower().startswith("set1_games_under_") or bet_type.lower().startswith("set1_games_over_"): 383 | market = Market.SET1_GAMES_OU.value 384 | elif bet_type.lower().startswith("set2_games_under_") or bet_type.lower().startswith("set2_games_over_"): 385 | market = Market.SET2_GAMES_OU.value 386 | elif bet_type.lower().startswith("player1_games_under_") or bet_type.lower().startswith("player1_games_over_"): 387 | market = Market.PLAYER1_GAMES_OU.value 388 | elif bet_type.lower().startswith("player2_games_under_") or bet_type.lower().startswith("player2_games_over_"): 389 | market = Market.PLAYER2_GAMES_OU.value 390 | else: 391 | continue 392 | 393 | if market != -1 and selection == -1: 394 | for s in Selection: 395 | if s.name == bet_type.upper(): 396 | selection = s.value 397 | 398 | book_odds = float(book_odds) 399 | if selection == -1 or book_odds <1: 400 | continue 401 | 402 | if str(data["bookie_id"]) == '27': 403 | if data["event_id"] in self.pinterbet_events: 404 | odds_data += 'insert into bookie_odds (event_id,bookie_id,market_id,selection_id,odds,game_play,update_time,cycle) values({0},{1},{2},{3},{4},{5},NOW(),{6}) on duplicate key update odds={4},update_time=NOW(),cycle={6},hidden=0;'.format(self.pinterbet_events[data["event_id"]], "33", market, selection, book_odds,data["game_play"],self.start_time).replace("'NULL'","NULL") 405 | 406 | odds_data += 'insert into bookie_odds (event_id,bookie_id,market_id,selection_id,odds,game_play,update_time,cycle) values({0},{1},{2},{3},{4},{5},NOW(),{6}) on duplicate key update odds={4},update_time=NOW(),cycle={6},hidden=0;'.format(data["event_id"], data["bookie_id"], market, selection, book_odds,data["game_play"],self.start_time).replace("'NULL'","NULL") 407 | 408 | 409 | elif data["type"] == "events_data" and len(data["events"]) >0: 410 | if str(data["bookie_id"]) == '27': 411 | self.init_pinterbet_keys() 412 | 413 | for event in data["events"]: 414 | dat = datetime.datetime.strptime(event["open_date"], "%Y-%m-%d %H:%M:%S") 415 | if dat < datetime.datetime.now(): 416 | continue 417 | 418 | betradar_id = event["betradar_id"] 419 | if len(str(betradar_id)) <3 or betradar_id is None: 420 | betradar_id = "NULL" 421 | 422 | params = '{\\"event_id\\":\\"'+str(event["event_id"])+'\\",\\"params\\":\\"'+str(event["params"])+'\\"}' 423 | if str(data["bookie_id"]) == "27": 424 | params = '{\\"event_id\\":\\"'+str(event["event_id"])+'|33\\",\\"params\\":\\"'+str(event["params"])+'\\"}' 425 | if data["competition_id"] in self.pinterbet_competitions: 426 | if betradar_id is None or betradar_id == "NULL": 427 | events_data += 'insert into events (event,open_date,betradar_id,bookie_id,params,competition_id,update_time) values ("{0}","{1}",{2},{3},"{4}",{5},NOW()) on duplicate key update event="{0}",open_date="{1}",update_time=NOW(),params="{4}";'.format((event["home"]+" v "+event["away"]),event["open_date"],betradar_id,"33",params,self.pinterbet_competitions[data["competition_id"]]).replace('"NULL"','NULL') 428 | else: 429 | events_data += 'insert into events (event,open_date,betradar_id,bookie_id,params,competition_id,update_time) values ("{0}","{1}",{2},{3},"{4}",{5},NOW()) on duplicate key update event="{0}",open_date="{1}",betradar_id={2},update_time=NOW(),params="{4}";'.format((event["home"]+" v "+event["away"]),event["open_date"],betradar_id,"33",params,self.pinterbet_competitions[data["competition_id"]]).replace('"NULL"','NULL') 430 | if betradar_id is None or betradar_id == "NULL": 431 | events_data += 'insert into events (event,open_date,betradar_id,bookie_id,params,competition_id,update_time) values ("{0}","{1}",{2},{3},"{4}",{5},NOW()) on duplicate key update event="{0}",open_date="{1}",update_time=NOW(),params="{4}";'.format((event["home"]+" v "+event["away"]),event["open_date"],betradar_id,data["bookie_id"],params,data["competition_id"]).replace('"NULL"','NULL') 432 | else: 433 | events_data += 'insert into events (event,open_date,betradar_id,bookie_id,params,competition_id,update_time) values ("{0}","{1}",{2},{3},"{4}",{5},NOW()) on duplicate key update event="{0}",open_date="{1}",betradar_id={2},update_time=NOW(),params="{4}";'.format((event["home"]+" v "+event["away"]),event["open_date"],betradar_id,data["bookie_id"],params,data["competition_id"]).replace('"NULL"','NULL') 434 | 435 | if events_data: 436 | self.commit_sql(events_data) 437 | sleep(1) 438 | 439 | 440 | if "odds" in data["events"][0]: 441 | self.init_event_keys() 442 | if str(data["bookie_id"]) == "27": 443 | self.init_pinterbet_keys() 444 | 445 | for event in data["events"]: 446 | betradar_id = event["betradar_id"] 447 | if len(str(betradar_id))<3 or betradar_id is None: 448 | betradar_id = "NULL" 449 | 450 | game_play = 1 451 | if "game_play" in event: 452 | game_play = event["game_play"] 453 | 454 | event_id = None 455 | if "id" in event: 456 | event_id = event["id"] 457 | else: 458 | event_hash = hashlib.md5((event["home"]+" v "+event["away"]+str(data["competition_id"])+data["bookie_id"]).encode('utf-8')).hexdigest() 459 | if event_hash in self.event_keys: 460 | event_id = self.event_keys.get(event_hash,None) 461 | if event_id: 462 | dt = {"type": "odds_data","betradar_id":betradar_id,"event_id":event_id,"odds":event["odds"],"game_play":game_play,"bookie_id":data["bookie_id"]} 463 | self.save_data(dt) 464 | 465 | elif data["type"] == "competitions_data" and len(data["competitions"]) >0: 466 | 467 | for competition in data["competitions"]: 468 | if not max([c in competition["competition_name"].lower() or c in competition["country_name"].lower() for c in ["speciali","sanzioni","minuto 1° goal","calci d'angolo"]]): 469 | competitions_data += 'insert into competitions (competition,sport_id,country,bookie_id,params,update_time) values ("{0}",{1},"{2}",{3},"{4}",NOW()) on duplicate key update update_time=NOW();'.format((competition["competition_name"]),self.sprt,competition["country_name"],data["bookie_id"],(competition["params"])).replace('"NULL"','NULL') 470 | if str(data["bookie_id"]) == "27": 471 | competitions_data += 'insert into competitions (competition,sport_id,country,bookie_id,params,update_time) values ("{0}",{1},"{2}",{3},"{4}",NOW()) on duplicate key update update_time=NOW();'.format((competition["competition_name"]),self.sprt,competition["country_name"],"33",(competition["params"]+"|33")).replace('"NULL"','NULL') 472 | 473 | if competitions_data and odds_data: 474 | self.commit_sql(competitions_data+odds_data) 475 | else: 476 | if competitions_data: 477 | self.commit_sql(competitions_data) 478 | elif odds_data: 479 | self.commit_sql(odds_data) 480 | 481 | if str(self.bot_data["book_data"]["id"]) == "2" and competitions_data and "events" in data["competitions"][0]: 482 | self.init_competition_keys() 483 | for competition in data["competitions"]: 484 | competition_hash = hashlib.md5((competition["competition_name"]+str(self.bot_data["book_data"]["id"])+str(self.sprt)+competition["country_name"]).encode('utf-8')).hexdigest() 485 | if len(competition["events"]) and competition_hash in self.competition_keys: 486 | competition_id = self.competition_keys[competition_hash] 487 | events_data = {"type": "events_data","events":competition["events"],"competition_id":competition_id,"bookie_id":self.bot_data["book_data"]["id"]} 488 | self.save_data(events_data) 489 | 490 | except Exception as e: 491 | exc_type, exc_obj, exc_tb = sys.exc_info() 492 | traceback.print_exception(exc_type, exc_obj, exc_tb) 493 | 494 | def get_proxy(self): 495 | random_proxy = random.choice(self.proxies) 496 | ip,port,username,password = random_proxy.split(":") 497 | url_proxy = "http://{2}:{3}@{0}:{1}".format(ip,port,username,password) 498 | url_proxy = "http://{0}:{1}".format(ip,port,username,password) 499 | return {"http":url_proxy, "https":url_proxy} 500 | #return {"http":url_proxy} 501 | 502 | def get_residential_proxy(self): 503 | #return self.get_proxy() 504 | random_proxy = random.choice(self.proxies_residential) 505 | return {"http":"http://" + random_proxy, "https":"http://" + random_proxy} 506 | #return {"http":"http://ninjabet:ninja2020@it.smartproxy.com:20000", "https":"http://ninjabet:ninja2020@it.smartproxy.com:20000"} 507 | 508 | def get_useragent(self): 509 | return random.choice(self.user_agents) 510 | 511 | def get_chunks(self,all_data,size): 512 | new_stack = [] 513 | end = len(all_data) 514 | length = int(end/size) 515 | if end-size= 60 or self.sprt == Sport.CALCIO.value and (time() - self.start_time2) >= 600: 529 | self.start_time2 = int(time()) 530 | all_competitions = self.get_leagues(self.sprt) 531 | 532 | if(len(all_competitions) > 0): 533 | data = {"type": "competitions_data","competitions":all_competitions,"bookie_id":self.bot_data["book_data"]["id"]} 534 | self.save_data(data) 535 | 536 | for competition in all_competitions: 537 | try: 538 | if not max([c in competition["competition_name"].lower() or c in competition["country_name"].lower() for c in ["speciali","sanzioni","minuto 1° goal","calci d'angolo"]]): 539 | if "events" in competition and "competition_id" in competition: 540 | self.start_time2=0 541 | bookie_id = self.bot_data["book_data"]["id"] 542 | events_data = {"type": "events_data","events":competition["events"],"competition_id":competition["competition_id"],"bookie_id":bookie_id} 543 | self.save_data(events_data) 544 | got_events = True 545 | except Exception: 546 | exc_type, exc_obj, exc_tb = sys.exc_info() 547 | traceback.print_exception(exc_type, exc_obj, exc_tb) 548 | 549 | else: 550 | self.start_time2 = 0 551 | 552 | if got_events is False: 553 | all_competitions = self.get_saved_competitions() 554 | for competition in all_competitions: 555 | try: 556 | if "events" not in competition and (not max([c in competition["competition_name"].lower() or c in competition["country_name"].lower() for c in ["speciali","sanzioni","minuto 1° goal","calci d'angolo"]])): 557 | self.process_leagues_v2(competition) 558 | except Exception: 559 | exc_type, exc_obj, exc_tb = sys.exc_info() 560 | traceback.print_exception(exc_type, exc_obj, exc_tb) 561 | 562 | sys.stdout.flush() 563 | sys.stderr.flush() 564 | gc.collect() 565 | sleep(2) 566 | except Exception: 567 | exc_type, exc_obj, exc_tb = sys.exc_info() 568 | traceback.print_exception(exc_type, exc_obj, exc_tb) 569 | 570 | def process_leagues_v2(self,competition): 571 | try: 572 | if "params" in competition and competition["params"] != None and competition["params"] != "NULL": 573 | events = self.get_league_events(competition["params"]) 574 | 575 | if events and len(events)>0: 576 | bookie_id = self.bot_data["book_data"]["id"] 577 | data = {"type": "events_data","events":events,"competition_id":competition["competition_id"],"bookie_id":bookie_id} 578 | self.save_data(data) 579 | 580 | except Exception: 581 | exc_type, exc_obj, exc_tb = sys.exc_info() 582 | traceback.print_exception(exc_type, exc_obj, exc_tb) 583 | 584 | def process_events(self,event): 585 | try: 586 | event_odds = self.get_event_odds(event["params"]) 587 | all_book_odds = event_odds["odds"] 588 | game_play = event_odds["game_play"] 589 | 590 | if all_book_odds: 591 | bookie_id = self.bot_data["book_data"]["id"] 592 | data = {"type": "odds_data","event_id":event["id"],"odds":all_book_odds,"game_play":game_play,"bookie_id":bookie_id} 593 | self.save_data(data) 594 | except Exception: 595 | exc_type, exc_obj, exc_tb = sys.exc_info() 596 | traceback.print_exception(exc_type, exc_obj, exc_tb) 597 | 598 | def get_matched_bookie_events(self): 599 | all_events = [] 600 | db = self.get_db() 601 | try: 602 | sql = "select e.id,e.params,md5(CONCAT(e.event,e.competition_id,e.bookie_id)) from events as e inner join competitions as c on c.id=e.competition_id where e.bookie_id={0} and c.sport_id={1} and e.open_date>NOW()".format(self.bot_data["book_data"]["id"],self.sprt) 603 | cur = db.cursor() 604 | cur.execute(sql) 605 | rows = cur.fetchall() 606 | cur.close() 607 | 608 | for row in rows: 609 | try: 610 | param = orjson.loads(row[1].replace("'",'"')) 611 | if "params" not in param or param["params"] == None or param["params"] == "NULL": 612 | continue 613 | all_events.append({"id":row[0],"params":param["params"]}) 614 | self.event_keys[row[2]] = row[0] 615 | except Exception: 616 | pass 617 | except Exception: 618 | exc_type, exc_obj, exc_tb = sys.exc_info() 619 | traceback.print_exception(exc_type, exc_obj, exc_tb) 620 | finally: 621 | db.close() 622 | 623 | return all_events 624 | 625 | def get_saved_competitions(self): 626 | self.competition_keys = {} 627 | all_competitions = [] 628 | db = self.get_db() 629 | try: 630 | sql = "select id,competition,bookie_id,sport_id,country,params from competitions where bookie_id={0} and sport_id={1} and TIMESTAMPDIFF(HOUR,update_time,NOW()) < 4 ".format(self.bot_data["book_data"]["id"],self.sprt) 631 | cur = db.cursor() 632 | cur.execute(sql) 633 | rows = cur.fetchall() 634 | cur.close() 635 | if len(rows) == 0: 636 | sql = "select id,competition,bookie_id,sport_id,country,params from competitions where bookie_id={0} and sport_id={1} ".format(self.bot_data["book_data"]["id"],self.sprt) 637 | cur = db.cursor() 638 | cur.execute(sql) 639 | rows = cur.fetchall() 640 | cur.close() 641 | 642 | for row in rows: 643 | if row[4] != None and row[4] != "NULL": 644 | all_competitions.append({"params":row[5],"country_name":row[4],"competition_name":row[1],"competition_id":row[0]}) 645 | competition_hash = hashlib.md5((row[1]+str(row[2])+str(row[3])+str(row[4]).replace("None","NULL")).encode('utf-8')).hexdigest() 646 | self.competition_keys[competition_hash] = row[0] 647 | 648 | except Exception: 649 | exc_type, exc_obj, exc_tb = sys.exc_info() 650 | traceback.print_exception(exc_type, exc_obj, exc_tb) 651 | finally: 652 | db.close() 653 | 654 | return all_competitions 655 | 656 | def init_competition_keys(self): 657 | self.competition_keys = {} 658 | db = self.get_db() 659 | try: 660 | 661 | sql = "select id,competition,bookie_id,sport_id,country from competitions where bookie_id={0} and sport_id={1}".format(self.bot_data["book_data"]["id"],self.sprt) 662 | cur = db.cursor() 663 | cur.execute(sql) 664 | rows = cur.fetchall() 665 | cur.close() 666 | 667 | for row in rows: 668 | competition_hash = hashlib.md5((row[1]+str(row[2])+str(row[3])+str(row[4]).replace("None","NULL")).encode('utf-8')).hexdigest() 669 | self.competition_keys[competition_hash] = row[0] 670 | finally: 671 | db.close() 672 | 673 | def init_event_keys(self): 674 | self.event_keys = {} 675 | db = self.get_db() 676 | try: 677 | 678 | sql = "select e.id,e.event,e.competition_id,e.bookie_id from events as e where e.bookie_id={0}".format(self.bot_data["book_data"]["id"]) 679 | cur = db.cursor() 680 | cur.execute(sql) 681 | rows = cur.fetchall() 682 | cur.close() 683 | 684 | for row in rows: 685 | event_hash = hashlib.md5((row[1]+str(row[2])+str(row[3])).encode('utf-8')).hexdigest() 686 | self.event_keys[event_hash] = row[0] 687 | finally: 688 | db.close() 689 | 690 | def hide_old_odds(self): 691 | sql = "update bookie_odds set hidden = 1 \ 692 | where bookie_id = {0} \ 693 | and cycle in ( \ 694 | select * from ( \ 695 | select cycle \ 696 | from bookie_odds \ 697 | where bookie_id = {1} \ 698 | and event_id in (select id from events where competition_id in (select id from competitions where sport_id = 1)) \ 699 | group by cycle order by cycle desc limit 100 offset 2 \ 700 | ) a)".format(self.bot_data["book_data"]["id"],self.sprt) 701 | self.commit_sql(sql) 702 | 703 | def run2(self): 704 | all_leagues = [] 705 | while 1: 706 | try: 707 | all_leagues = self.get_saved_competitions() 708 | if len(all_leagues) == 0: 709 | sleep(10) 710 | continue 711 | 712 | if all_leagues: 713 | self.s = requests.session() 714 | self.start_time = int(time()) 715 | 716 | if self.threads==1: 717 | for league in all_leagues: 718 | self.process_leagues_v2(league) 719 | else: 720 | try: 721 | with closing(pathos.multiprocessing.Pool(processes=self.threads)) as p: 722 | results = p.map_async(self.process_leagues_v2, all_leagues).get(timeout=1200) 723 | p.terminate() 724 | except KeyboardInterrupt: 725 | p.terminate() 726 | p.join() 727 | sys.exit() 728 | 729 | #self.hide_old_odds() 730 | 731 | sys.stdout.flush() 732 | sys.stderr.flush() 733 | gc.collect() 734 | except Exception: 735 | exc_type, exc_obj, exc_tb = sys.exc_info() 736 | traceback.print_exception(exc_type, exc_obj, exc_tb) 737 | 738 | 739 | sleep(2) 740 | 741 | def run(self): 742 | self.start_time = int(time()) 743 | events_thread = multiprocessing.Process(target=self.process_leagues) 744 | events_thread.start() 745 | 746 | sleep(20) 747 | if "get_event_odds" in dir(self): 748 | while 1: 749 | try: 750 | all_events = self.get_matched_bookie_events() 751 | if len(all_events) == 0: 752 | self.run2() 753 | sleep(10) 754 | continue 755 | 756 | if all_events: 757 | self.s = requests.session() 758 | self.start_time = int(time()) 759 | if self.threads==1: 760 | for event in all_events: 761 | self.process_events(event) 762 | else: 763 | try: 764 | with closing(pathos.multiprocessing.Pool(processes=self.threads)) as p: 765 | results = p.map_async(self.process_events, all_events).get(timeout=1200) 766 | p.terminate() 767 | except KeyboardInterrupt: 768 | p.terminate() 769 | p.join() 770 | sys.exit() 771 | 772 | #self.hide_old_odds() 773 | 774 | sys.stdout.flush() 775 | sys.stderr.flush() 776 | gc.collect() 777 | except Exception: 778 | exc_type, exc_obj, exc_tb = sys.exc_info() 779 | traceback.print_exception(exc_type, exc_obj, exc_tb) 780 | 781 | sleep(2) 782 | else: 783 | self.run2() 784 | 785 | sys.stdout.flush() 786 | sys.stderr.flush() 787 | gc.collect() 788 | print("cycle complete") 789 | sleep(1) 790 | 791 | 792 | 793 | -------------------------------------------------------------------------------- /Bet365.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import datetime 3 | import pytz 4 | import re 5 | import sys 6 | import traceback 7 | from contextlib import closing 8 | from time import sleep, time 9 | import requests 10 | from bs4 import BeautifulSoup 11 | from pathos import multiprocessing 12 | import hashlib 13 | import dateparser 14 | import urllib 15 | import math 16 | from decimal import Decimal 17 | import os 18 | from helpers.enums import * 19 | from helpers.BotBase import BotBase 20 | 21 | 22 | class Bet365(BotBase): 23 | def __init__(self,options): 24 | BotBase.__init__(self,options) 25 | self.config_url = "https://www.bet365.it/defaultapi/sports-configuration?_h=LXvWHr75NcwwAdQxN9vmaQ==" 26 | self.num = 0 27 | self.custom_headers.update({"referer":"https://www.bet365.it/"}) 28 | 29 | def decrypt_odd(self,msg, TK): 30 | key = ord(TK[0]) ^ ord(TK[1]) 31 | value = '' 32 | for char in msg: 33 | value += chr(ord(char) ^ key) 34 | numerator, denominator = value.split("/") 35 | return float(math.floor((Decimal(numerator) / Decimal(denominator) + 1) * 100)) / 100 36 | 37 | def get_response(self, url, headers, proxy=None, use_residential_proxies=False, post_data=None, post_is_json=False,no_proxy=False, timeout=5, cookies=None, use_tor=False): 38 | if no_proxy is False: 39 | if not proxy and use_residential_proxies is False and len(self.blacklist_proxies) < len(self.proxies) * 0.5: 40 | proxy = self.get_proxy() 41 | while proxy in self.blacklist_proxies: 42 | proxy = self.get_proxy() 43 | 44 | if use_tor: 45 | proxy = {"http":"socks5h://localhost:9050","https":"socks5h://localhost:9050"} 46 | elif use_residential_proxies: 47 | proxy = self.get_residential_proxy() 48 | 49 | elif no_proxy: 50 | proxy = None 51 | 52 | if self.options.noproxies: 53 | proxy = None 54 | elif self.options.usetor: 55 | proxy = {"http":"socks5h://localhost:9050","https":"socks5h://localhost:9050"} 56 | elif self.options.residentials: 57 | proxy = self.get_residential_proxy() 58 | 59 | response = None 60 | start = time() 61 | try: 62 | if post_data is None: 63 | response = self.s.get(url, headers=headers, proxies=proxy, cookies=cookies, verify=False, allow_redirects=True, timeout=timeout) 64 | else: 65 | if not post_is_json: 66 | response = self.s.post(url, data=post_data, headers=headers, proxies=proxy, cookies=cookies, verify=False, allow_redirects=True, timeout=timeout) 67 | else: 68 | response = self.s.post(url, json=post_data, headers=headers, proxies=proxy, cookies=cookies, verify=False, allow_redirects=True, timeout=timeout) 69 | #if response.status_code in [400,403,401,405,406,407]: 70 | # raise Exception("error "+str(response.status_code)) 71 | 72 | except Exception as e: 73 | exc_type, exc_obj, exc_tb = sys.exc_info() 74 | #traceback.print_exception(exc_type, exc_obj, exc_tb) 75 | #if proxy not in self.blacklist_proxies and not use_residential_proxies and str(e) in ["error 400","error 403","error 401","error 405","error 406","error 407"]: 76 | # self.blacklist_proxies.append(proxy) 77 | 78 | return response 79 | 80 | def get_sync_token(self): 81 | with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "sync_token.txt"), "r") as f: 82 | return f.read().strip() 83 | 84 | def get_leagues(self,sprt): 85 | all_leagues = {} 86 | sport_codes = {Sport.CALCIO.value:"B1",Sport.TENNIS.value:"B13",Sport.BASKET.value:"B18",Sport.TENNISTAVOLO.value:"B92",Sport.ESPORTS.value:"B151"} 87 | try: 88 | 89 | if self.s.cookies.get("pstk") is None: 90 | url = "https://www.bet365.it/" 91 | init_page_request = self.get_response(url, self.custom_headers, cookies={"aps03":"cf=N&cg=0&cst=0&ct=97&hd=N&lng=6&tzi=4","rmbs":"3"}) 92 | config_url = init_page_request.headers["Link"].split(";")[0].replace("<","").replace(">","") 93 | if "configuration" in config_url: 94 | self.config_url = "https://www.bet365.it"+config_url 95 | init_page_request = self.get_response(self.config_url, self.custom_headers, cookies={"aps03":"cf=N&cg=0&cst=0&ct=97&hd=N&lng=6&tzi=4","rmbs":"3"}, use_residential_proxies = True) 96 | 97 | 98 | if self.s.cookies.get("pstk"): 99 | self.custom_headers.update({"X-Net-Sync-Term": self.get_sync_token()}) 100 | if sprt == Sport.CALCIO.value: 101 | #all_leagues = [{"params":"#AC#B1#C1#D1002#E64212005#G40#H^1#","country_name":"Europa","competition_name":"Qualificazioni Coppa del Mondo"}] 102 | url = "https://www.bet365.it/SportsBook.API/web?lid=6&zid=0&pd=%23AS%23B1%23&cid=97&cgid=4&ctid=97" 103 | main_page_request = self.get_response(url, self.custom_headers, use_residential_proxies = True) 104 | 105 | if main_page_request: 106 | for league in re.findall("\|PA;NA=([^;]+);PD=([^;]+);IT=[^;]+;FF=;", main_page_request.content.decode().replace("\r", "").replace("\n", "")): 107 | country_name = competition_name = league[0] 108 | 109 | if len(competition_name.split(" - ")) == 2: 110 | country_name,competition_name = [c.strip() for c in competition_name.split(" - ")] 111 | all_leagues["#AC"+league[1]] = {"params":"#AC"+league[1],"country_name":country_name,"competition_name":competition_name} 112 | elif "UEFA" in competition_name: 113 | all_leagues["#AC"+league[1]] = {"params":"#AC"+league[1],"country_name":country_name,"competition_name":competition_name} 114 | 115 | 116 | for country in re.findall("\|MA;PD=([^;]+);IT=[^;]+;SY=sm;PY=spa;NA=([^;]+);", main_page_request.content.decode().replace("\r", "").replace("\n", "")): 117 | if "UEFA" not in country[1].upper() and country[1] not in ["Popolari","Partite tra nazionali","Calcio Virtuale","Asiatiche","Cartellini","Calci d’angolo","Goal","1°/2° Tempo","Giocatore","Speciali","Minuti"]: 118 | country_name = country[1] 119 | 120 | url = "https://www.bet365.it/SportsBook.API/web?lid=6&zid=0&pd="+urllib.parse.quote_plus(country[0])+"&cid=97&cgid=4&ctid=97" 121 | country_request = self.get_response(url, self.custom_headers, use_residential_proxies = True) 122 | if country_request: 123 | for league in re.findall("\|PA;NA=([^;]+);PD=([^;]+);IT=[^;]+;FF=;", country_request.content.decode().replace("\r", "").replace("\n", "")): 124 | competition_name = league[0] 125 | if len(competition_name.split(" - ")) == 2: 126 | country_name,competition_name = [c.strip() for c in competition_name.split(" - ")] 127 | if "UEFA" in competition_name.upper() or "UEFA" in country_name.upper() or "Elenco" in country_name or "Elenco" in competition_name: 128 | continue 129 | 130 | all_leagues["#AC"+league[1]] = {"params":"#AC"+league[1],"country_name":country_name,"competition_name":competition_name} 131 | 132 | elif sprt == Sport.BASKET.value: 133 | url = "https://www.bet365.it/SportsBook.API/web?lid=6&zid=0&pd=%23AS%23"+sport_codes[sprt]+"%23&cid=97&ctid=97" 134 | main_page_request = self.get_response(url, self.custom_headers, use_residential_proxies = True) 135 | if main_page_request: 136 | for league in re.findall("\|MG;NA=([^;]+);DO=[^;]+;PD=([^;]+);", main_page_request.content.decode().replace("\r", "").replace("\n", "")): 137 | competition_name = league[0].strip() 138 | country_name = "" 139 | if len(competition_name.split(" - ")) == 2: 140 | country_name,competition_name = [c.strip() for c in competition_name.split(" - ")] 141 | if "Elenco" in country_name or "Elenco" in competition_name or "D48#E1453#F10#" not in league[1][3:-3]: 142 | continue 143 | all_leagues["#AC"+league[1][3:-3]] = {"params":"#AC"+league[1][3:-3],"country_name":country_name,"competition_name":competition_name} 144 | 145 | elif sprt in [Sport.TENNIS.value]:#,Sport.TENNISTAVOLO.value]: 146 | url = "https://www.bet365.it/SportsBook.API/web?lid=6&zid=0&pd=%23AC%23"+sport_codes[sprt]+"%23C1%23D50%23E2%23F163%23&cid=97&ctid=97" 147 | main_page_request = self.get_response(url, self.custom_headers, use_residential_proxies = True) 148 | if main_page_request: 149 | resp = main_page_request.content.decode().replace("\r", "").replace("\n", "") 150 | tk = re.search(r"TK=([^;]*);", resp).group(1)[:2] 151 | 152 | league_container = [] 153 | for section1 in resp.split("|MG;ID="): 154 | 155 | section = re.search(";NA=([^;]+);SY=fh;IA=1;DO=1;",section1) 156 | if section is None: 157 | continue 158 | 159 | section = section.group(1) 160 | competition_name = section.split(" - ")[0].strip() 161 | 162 | country_name = "" 163 | 164 | if "Elenco" in country_name or "Elenco" in competition_name: 165 | continue 166 | 167 | if country_name+competition_name in league_container: 168 | continue 169 | 170 | league_container.append(country_name+competition_name) 171 | all_events = [] 172 | for event in re.findall("\|PA;ID=[^;]+;NA=([^;]+);N2=([^;]+);FD=([^;]+);FI=([^;]+);BC=([^;]+);LI=[^;]+;(.*?)\|PA;",section1): 173 | home = event[0] 174 | away = event[1] 175 | name = event[2] 176 | event_id = event[3] 177 | hour_diff = int(datetime.datetime.now(pytz.timezone('Europe/Rome')).utcoffset().total_seconds()/3600) 178 | open_date = (datetime.datetime.strptime(event[4].strip(), '%Y%m%d%H%M%S') + datetime.timedelta(hours=hour_diff)).strftime('%Y-%m-%d %H:%M:%S') 179 | dat = datetime.datetime.strptime(open_date, "%Y-%m-%d %H:%M:%S") 180 | 181 | 182 | if " @ " in name: 183 | away,home = name.split(" @ ") 184 | betradar_id = "NULL" 185 | try: 186 | betradar_id = re.search(".*match/(\d+)~Bet365Stats.*", event[4]).group(1) 187 | except Exception: 188 | pass 189 | 190 | event_hash = hashlib.md5((home + away + str(event_id)).encode('utf-8')).hexdigest() 191 | 192 | event_odds = re.findall("FI={0};OD=([^;]+);".format(event_id), resp) 193 | 194 | print(name,open_date,event_odds) 195 | if len(event_odds) == 2: 196 | all_book_odds = self.get_empty_odds_dict() 197 | if " @ " in name: 198 | all_book_odds["home"] = self.decrypt_odd(event_odds[1], tk) 199 | all_book_odds["away"] = self.decrypt_odd(event_odds[0], tk) 200 | else: 201 | all_book_odds["home"] = self.decrypt_odd(event_odds[0], tk) 202 | all_book_odds["away"] = self.decrypt_odd(event_odds[1], tk) 203 | event_data = {"event_id":event_hash,"open_date":open_date,"home":home,"away":away,"betradar_id":betradar_id,"params":"NULL","odds":all_book_odds} 204 | all_events.append(event_data) 205 | 206 | #print(country_name,competition_name,name,open_date,all_book_odds["home"],all_book_odds["away"]) 207 | all_leagues["bet365-"+str(self.sprt)+"-"+country_name+"-"+competition_name] = {"country_name":country_name,"competition_name":competition_name,"events":all_events,"params":"bet365-"+str(self.sprt)+"-"+country_name+"-"+competition_name} 208 | 209 | 210 | 211 | except Exception: 212 | exc_type, exc_obj, exc_tb = sys.exc_info() 213 | traceback.print_exception(exc_type, exc_obj, exc_tb) 214 | print(list(all_leagues.values())) 215 | return list(all_leagues.values()) 216 | 217 | def get_event_odds(self,event_params): 218 | event_url,home,away = event_params.split(":") 219 | all_book_odds = self.get_empty_odds_dict() 220 | try: 221 | self.custom_headers.update({"X-Net-Sync-Term": self.get_sync_token()}) 222 | self.num = self.num+1 223 | if self.num >6: 224 | self.s=requests.session() 225 | self.num=0 226 | 227 | if self.s.cookies.get("pstk") is None: 228 | url = "https://www.bet365.it/" 229 | init_page_request = self.get_response(url, self.custom_headers, cookies={"aps03":"cf=N&cg=0&cst=0&ct=97&hd=N&lng=6&tzi=4","rmbs":"3"}) 230 | config_url = init_page_request.headers["Link"].split(";")[0].replace("<","").replace(">","") 231 | if "configuration" in config_url: 232 | self.config_url = "https://www.bet365.it"+config_url 233 | init_page_request = self.get_response(self.config_url, self.custom_headers, cookies={"aps03":"cf=N&cg=0&cst=0&ct=97&hd=N&lng=6&tzi=4","rmbs":"3"}, use_residential_proxies = True) 234 | 235 | if self.s.cookies.get("pstk"): 236 | for x in [1, 6]:#[1, 6, 7]: 237 | try: 238 | url = "https://www.bet365.it/SportsBook.API/web?lid=6&zid=0&pd={0}&cid=97&ctid=97".format(urllib.parse.quote_plus(re.sub("#F3.*$", "#F3#H0#I"+str(x)+"#R1", event_url))) 239 | event_page_request = self.get_response(url, self.custom_headers, use_residential_proxies = True) 240 | if event_page_request: 241 | event_page_content = event_page_request.content.decode().replace("\r", "").replace("\n", "") 242 | 243 | event_tk = re.search(r"TK=([^;]*);", event_page_content) 244 | if not event_tk: 245 | event_tk = "BB" 246 | else: 247 | event_tk = event_tk.group(1)[:2] 248 | 249 | section_search = re.search(".*(NA=Risultato finale;.*?MG;)", event_page_content) 250 | if section_search: 251 | section = section_search.group(1) 252 | odds = re.findall("OD=([^;]+);", section) 253 | if len(odds) == 3: 254 | all_book_odds["home"] = self.decrypt_odd(odds[0], event_tk) 255 | all_book_odds["draw"] = self.decrypt_odd(odds[1], event_tk) 256 | all_book_odds["away"] = self.decrypt_odd(odds[2], event_tk) 257 | 258 | uo_25_section_search = re.search("NA=(Goal: under/over;.*?NA=2\.5.*?MG;)", event_page_content) 259 | if uo_25_section_search: 260 | uo_25_section = uo_25_section_search.group(1) 261 | uo_25_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);", uo_25_section) 262 | if uo_25_odds: 263 | all_book_odds["under_25"] = self.decrypt_odd(uo_25_odds[1], event_tk) 264 | all_book_odds["over_25"] = self.decrypt_odd(uo_25_odds[0], event_tk) 265 | 266 | other_uo_section_search = re.search("(NA=Totale goal aggiuntivo;.*?MG;)", event_page_content) 267 | if other_uo_section_search: 268 | other_uo_section = other_uo_section_search.group(1) 269 | 270 | uo_names = re.findall("PA;ID=(?:[^;])+;NA=\d\.5;\|", other_uo_section) 271 | 272 | under_odds = [] 273 | under_section_search = re.search("(NA=Meno di;.*?\|M)", other_uo_section) 274 | if under_section_search: 275 | under_section = under_section_search.group(1) 276 | under_odds = re.findall("PA;ID=(?:[^;])+;OD=(?:[^;])+;\|", under_section) 277 | 278 | over_odds = [] 279 | over_section_search = re.search("(NA=Più di;.*?\|M)", other_uo_section) 280 | if over_section_search: 281 | over_section = over_section_search.group(1) 282 | over_odds = re.findall("PA;ID=(?:[^;])+;OD=(?:[^;])+;\|", over_section) 283 | 284 | if len(uo_names) == len(under_odds) and len(uo_names) == len(over_odds): 285 | for uo_name, under_odd, over_odd in zip(uo_names, under_odds, over_odds): 286 | nm = re.search("NA=(\d.5)", uo_name).group(1).replace(".", "") 287 | under = re.search("OD=([^;]+);", under_odd).group(1) 288 | over = re.search("OD=([^;]+);", over_odd).group(1) 289 | all_book_odds["under_{0}".format(nm)] = self.decrypt_odd(under, event_tk) 290 | all_book_odds["over_{0}".format(nm)] = self.decrypt_odd(over, event_tk) 291 | 292 | other_uo_section_search = re.search(".*(NA=Goal nel 1° tempo;.*?MG;)", event_page_content) 293 | if other_uo_section_search: 294 | other_uo_section = other_uo_section_search.group(1) 295 | 296 | uo_names = re.findall("PA;ID=(?:[^;])+;NA=\d\.5;\|", other_uo_section) 297 | 298 | under_odds = [] 299 | under_section_search = re.search("(NA=Meno di;.*?\|M)", other_uo_section) 300 | if under_section_search: 301 | under_section = under_section_search.group(1) 302 | under_odds = re.findall("PA;ID=(?:[^;])+;OD=(?:[^;])+;\|", under_section) 303 | 304 | over_odds = [] 305 | over_section_search = re.search("(NA=Più di;.*?\|M)", other_uo_section) 306 | if over_section_search: 307 | over_section = over_section_search.group(1) 308 | over_odds = re.findall("PA;ID=(?:[^;])+;OD=(?:[^;])+;\|", over_section) 309 | 310 | if len(uo_names) == len(under_odds) and len(uo_names) == len(over_odds): 311 | for uo_name, under_odd, over_odd in zip(uo_names, under_odds, over_odds): 312 | nm = re.search("NA=(\d.5)", uo_name).group(1).replace(".", "") 313 | under = re.search("OD=([^;]+);", under_odd).group(1) 314 | over = re.search("OD=([^;]+);", over_odd).group(1) 315 | all_book_odds["fh_under_{0}".format(nm)] = self.decrypt_odd(under, event_tk) 316 | all_book_odds["fh_over_{0}".format(nm)] = self.decrypt_odd(over, event_tk) 317 | 318 | other_uo_section_search = re.search(".*(NA=Goal 2° tempo;.*?MG;)", event_page_content) 319 | if other_uo_section_search: 320 | other_uo_section = other_uo_section_search.group(1) 321 | 322 | uo_names = re.findall("PA;ID=(?:[^;])+;NA=\d\.5;\|", other_uo_section) 323 | 324 | under_odds = [] 325 | under_section_search = re.search("(NA=Meno di;.*?\|M)", other_uo_section) 326 | if under_section_search: 327 | under_section = under_section_search.group(1) 328 | under_odds = re.findall("PA;ID=(?:[^;])+;OD=(?:[^;])+;\|", under_section) 329 | 330 | over_odds = [] 331 | over_section_search = re.search("(NA=Più di;.*?\|M)", other_uo_section) 332 | if over_section_search: 333 | over_section = over_section_search.group(1) 334 | over_odds = re.findall("PA;ID=(?:[^;])+;OD=(?:[^;])+;\|", over_section) 335 | 336 | if len(uo_names) == len(under_odds) and len(uo_names) == len(over_odds): 337 | for uo_name, under_odd, over_odd in zip(uo_names, under_odds, over_odds): 338 | nm = re.search("NA=(\d.5)", uo_name).group(1).replace(".", "") 339 | under = re.search("OD=([^;]+);", under_odd).group(1) 340 | over = re.search("OD=([^;]+);", over_odd).group(1) 341 | all_book_odds["sh_under_{0}".format(nm)] = self.decrypt_odd(under, event_tk) 342 | all_book_odds["sh_over_{0}".format(nm)] = self.decrypt_odd(over, event_tk) 343 | 344 | ggng_section_search = re.search("(NA=Entrambe le squadre segnano;.*?MG;)", event_page_content) 345 | if ggng_section_search: 346 | ggng_section = ggng_section_search.group(1) 347 | gg_odds = re.findall("PA;ID=(?:[^;])+;NA=Sì ;OD=([^;]+);\|", ggng_section) 348 | 349 | if gg_odds: 350 | all_book_odds["goal"] = self.decrypt_odd(gg_odds[0], event_tk) 351 | ng_odds = re.findall("PA;ID=(?:[^;])+;NA=No ;OD=([^;]+);\|", ggng_section) 352 | if ng_odds: 353 | all_book_odds["no_goal"] = self.decrypt_odd(ng_odds[0], event_tk) 354 | 355 | uo_section_search = re.search(".*(NA=Totale goal squadra;.*?MG;)", event_page_content) 356 | if uo_section_search: 357 | uo_section = uo_section_search.group(1) 358 | uo_05_odds = re.findall("PA;[^(PA)]*-1;NA=.*OD=([^;]+?);SU=0;HA=0\.5;\|", uo_section) 359 | if uo_05_odds: 360 | all_book_odds["team1_under_05"] = self.decrypt_odd(uo_05_odds[1], event_tk) 361 | all_book_odds["team1_over_05"] = self.decrypt_odd(uo_05_odds[0], event_tk) 362 | uo_15_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=1\.5;\|", uo_section) 363 | if uo_15_odds: 364 | all_book_odds["team1_under_15"] = self.decrypt_odd(uo_15_odds[1], event_tk) 365 | all_book_odds["team1_over_15"] = self.decrypt_odd(uo_15_odds[0], event_tk) 366 | uo_25_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=2\.5;\|", uo_section) 367 | if uo_25_odds: 368 | all_book_odds["team1_under_25"] = self.decrypt_odd(uo_25_odds[1], event_tk) 369 | all_book_odds["team1_over_25"] = self.decrypt_odd(uo_25_odds[0], event_tk) 370 | uo_35_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=3\.5;\|", uo_section) 371 | if uo_35_odds: 372 | all_book_odds["team1_under_35"] = self.decrypt_odd(uo_35_odds[1], event_tk) 373 | all_book_odds["team1_over_35"] = self.decrypt_odd(uo_35_odds[0], event_tk) 374 | uo_45_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=4\.5;\|", uo_section) 375 | if uo_45_odds: 376 | all_book_odds["team1_under_45"] = self.decrypt_odd(uo_45_odds[1], event_tk) 377 | all_book_odds["team1_over_45"] = self.decrypt_odd(uo_45_odds[0], event_tk) 378 | uo_55_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=5\.5;\|", uo_section) 379 | if uo_55_odds: 380 | all_book_odds["team1_under_55"] = self.decrypt_odd(uo_55_odds[1], event_tk) 381 | all_book_odds["team1_over_55"] = self.decrypt_odd(uo_55_odds[0], event_tk) 382 | uo_65_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=6\.5;\|", uo_section) 383 | if uo_65_odds: 384 | all_book_odds["team1_under_65"] = self.decrypt_odd(uo_65_odds[1], event_tk) 385 | all_book_odds["team1_over_65"] = self.decrypt_odd(uo_65_odds[0], event_tk) 386 | 387 | uo_05_odds = re.findall("PA;.*-2;NA=.*OD=([^;]+?);SU=0;HA=0\.5;\|", uo_section) 388 | if uo_05_odds: 389 | all_book_odds["team2_under_05"] = self.decrypt_odd(uo_05_odds[1], event_tk) 390 | all_book_odds["team2_over_05"] = self.decrypt_odd(uo_05_odds[0], event_tk) 391 | uo_15_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=1\.5;\|", uo_section) 392 | if uo_15_odds: 393 | all_book_odds["team2_under_15"] = self.decrypt_odd(uo_15_odds[1], event_tk) 394 | all_book_odds["team2_over_15"] = self.decrypt_odd(uo_15_odds[0], event_tk) 395 | uo_25_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=2\.5;\|", uo_section) 396 | if uo_25_odds: 397 | all_book_odds["team2_under_25"] = self.decrypt_odd(uo_25_odds[1], event_tk) 398 | all_book_odds["team2_over_25"] = self.decrypt_odd(uo_25_odds[0], event_tk) 399 | uo_35_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=3\.5;\|", uo_section) 400 | if uo_35_odds: 401 | all_book_odds["team2_under_35"] = self.decrypt_odd(uo_35_odds[1], event_tk) 402 | all_book_odds["team2_over_35"] = self.decrypt_odd(uo_35_odds[0], event_tk) 403 | uo_45_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=4\.5;\|", uo_section) 404 | if uo_45_odds: 405 | all_book_odds["team2_under_45"] = self.decrypt_odd(uo_45_odds[1], event_tk) 406 | all_book_odds["team2_over_45"] = self.decrypt_odd(uo_45_odds[0], event_tk) 407 | uo_55_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=5\.5;\|", uo_section) 408 | if uo_55_odds: 409 | all_book_odds["team2_under_55"] = self.decrypt_odd(uo_55_odds[1], event_tk) 410 | all_book_odds["team2_over_55"] = self.decrypt_odd(uo_55_odds[0], event_tk) 411 | uo_65_odds = re.findall("PA;[^(PA)]*?OD=([^;]+?);SU=0;HA=6\.5;\|", uo_section) 412 | if uo_65_odds: 413 | all_book_odds["team2_under_65"] = self.decrypt_odd(uo_65_odds[1], event_tk) 414 | all_book_odds["team2_over_65"] = self.decrypt_odd(uo_65_odds[0], event_tk) 415 | 416 | 417 | # section_search = re.search(".*(NA=Risultato alla fine del 1° tempo;.*?MG;)", event_page_content) 418 | # if section_search: 419 | # section = section_search.group(1) 420 | # odds = re.findall("PA;[^(PA)]*?NA="+home+";OD=([^;]+?);.*?;\|", section) 421 | # if odds: 422 | # all_book_odds["fh_home"] = self.decrypt_odd(odds[0], event_tk) 423 | # odds = re.findall("PA;[^(PA)]*?NA=Pareggio;OD=([^;]+?);.*?;\|", section) 424 | # if odds: 425 | # all_book_odds["fh_draw"] = self.decrypt_odd(odds[0], event_tk) 426 | # odds = re.findall("PA;[^(PA)]*?NA="+away+";OD=([^;]+?);.*?;\|", section) 427 | # if odds: 428 | # all_book_odds["fh_away"] = self.decrypt_odd(odds[0], event_tk) 429 | 430 | # section_search = re.search(".*(NA=Risultato 2° tempo;.*?MG;)", event_page_content) 431 | # if section_search: 432 | # section = section_search.group(1) 433 | # odds = re.findall("PA;[^(PA)]*?NA="+home+";OD=([^;]+?);.*?;\|", section) 434 | # if odds: 435 | # all_book_odds["sh_home"] = self.decrypt_odd(odds[0], event_tk) 436 | # odds = re.findall("PA;[^(PA)]*?NA=Pareggio;OD=([^;]+?);.*?;\|", section) 437 | # if odds: 438 | # all_book_odds["sh_draw"] = self.decrypt_odd(odds[0], event_tk) 439 | # odds = re.findall("PA;[^(PA)]*?NA="+away+";OD=([^;]+?);.*?;\|", section) 440 | # if odds: 441 | # all_book_odds["sh_away"] = self.decrypt_odd(odds[0], event_tk) 442 | ''' 443 | section_search = re.search(".*NA=Risultato 2° tempo;PD=([^;]+);", event_page_content) 444 | if section_search: 445 | pd_section = section_search.group(1) 446 | try: 447 | url2 = "https://www.bet365.it/SportsBook.API/web?cid=97&ctid=97&lid=6&pd={0}&zid=0".format(urllib.parse.quote_plus(pd_section)) 448 | event_page_request2 = self.get_response(url2, self.custom_headers, proxy=proxy, cookies=init_page_request.cookies) 449 | if event_page_request2: 450 | event_page_content2 = event_page_request2.content.replace("\r", "").replace("\n", "") 451 | odds = re.findall("NA="+home+";OD=([^;]+);.*", event_page_content2) 452 | if odds: 453 | all_book_odds["sh_home"] = Fraction(odds[0]) 454 | odds = re.findall("NA=Pareggio;OD=([^;]+);.*", event_page_content2) 455 | if odds: 456 | all_book_odds["sh_draw"] = Fraction(odds[0]) 457 | odds = re.findall("NA="+away+";OD=([^;]+);.*", event_page_content2) 458 | if odds: 459 | all_book_odds["sh_away"] = Fraction(odds[0]) 460 | except: 461 | pass 462 | ''' 463 | dc_section_search = re.search("(NA=Doppia chance;.*?MG;)", event_page_content) 464 | if dc_section_search: 465 | dc_section = dc_section_search.group(1) 466 | dc_odds = re.findall("PA;[^(PA)]*?NA=[^;]+?;N2=1X;OD=([^;]+?);\|", dc_section) 467 | if dc_odds: 468 | all_book_odds["dc_home_draw"] = self.decrypt_odd(dc_odds[0], event_tk) 469 | 470 | dc_odds = re.findall("PA;[^(PA)]*?NA=[^;]+?;N2=12;OD=([^;]+?);\|", dc_section) 471 | if dc_odds: 472 | all_book_odds["dc_home_away"] = self.decrypt_odd(dc_odds[0], event_tk) 473 | 474 | dc_odds = re.findall("PA;[^(PA)]*?NA=[^;]+?;N2=X2;OD=([^;]+?);\|", dc_section) 475 | if dc_odds: 476 | all_book_odds["dc_draw_away"] = self.decrypt_odd(dc_odds[0], event_tk) 477 | 478 | # dc_section_search = re.search(".*(NA=Doppia chance 1° tempo;.*?MG;)", event_page_content) 479 | # if dc_section_search: 480 | # dc_section = dc_section_search.group(1) 481 | # dc_odds = re.findall("PA;[^(PA)]*?NA="+home+" o pareggio;OD=([^;]+?);.*?;\|", dc_section) 482 | # if dc_odds: 483 | # all_book_odds["fh_dc_home_draw"] = self.decrypt_odd(dc_odds[0], event_tk) 484 | 485 | # dc_odds = re.findall("PA;[^(PA)]*?NA="+home+" o "+away+";OD=([^;]+?);.*?;\|", dc_section) 486 | # if dc_odds: 487 | # all_book_odds["fh_dc_home_away"] = self.decrypt_odd(dc_odds[0], event_tk) 488 | 489 | # dc_odds = re.findall("PA;[^(PA)]*?NA="+away+" o pareggio;OD=([^;]+?);.*?;\|", dc_section) 490 | # if dc_odds: 491 | # all_book_odds["fh_dc_draw_away"] = self.decrypt_odd(dc_odds[0], event_tk) 492 | ''' 493 | dc_section_search = re.search(".*(NA=Doppia Chance 2° Tempo;.*?MG;)", event_page_content) 494 | if dc_section_search: 495 | dc_section = dc_section_search.group(1) 496 | dc_odds = re.findall("PA;[^(PA)]*?NA="+home+" o pareggio;OD=([^;]+?);.*?;\|", dc_section) 497 | if dc_odds: 498 | all_book_odds["sh_dc_home_draw"] = self.decrypt_odd(dc_odds[0], event_tk) 499 | 500 | dc_odds = re.findall("PA;[^(PA)]*?NA="+home+" o "+away+";OD=([^;]+?);.*?;\|", dc_section) 501 | if dc_odds: 502 | all_book_odds["sh_dc_home_away"] = self.decrypt_odd(dc_odds[0], event_tk) 503 | 504 | dc_odds = re.findall("PA;[^(PA)]*?NA="+away+" o pareggio;OD=([^;]+?);.*?;\|", dc_section) 505 | if dc_odds: 506 | all_book_odds["sh_dc_draw_away"] = self.decrypt_odd(dc_odds[0], event_tk) 507 | ''' 508 | 509 | section_search = re.search(".*(NA=Goal: pari/dispari;.*?MG;)", event_page_content) 510 | if section_search: 511 | section = section_search.group(1) 512 | odds = re.findall("PA;[^(PA)]*?NA=Dispari;OD=([^;]+?);.*?;\|", section) 513 | if odds: 514 | all_book_odds["odd"] = self.decrypt_odd(odds[0], event_tk) 515 | odds = re.findall("PA;[^(PA)]*?NA=Pari;OD=([^;]+?);.*?;\|", section) 516 | if odds: 517 | all_book_odds["even"] = self.decrypt_odd(odds[0], event_tk) 518 | 519 | ggng_section_search = re.search(".*(NA=Entrambe le squadre segnano nel 1° tempo;.*?MG;)", event_page_content) 520 | if ggng_section_search: 521 | ggng_section = ggng_section_search.group(1) 522 | gg_odds = re.findall("PA;[^(PA)]*?NA=Sì ;OD=([^;]+?);.*?;\|", ggng_section) 523 | if gg_odds: 524 | all_book_odds["fh_goal"] = self.decrypt_odd(gg_odds[0], event_tk) 525 | ng_odds = re.findall("PA;[^(PA)]*?NA=No ;OD=([^;]+?);.*?;\|", ggng_section) 526 | if ng_odds: 527 | all_book_odds["fh_no_goal"] = self.decrypt_odd(ng_odds[0], event_tk) 528 | 529 | ggng_section_search = re.search(".*(NA=Entrambe le squadre segnano nel 2° tempo;.*?MG;)", event_page_content) 530 | if ggng_section_search: 531 | ggng_section = ggng_section_search.group(1) 532 | gg_odds = re.findall("PA;[^(PA)]*?NA=Sì ;OD=([^;]+?);.*?;\|", ggng_section) 533 | if gg_odds: 534 | all_book_odds["sh_goal"] = self.decrypt_odd(gg_odds[0], event_tk) 535 | ng_odds = re.findall("PA;[^(PA)]*?NA=No ;OD=([^;]+?);.*?;\|", ggng_section) 536 | if ng_odds: 537 | all_book_odds["sh_no_goal"] = self.decrypt_odd(ng_odds[0], event_tk) 538 | 539 | # cs_section_search = re.search(".*(NA=Risultato esatto;.*?MG;)", event_page_content) 540 | # if cs_section_search: 541 | # cs_section = cs_section_search.group(1) 542 | # for y in range(0,5): 543 | # for z in range(0,5): 544 | # cs_odds = re.findall(";NA="+str(y)+"-"+str(z)+";OD=([^;]+?);.*?;\|", cs_section) 545 | # if cs_odds: 546 | # all_book_odds["cs_"+str(y)+str(z)] = self.decrypt_odd(cs_odds[0], event_tk) 547 | except Exception: 548 | exc_type, exc_obj, exc_tb = sys.exc_info() 549 | traceback.print_exception(exc_type, exc_obj, exc_tb) 550 | except Exception: 551 | exc_type, exc_obj, exc_tb = sys.exc_info() 552 | traceback.print_exception(exc_type, exc_obj, exc_tb) 553 | 554 | return {"odds":all_book_odds,"game_play":"1"} 555 | 556 | def get_league_request(self, league): 557 | try: 558 | self.custom_headers.update({"X-Net-Sync-Term": self.get_sync_token()}) 559 | if self.s.cookies.get("pstk") is None: 560 | url = "https://www.bet365.it/defaultapi/sports-configuration?_h=rjewx2b5XJf0UGGo2YgHhg==" 561 | init_page_request = self.get_response(url, self.custom_headers, cookies={"aps03":"ct=97&lng=6"}, use_residential_proxies = True) 562 | 563 | if self.s.cookies.get("pstk"): 564 | url = "https://www.bet365.it/SportsBook.API/web?lid=6&zid=0&pd={0}&cid=97&ctid=97".format(urllib.parse.quote_plus(league)) 565 | league_page_request = self.get_response(url, self.custom_headers, use_residential_proxies = True) 566 | if league_page_request: 567 | return league_page_request.content 568 | except Exception: 569 | exc_type, exc_obj, exc_tb = sys.exc_info() 570 | traceback.print_exception(exc_type, exc_obj, exc_tb) 571 | 572 | return None 573 | 574 | def get_league_events(self, league): 575 | all_events = [] 576 | try: 577 | league_response = self.get_league_request(league) 578 | if league_response: 579 | if "invalid url" not in league_response.decode(): 580 | lresp = league_response.decode().replace("\r", "").replace("\n", "") 581 | league_tk = re.search(r"TK=([^;]*);", league_response.decode()) 582 | if not league_tk: 583 | league_tk = "BB" 584 | else: 585 | league_tk = league_tk.group(1)[:2] 586 | 587 | events = [event for event in re.findall("(?<=PA;)[^|]+NA=[^;]+?;.*?FI=[^;]+?;.*?BC=[^;]+?;.*?PD=[^;]+?;.*?;\|(?=PA|MA)", league_response.decode().replace("\r", "").replace("\n", "")) if "SU=1" not in event] 588 | 589 | x=0 590 | for event in events: 591 | american = False 592 | event_info = re.search(".*NA=([^;]+?);.*?FI=([^;]+?);.*?BC=([^;]+?);.*?PD=([^;]+?);.*?;\|", event) 593 | event_id = event_info.group(2) 594 | dt = event_info.group(3) 595 | 596 | x=x+1 597 | name = event_info.group(1) 598 | try: 599 | home, away = [team.strip() for team in event_info.group(1).split(" v ")] 600 | except Exception: 601 | if self.sprt == Sport.BASKET.value: 602 | teams = re.search(".*NA=([^;]+?);.*?N2=([^;]+?);CU=;ED=;FD=([^;]+?);.*?;\|", event) 603 | if teams is None: 604 | continue 605 | home = teams.group(1).strip() 606 | away = teams.group(2).strip() 607 | name = teams.group(3).strip() 608 | if " @ " in name: 609 | away,home = name.split(" @ ") 610 | elif "NT=Campo neutro;" in event: 611 | away,home = name.split(" v ") 612 | else: 613 | teams = re.search(".*NA=([^;]+?);.*?N2=([^;]+?);.*?;\|", event) 614 | home = teams.group(1).strip() 615 | away = teams.group(2).strip() 616 | 617 | open_date = ((datetime.datetime.strptime(dt, '%Y%m%d%H%M%S')) + datetime.timedelta(hours=1)).strftime('%Y-%m-%d %H:%M:%S') 618 | 619 | event_url = event_info.group(4) 620 | 621 | betradar_id = "NULL" 622 | try: 623 | betradar_id = re.search(".*match/(\d+)~Bet365Stats.*", event).group(1) 624 | except Exception: 625 | pass 626 | 627 | event_data = {"event_id":event_id,"open_date":open_date,"home":home,"away":away,"betradar_id":betradar_id,"params":event_url+":"+home+":"+away} 628 | if self.sprt != Sport.CALCIO.value: 629 | if self.sprt == Sport.BASKET.value: 630 | event_id = str(int(event_id)+1) 631 | 632 | event_odds = re.findall("FI={0};OD=([^;]+);".format(event_id), league_response.decode().replace("\r", "").replace("\n", "")) 633 | all_book_odds = self.get_empty_odds_dict() 634 | if len(event_odds) == 2: 635 | if "NT=Campo neutro;" in event: 636 | all_book_odds["away"] = self.decrypt_odd(event_odds[0], league_tk) 637 | all_book_odds["home"] = self.decrypt_odd(event_odds[1], league_tk) 638 | away,home = name.split(" v ") 639 | 640 | event_data.update({"home":home,"away":away}) 641 | elif " @ " in name: 642 | all_book_odds["away"] = self.decrypt_odd(event_odds[0], league_tk) 643 | all_book_odds["home"] = self.decrypt_odd(event_odds[1], league_tk) 644 | away,home = name.split(" @ ") 645 | 646 | event_data.update({"home":home,"away":away}) 647 | else: 648 | all_book_odds["home"] = self.decrypt_odd(event_odds[0], league_tk) 649 | all_book_odds["away"] = self.decrypt_odd(event_odds[1], league_tk) 650 | 651 | 652 | event_data.update({"params":"NULL","odds":all_book_odds}) 653 | else: 654 | event_odds = re.findall("FI={0};OD=([^;]+);".format(event_id), league_response.decode().replace("\r", "").replace("\n", "")) 655 | all_book_odds = self.get_empty_odds_dict() 656 | if len(event_odds) == 3: 657 | all_book_odds["home"] = self.decrypt_odd(event_odds[0], league_tk) 658 | all_book_odds["away"] = self.decrypt_odd(event_odds[2], league_tk) 659 | all_book_odds["draw"] = self.decrypt_odd(event_odds[1], league_tk) 660 | 661 | event_data.update({"odds":all_book_odds}) 662 | 663 | #print(name,home+" v "+away,all_book_odds["home"],all_book_odds["away"]) 664 | all_events.append(event_data) 665 | 666 | except Exception: 667 | exc_type, exc_obj, exc_tb = sys.exc_info() 668 | traceback.print_exception(exc_type, exc_obj, exc_tb) 669 | 670 | return all_events 671 | 672 | 673 | 674 | --------------------------------------------------------------------------------