Answer the question
In order to leave comments, you need to log in
Why does the parser error appear?
scab the site and there are 2 big conditions under which if the names of the fighters are suitable, then data is collected, if not, then it goes to the next condition. The problem is that there is an error that appears after the transition to the 2nd big condition.
import sched, time
s = sched.scheduler(time.time, time.sleep)
def f():
import requests
from selenium import webdriver
import time
browser=webdriver.Chrome()
browser.maximize_window()
browser.get('https://one-xskbdc.world/ru/live/Mortal-Kombat/1252965-Mortal-Kombat-X/')
nameone1 = browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[2]/div/div[1]/div[1]/a/span').text
nameone1_massif = nameone1.split()
del nameone1_massif[-1]
if 'Рептилия' in nameone1_massif[0] and 'Такеда' in nameone1_massif[1]:
browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[2]/div/div[1]/div[1]/a').click()
time.sleep(5)
browser.find_element_by_xpath('//*[@id="hottest_games"]/div/div[1]/div/div/div[2]/div/ul/li[1]/a').click()
time.sleep(5)
while True:
win = browser.find_element_by_xpath('//*[@id="allBetsTable"]/div[1]/div[1]/div/div[2]/div[1]/span[2]').text
print('Ставим на победу...')
break
all = browser.find_element_by_class_name('u-fg').text
Allmassif = all.split()
number = browser.find_element_by_xpath('/html/body/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div/div/div[2]').text
SS = number.split()
if SS[0] == '0' and SS[1] == '1':
print('Матч не подходит фаворит взял 1 раунд')
browser.quit()
elif SS[0] >= '1' and SS[1] >= '1':
print('Матч уже идёт достаточное время')
browser.quit()
else:
print('Ждём')
while SS[1] != '1' and Allmassif[0] == "РЕПТИЛИЯ":
time.sleep(30)
browser.refresh()
number = browser.find_element_by_xpath('/html/body/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div/div/div[2]').text
S1 = number.split()
if S1[1] == '1':
print('Ставка зашла')
browser.quit()
all = browser.find_element_by_class_name('u-fg').text
S2 = all.split()
if S2[0] == 'РЕПТИЛИЯ':
continue
else:
print('ДРУГОй МАТЧ')
browser.quit()
else:
print('Уже другой матч')
else:
print('Не подошёл')
nameone1 = browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[2]/div/div[1]/div[1]/a/span').text
nameone1_massif = nameone1.split()
del nameone1_massif[-1]
if 'Кожаное' in nameone1_massif[0] and 'Горо' in nameone1_massif[2]:
browser.find_element_by_xpath('//*[@id="games_content"]/div/div[1]/div/div/div[2]/div/div[1]/div[1]/a').click()
time.sleep(5)
browser.find_element_by_xpath('//*[@id="hottest_games"]/div/div[1]/div/div/div[2]/div/ul/li[1]/a').click()
time.sleep(5)
while True:
win = browser.find_element_by_xpath('//*[@id="allBetsTable"]/div[1]/div[1]/div/div[2]/div[1]/span[2]').text
print('Матч такой-то такой-то')
break
all = browser.find_element_by_class_name('u-fg').text
Allmassif = all.split()
number = browser.find_element_by_xpath('/html/body/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div/div/div[2]').text
SS = number.split()
if SS[0] == '1' and SS[1] == '0':
print('Матч не подходит фаворит взял 1 раунд')
browser.quit()
elif SS[0] >= '1' and SS[1] >= '1':
print('Матч уже идёт достаточное время')
browser.quit()
else:
while SS[0] != '1' and Allmassif[0] == "КОЖАНОЕ":
time.sleep(30)
browser.refresh()
number = browser.find_element_by_xpath('/html/body/div[2]/div[1]/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div/div[2]/div/div/div[2]/div/div/div[2]').text
S1 = number.split()
if S1[0] == '1':
print('Ставка зашла')
browser.quit()
else:
print('Ещё не взял')
all = browser.find_element_by_class_name('u-fg').text
S2 = all.split()
if S2[0] == 'КОЖАНОЕ':
continue
else:
print('ДРУГОй МАТЧ')
browser.quit()
else:
print('Уже другой матч')
else:
print('Не подошёл')
browser.quit()
s.enter(60, 1, f)
f()
s.run()
Answer the question
In order to leave comments, you need to log in
Wash you ran into the so-called throttling. In other words, the system/website is blocking you.
+ most likely, the site / system understands where you are climbing from and does not like selenium
PS: `import requests` can be done at the very beginning
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question