def login():
driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
driver.get("https://scrap.tf/login/")
print("waiting for login")
(WebDriverWait(driver, 100).until(expected_conditions.title_contains("Scrap.TF")))
print("joining raffles..")
# rafflejoin()
urls = []
def createlist(ids):
global urls
for id in ids:
urls.append("https://scrap.tf/raffles/" + id)
login()
driver.get("https://scrap.tf/raffles/ending")
SCROLL_PAUSE_TIME = 0.5
html = driver.find_element_by_tag_name('html')
last_height = driver.execute_script("return document.body.scrollHeight")
y = 1000
for timer in range(0, 15):
driver.execute_script("window.scrollTo(0, " + str(y) + ")")
if (exists("panel-body raffle-pagination-done") == True):
print("Loaded all raffles")
break
y += 1000
time.sleep(1)
id_dump = []
def filterdiv(divs):
global id_dump
for div in divs:
id_ = div.strip("raffle-box")
id_dump.append(id_)
html = driver.execute_script("return document.getElementsByTagName('html')[0].innerHTML")
parse = BeautifulSoup(html, 'html.parser')
selector = Selector(text=html)
divs = selector.css('.panel-raffle::attr(id)').getall()
count = 0
filterdiv(divs)
createlist(id_dump)
print(urls)
def rafflejoin():
global count
try:
visit = random.choice(urls)
except IndexError as e:
print(e)
Почему выдает ошибку Cannot choose from an empty sequence?