Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def scrape_and_vote(bot):
- has_voted_annie = 1
- count_annie = 0
- while not bot.is_closed:
- try:
- res = requests.get('http://gameinfo.saltyteemo.com/')
- res.raise_for_status()
- except res.exceptions.HTTPError:
- await asyncio.sleep(120)
- res = requests.get('http://gameinfo.saltyteemo.com/')
- res.raise_for_status()
- table = bs4.BeautifulSoup(res.text, "html.parser")
- type(table)
- count = -1
- user_list = []
- timeS = time.time()
- for text2 in table.find_all('tr'):
- count += 1
- champion_list = text2.find_all('br')
- user_list = text2.find_all('td', class_="leagues")
- user_list = [ele.text.strip() for ele in user_list]
- champion_list = [ele.text.strip() for ele in champion_list]
- if count == 1:
- champion_list.remove('Level 30')
- blue_one = champion_list
- elif count == 2:
- champion_list.remove('Level 30')
- blue_two = champion_list
- elif count == 3:
- champion_list.remove('Level 30')
- blue_three = champion_list
- elif count == 4:
- champion_list.remove('Level 30')
- blue_four = champion_list
- elif count == 5:
- champion_list.remove('Level 30')
- blue_five = champion_list
- elif count == 6:
- champion_list.remove('Level 30')
- red_one = champion_list
- elif count == 7:
- champion_list.remove('Level 30')
- red_two = champion_list
- elif count == 8:
- champion_list.remove('Level 30')
- red_three = champion_list
- elif count == 9:
- champion_list.remove('Level 30')
- red_four = champion_list
- elif count == 10:
- champion_list.remove('Level 30')
- red_five = champion_list
- try:
- blue = blue_one + blue_two + blue_three + blue_four + blue_five
- red = red_one + red_two + red_three + red_four + red_five
- if blue.count('Annie') == 1 and red.count('Annie') != 1 and has_voted_annie == 0:
- ABlue.vote()
- count_annie += 1
- has_voted_annie = 1
- elif red.count('Annie') == 1 and blue.count('Annie') != 1 and has_voted_annie == 0:
- ARed.vote()
- count_annie += 1
- has_voted_annie = 1
- elif blue.count("Annie") == 0 and red.count("Annie") == 0 and has_voted_annie == 1:
- print("Reset Annie Vote")
- has_voted_annie = 0
- else:
- print("Game in progress.")
- await asyncio.sleep(120)
- except NameError as e:
- print("No active game")
- has_voted_annie = 0
- await asyncio.sleep(120)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement