-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBanchecker.py
65 lines (51 loc) · 2.03 KB
/
Banchecker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
from playsound import playsound
import random
import string
import time
import datetime
import pytz
def randomString(stringLength=10):
"""Generate a random string of fixed length """
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength))
def banCheck(url):
tz = pytz.timezone('US/Pacific')
while True:
cali_now = datetime.datetime.now(tz).time()
start_oday = datetime.time(5, 0)
end_oday = datetime.time(17, 0)
if start_oday <= cali_now <= end_oday:
break
print('waiting for correct time')
time.sleep(60)
chrome_driver = ChromeDriverManager().install()
driver_ = webdriver.Chrome(chrome_driver)
found = False
count = 0
while not found:
randq = "?" + randomString(25)
# garabgq = random.
try:
driver_.get(url + randq)
soup = BeautifulSoup(driver_.page_source, "html.parser")
this = soup.find(class_="content")
that = soup.find(class_="no-result")
if str(this.contents[1]) == "<p>You are not authorized to access this page.</p>"\
or str(that.contents[0]) == "\n no result found ":
print("same old same old")
time.sleep(5)
else:
print("you're allowed acccess now")
found = True
print(count)
count += 1
except:
found = True # fails loud in order to alert you of if your internet cuts out or the code otherwise fails, to avoid giving a false sense of security
playsound('Kill Bill Ironside Siren Sound.mp3')
time.sleep(1200)
driver_.quit()
if __name__ == "__main__":
banCheck("https://magic.wizards.com/en/articles/archive/news/july-13-2020-banned-and-restricted-announcement")