Anti-bot measure for missing join button

This commit is contained in:
Abhorrent_Anger 2023-10-17 12:24:51 +03:00
parent bd6d2f9ecd
commit f60db4186b
1 changed files with 6 additions and 1 deletions

View File

@ -57,7 +57,10 @@ def unentered_raffles():
return raffle_list
def get_hash(parsed_html):
button = parsed_html.select('.btn.btn-embossed.btn-info.btn-lg')
button = parsed_html.select('.btn.btn-embossed.btn-info.btn-lg:not(#raffle-enter):not([style*="display: none"])')
if not button:
print(colored('Didn\'t enter ' + parsed_html.find('title').text[:-19] + ' due to a missing enter button!', 'red'))
return False
onclick = button[1].attrs['onclick']
quote_text = re.findall(r"'([^']*)'", onclick)
return quote_text[1]
@ -70,6 +73,8 @@ def get_csrf(parsed_html):
def enter_raffle(raffle):
parsed_html = fetch(BASE_URL + RAFFLE_URL + raffle)
password = get_hash(parsed_html)
if not password:
return 418
csrf = get_csrf(parsed_html)
data = {'raffle' : raffle,
'captcha' : '',