Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, re
- from time import sleep as wait
- import pymysql.cursors
- import datetime
- connection = pymysql.connect(host='localhost',
- user='root',
- password='',
- db='job-cash',
- charset='utf8mb4',
- cursorclass=pymysql.cursors.DictCursor)
- def checkdb(loc, player, player2):
- mycursor = connection.cursor()
- sql = "SELECT * FROM tennis WHERE Player_1 = %s and Player_2 = %s"
- adr = (player, player2)
- mycursor.execute(sql, adr)
- print(mycursor.rowcount)
- if not mycursor.rowcount or mycursor.rowcount == 0:
- text = '%F0%9F%92%B0 Внимание поступил сигнал! %F0%9F%92%B0' + "\n" + '%F0%9F%94%9C ' + game['L'] + game['MIO']['Loc'] + game['MIO'][
- 'TSt'] + '\n' + '%F0%9F%92%AA' + game['O1'] + ' %F0%9F%86%9A ' + game['O2'] + '\n' + 'Следующий гейм 40:40 - нет'
- r = requests.get(
- 'https://api.telegram.org/bot710029530:AAEWIhpzU74kzxfEesjk6hOv9mItxdd8xLE/sendmessage?chat_id=-1001292519649&text=' + text)
- cursor = connection.cursor()
- now = datetime.date.today()
- sql = "Insert into tennis (Location, Player_1, Player_2, date) " \
- + " values (%s, %s, %s, %s) "
- cursor.execute(sql, (loc, player, player2, now))
- connection.commit()
- num = 1
- while num < 10:
- url = 'https://mobvhj.xyz/LiveFeed/Mb_BestGamesExtZip'
- data = {
- 'count': 1000,
- 'country': 2,
- 'grMode': 3
- }
- request = requests.Session()
- info = request.get(url, params=data)
- games = info.json()['Value']
- for game in games:
- if ('SC' in game) and ('COP' in game['SC']):
- try:
- if 'Гейм' in game['SC']['COP']:
- print(game['L'], game['MIO']['Loc'], game['MIO']['TSt'])
- print(game['O1'], ' vs ', game['O2'])
- gg = re.split(r'\|', game['SC']['COP'])
- gg.remove('')
- print(gg)
- print('\n')
- if gg[0].split()[-1] == '40' and gg[1].split()[-1] == '40':
- checkdb(game['L'], game['O1'], game['O2'])
- print('отправил')
- print('\n')
- except Exception as err:
- #print(err)
- pass
- wait(30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement