From f3b70f62446394680b3b91469b9e43a85f4ae7a6 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Mon, 17 Jun 2024 00:32:06 +0100 Subject: [PATCH 01/15] Handle missing config entries --- screenshots.py | 1 + 1 file changed, 1 insertion(+) diff --git a/screenshots.py b/screenshots.py index c81ac0b..6350f24 100644 --- a/screenshots.py +++ b/screenshots.py @@ -4,6 +4,7 @@ from Screenshot import Screenshot # type: ignore import datetime import configparser +import time # Read config file config = configparser.ConfigParser(interpolation=None) From 99b3b6681abaa3b5dfb6f90b8133f2ec43a40ac7 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Tue, 11 Jun 2024 03:42:58 +0100 Subject: [PATCH 02/15] Create tracker classes so the code is DRY --- config.ini.example | 33 +- screenshots.py | 827 +-------------------------------- trackers/__init__.py | 0 trackers/aither.py | 15 + trackers/animebytes.py | 20 + trackers/animetorrents.py | 20 + trackers/base_tracker.py | 63 +++ trackers/beyond-hd.py | 46 ++ trackers/blutopia.py | 39 ++ trackers/broadcasthenet.py | 45 ++ trackers/cathode-raytube.py | 20 + trackers/filelist.py | 20 + trackers/gazellegames.py | 40 ++ trackers/greatposterwall.py | 20 + trackers/hdtorrents.py | 26 ++ trackers/huno.py | 56 +++ trackers/jme.py | 15 + trackers/lst.py | 15 + trackers/morethantv.py | 41 ++ trackers/myanonamouse.py | 20 + trackers/nebulance.py | 20 + trackers/orpheus.py | 44 ++ trackers/passthepopcorn.py | 49 ++ trackers/redacted.py | 40 ++ trackers/reelflix.py | 15 + trackers/skipthecommercials.py | 15 + trackers/skipthetrailers.py | 15 + trackers/speedapp.py | 20 + trackers/swarmazon.py | 20 + trackers/thedarkcommunity.py | 20 + trackers/torrentleech.py | 20 + 31 files changed, 835 insertions(+), 824 deletions(-) create mode 100644 trackers/__init__.py create mode 100644 trackers/aither.py create mode 100644 trackers/animebytes.py create mode 100644 trackers/animetorrents.py create mode 100644 trackers/base_tracker.py create mode 100644 trackers/beyond-hd.py create mode 100644 trackers/blutopia.py create mode 100644 trackers/broadcasthenet.py create mode 100644 trackers/cathode-raytube.py create mode 100644 trackers/filelist.py create mode 100644 trackers/gazellegames.py create mode 100644 trackers/greatposterwall.py create mode 100644 trackers/hdtorrents.py create mode 100644 trackers/huno.py create mode 100644 trackers/jme.py create mode 100644 trackers/lst.py create mode 100644 trackers/morethantv.py create mode 100644 trackers/myanonamouse.py create mode 100644 trackers/nebulance.py create mode 100644 trackers/orpheus.py create mode 100644 trackers/passthepopcorn.py create mode 100644 trackers/redacted.py create mode 100644 trackers/reelflix.py create mode 100644 trackers/skipthecommercials.py create mode 100644 trackers/skipthetrailers.py create mode 100644 trackers/speedapp.py create mode 100644 trackers/swarmazon.py create mode 100644 trackers/thedarkcommunity.py create mode 100644 trackers/torrentleech.py diff --git a/config.ini.example b/config.ini.example index 90b9734..11aceeb 100644 --- a/config.ini.example +++ b/config.ini.example @@ -1,5 +1,3 @@ -#This config file holds all of your data. - [settings] # Browser to use for screenshots. Options are: chrome, firefox, edge, safari, brave, opera # If using brave or opera, you need to specify the binary location. @@ -8,15 +6,15 @@ binary_location = C:\Program Files\BraveSoftware\Brave-Browser\Application\brave # Set to true if you want to take full page screenshots. Set to false if you want to take only the visible part of the page. full_page_screenshot = false -#List of supported trackers. Remove the trackers that you don't want to screenshot. Only keep what you want. +# List of supported trackers. Remove the trackers that you don't want to screenshot. Only keep what you want. [wanted-trackers] -trackers = ["AB", "ANT", "ATH", "BHD", "BLU", "BTN", "CRT", "FL", "GGN", "GPW", - "HDT", "HUNO", "JME", "LST", "MAM", "MTV", "NBL", "OPS", "OTW", "PTP", - "RED", "RF", "SP", "STC", "STT", "SZN", "TDC", "TL"] +trackers = ["aither", "reelflix", "lst", "blutopia", "huno", "speedapp", "filelist", "greatposterwall", "jme", "animetorrents", + "redacted", "skipthecommercials", "skipthetrailers", "animebytes", "thedarkcommunity", "cathode-raytube", "myanonamouse", "nebulance", "torrentleech", "orpheus", + "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd"] -#Referance: ["AB", "ANT", "ATH", "BHD", "BLU", "BTN", "CRT", "FL", "GGN", "GPW", -# "HDT", "HUNO", "JME", "LST", "MAM", "MTV", "NBL", "OPS", "OTW", "PTP", -# "RED", "RF", "SP", "STC", "STT", "SZN", "TDC", "TL"] +# Reference: ["aither", "reelflix", "lst", "blutopia", "huno", "speedapp", "filelist", "greatposterwall", "jme", "animetorrents", +# "redacted", "skipthecommercials", "skipthetrailers", "animebytes", "thedarkcommunity", "cathode-raytube", "myanonamouse", "nebulance", "torrentleech", "orpheus", +# "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd"] #Edit the trackers you want to use with your details. [aither] @@ -47,7 +45,7 @@ profile_url = https://hawke.uno/users/XXX [speedapp] username = YOUR USERNAME password = YOUR PASSWORD -#Do Not Change the URL +# DO NOT CHANGE profile_url = https://speedapp.io/profile/ [filelist] @@ -66,6 +64,8 @@ profile_url = https://greatposterwall.com/user.php?id=XXX username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://animetorrents.me/user-profile.php?uid=XXX +# DO NOT CHANGE +login_url = https://animetorrents.me/login.php [redacted] username = YOUR USERNAME @@ -86,11 +86,14 @@ profile_url = https://skipthetrailers.xyz/users/XXX username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://animebytes.tv/user.php?id=XXX +login_url = https://animebytes.tv/user.php [jme] username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://jme-reunit3d.de/users/XXX +# DO NOT CHANGE +login_url = https://jme-reunit3d.de/login [thedarkcommunity] username = YOUR USERNAME @@ -101,6 +104,8 @@ profile_url = https://thedarkcommunity.cc/users/XXX username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://www.cathode-ray.tube/user.php?id=XXX +# DO NOT CHANGE +login_url = https://www.cathode-ray.tube/login.php [myanonamouse] username = YOUR EMAIL @@ -117,17 +122,19 @@ username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://www.torrentleech.org/profile/XXX/ -#ORPHEUS DOES NOT WORK WITH 2FA [orpheus] username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://orpheus.network/user.php?id=XXXX +# DO NOT CHANGE +login_url = https://orpheus.network/login.php [swarmazon] username = YOUR USERNAME password = YOUR PASSWORD -#Do not change the URL +# DO NOT CHANGE URLS profile_url = https://swarmazon.club/en/view/my-statistics.php +login_url = https://swarmazon.club/en/account/login.php [morethantv] username = YOUR USERNAME @@ -138,6 +145,8 @@ profile_url = https://www.morethantv.me/user.php?id=XXX username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://hd-torrents.org/usercp.php?uid=XXX +# DO NOT CHANGE +login_url = https://hd-torrents.org [broadcasthenet] username = YOUR USERNAME diff --git a/screenshots.py b/screenshots.py index 6350f24..173b72a 100644 --- a/screenshots.py +++ b/screenshots.py @@ -1,10 +1,7 @@ # Required Libraries - You can change the browser driver if you would like to. More details on GitHub. -from seleniumbase import Driver, SB # type: ignore -from selenium.webdriver.common.by import By -from Screenshot import Screenshot # type: ignore -import datetime +from seleniumbase import Driver # type: ignore import configparser -import time +import json # Read config file config = configparser.ConfigParser(interpolation=None) @@ -32,819 +29,25 @@ driver = Driver(uc=True, browser=browser) driver.implicitly_wait(6) -ob = Screenshot.Screenshot() +trackers_list = json.loads(config["wanted-trackers"]["trackers"]) -def hide_notification(driver=driver): +# For each tracker in the config file, run the tracker class +for tracker in trackers_list: try: - driver.execute_script( - "document.querySelector('#noty_bottomRight_layout_container').style.display = 'none';" + tracker_class_name = "trackers." + tracker.lower() + tracker_class = getattr( + __import__(tracker_class_name, fromlist=[tracker]), + tracker.capitalize().replace("-", "") + "Tracker", ) - except: # noqa: E722 - pass + except ModuleNotFoundError: + print(f"Tracker {tracker} does not exist.") + continue - -def take_screenshot(tracker_name, driver=driver, is_load_at_runtime=False): - hide_notification(driver) - - date_string = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S") - image_name = tracker_name + "_" + date_string + ".png" - - if config["settings"].get("full_page_screenshot", "false") == "true": - ob.full_screenshot( - driver, - save_path="screenshots", - image_name=image_name, - is_load_at_runtime=is_load_at_runtime, - ) - else: - driver.save_screenshot("screenshots/" + image_name) - - -if "ATH" in config["wanted-trackers"]["trackers"]: - print("Entering Aither.") - # Get the details from the config file - username = config["aither"]["username"] - password = config["aither"]["password"] - profile_url = config["aither"]["profile_url"] - - driver.get(profile_url) - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.CLASS_NAME, "auth-form__primary-button").click() - take_screenshot("Aither") - print("Aither Screenshoted") - - -if "RF" in config["wanted-trackers"]["trackers"]: - print("Entering Reelflix.") - # Get the details from the config file - username = config["reelflix"]["username"] - password = config["reelflix"]["password"] - profile_url = config["reelflix"]["profile_url"] - - driver.get(profile_url) - - # Navigation - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.ID, "login-button").click() - take_screenshot("RF") - print("Reelflix Screenshoted") - - -if "LST" in config["wanted-trackers"]["trackers"]: - print("Entering LST.") - username = config["lst"]["username"] - password = config["lst"]["password"] - profile_url = config["lst"]["profile_url"] - - driver.get(profile_url) - - # Navigation - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.ID, "login-button").click() - take_screenshot("LST") - print("LST Screenshoted") - -if "BLU" in config["wanted-trackers"]["trackers"]: - print("Entering BLU.") - username = config["blutopia"]["username"] - password = config["blutopia"]["password"] - profile_url = config["blutopia"]["profile_url"] - - driver.get(profile_url) - - # Navigation - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.CLASS_NAME, "auth-form__primary-button").click() - - # 2FA is enabled, ask for the code - if driver.find_elements(By.ID, "code"): - code = input("Please enter the 2FA code: ") - code_field = driver.find_element(By.ID, "code") - code_field.send_keys(code) - - take_screenshot("BLU") - print("Blu Screenshoted") - -if "HUNO" in config["wanted-trackers"]["trackers"]: - print("Entering HUNO.") - username = config["huno"]["username"] - password = config["huno"]["password"] - profile_url = config["huno"]["profile_url"] - skip = False - - driver.get(profile_url) - - if driver.find_elements(By.ID, "challenge-running"): - print( - "Please solve the challenge and press enter to continue or type 'n' and press enter to skip." - ) - response = input() - if response == "n": - skip = True - - if not skip: - # Navigation - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.ID, "login-button").click() - - # 2FA is enabled, ask for the code - if driver.find_elements(By.ID, "v_input"): - code = input("Please enter the 2FA code: ") - code_field = driver.find_element(By.ID, "v_input") - code_field.send_keys(code) - driver.find_element(By.ID, "submit_verification").click() - - # is_load_at_runtime is set to ensure the full page screenshot is taken correctly - if config["settings"].get("full_page_screenshot", "false") == "true": - take_screenshot("HUNO", is_load_at_runtime=True) - else: - take_screenshot("HUNO") - print("HUNO Screenshoted") - -if "SP" in config["wanted-trackers"]["trackers"]: - print("Entering Speedapp.") - username = config["speedapp"]["username"] - password = config["speedapp"]["password"] - profile_url = config["speedapp"]["profile_url"] - - driver.get(profile_url) - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and screenshot - driver.find_element(By.TAG_NAME, "button").click() - - take_screenshot("SP") - print("Speedapp Screenshoted") - -if "FL" in config["wanted-trackers"]["trackers"]: - print("Entering Filelist.") - username = config["filelist"]["username"] - password = config["filelist"]["password"] - profile_url = config["filelist"]["profile_url"] - - driver.get(profile_url) - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and screenshot - driver.find_element(By.CLASS_NAME, "btn").click() - - take_screenshot("FL") - print("Filelist Screenshoted") - - -if "GPW" in config["wanted-trackers"]["trackers"]: - print("Entering GreatPosterWall.") - username = config["greatposterwall"]["username"] - password = config["greatposterwall"]["password"] - profile_url = config["greatposterwall"]["profile_url"] - - driver.get(profile_url) - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.CLASS_NAME, "Button").click() - - take_screenshot("GPW") - print("GPW Screenshoted") - - -###THE FOLLOWING ARE TESTED BY THE COMMUNITY### - -if "JME" in config["wanted-trackers"]["trackers"]: - print("Entering JME.") - username = config["jme"]["username"] - password = config["jme"]["password"] - profile_url = config["jme"]["profile_url"] - - driver.get( - "https://jme-reunit3d.de/login" - ) # DO NOT CHANGE THIS, JME requires an extra step for login - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.ID, "login-button").click() - - driver.get(profile_url) - - take_screenshot("JME") - print("JME-REUNIT3D Screenshoted") - - -if "ANT" in config["wanted-trackers"]["trackers"]: - print("Entering AnimeTorrents.") - username = config["animetorrents"]["username"] - password = config["animetorrents"]["password"] - profile_url = config["animetorrents"]["profile_url"] - - driver.get("https://animetorrents.me/login.php") # DO NOT CHANGE - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login - driver.find_element(By.ID, "login-element-6").click() - - # Load profile and screenshot - driver.get(profile_url) - - take_screenshot("ANT") - print("ANT Screenshoted") - - -if "RED" in config["wanted-trackers"]["trackers"]: - print("Entering Redacted.") - username = config["redacted"]["username"] - password = config["redacted"]["password"] - profile_url = config["redacted"]["profile_url"] - driver.get( - "https://redacted.sh/login.php" - ) # Keep the link as it is, DO NOT CHANGE. - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - twofa_field = driver.find_element(By.NAME, "qrcode_confirm") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # 2FA, ask for the code - code = input( - "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " - ) - twofa_field.send_keys(code) - - # Login - driver.find_element(By.CLASS_NAME, "submit").click() - - # Load profile and screenshot - driver.get(profile_url) - - take_screenshot("RED") - print("RED Screenshoted") - - -if "STC" in config["wanted-trackers"]["trackers"]: - print("Entering SkipTheCommericals.") - username = config["skipthecommercials"]["username"] - password = config["skipthecommercials"]["password"] - profile_url = config["skipthecommercials"]["profile_url"] - - driver.get(profile_url) - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.ID, "login-button").click() - - take_screenshot("STC") - print("SkipTheCommericals Screenshoted") - - -if "STT" in config["wanted-trackers"]["trackers"]: - print("Entering SkipTheTrailers.") - username = config["skipthetrailers"]["username"] - password = config["skipthetrailers"]["password"] - profile_url = config["skipthetrailers"]["profile_url"] - - driver.get(profile_url) - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.ID, "login-button").click() - - take_screenshot("STT") - print("SkipTheTrailers Screenshoted") - -if "AB" in config["wanted-trackers"]["trackers"]: - print("Entering AnimeBytes") - username = config["animebytes"]["username"] - password = config["animebytes"]["password"] - profile_url = config["animebytes"]["profile_url"] - - driver.get( - "https://animebytes.tv/user.php" - ) # Keep the link as it is, DO NOT CHANGE. - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login - driver.find_element(By.CLASS_NAME, "submit").click() - - # Load profile and screenshot - driver.get(profile_url) # Add your profile link - - take_screenshot("AB") - print("AnimeBytes Screenshoted") - -if "TDC" in config["wanted-trackers"]["trackers"]: - print("Entering TheDarkCommunity") - username = config["thedarkcommunity"]["username"] - password = config["thedarkcommunity"]["password"] - profile_url = config["thedarkcommunity"]["profile_url"] - - driver.get(profile_url) - - # Navigation - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.ID, "login-button").click() - - take_screenshot("TDC") - print("TDC Screenshoted") - - -if "CRT" in config["wanted-trackers"]["trackers"]: - print("Entering Cathode-Ray.tube") - username = config["cathode-raytube"]["username"] - password = config["cathode-raytube"]["password"] - profile_url = config["cathode-raytube"]["profile_url"] - - driver.get( - "https://www.cathode-ray.tube/login" - ) # Keep the link as it is, DO NOT CHANGE. - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login - driver.find_element(By.ID, "login_button").click() - - # 2FA is enabled, ask for the code - if driver.find_elements(By.NAME, "code"): - code = input("Please enter the 2FA code: ") - code_field = driver.find_element(By.NAME, "code") - code_field.send_keys(code) - driver.find_element(By.ID, "login_button").click() - - # Load profile and screenshot - driver.get(profile_url) - - # Hide passkey - try: - passkey_li = driver.find_element(By.XPATH, "//li[contains(text(), 'Passkey')]") - driver.execute_script("arguments[0].style.display = 'none';", passkey_li) - except: # noqa: E722 - pass - - take_screenshot("CRT") - print("CRT Screenshoted") - -if "MAM" in config["wanted-trackers"]["trackers"]: - print("Entering myanonamouse") - username = config["myanonamouse"]["username"] - password = config["myanonamouse"]["password"] - profile_url = config["myanonamouse"]["profile_url"] - - driver.get(profile_url) - - # Navigation - username_field = driver.find_element(By.NAME, "email") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.CLASS_NAME, "btn").click() - - take_screenshot("MAM") - print("myanonamouse Screenshoted") - -if "NBL" in config["wanted-trackers"]["trackers"]: - print("Entering Nebulance") - username = config["nebulance"]["username"] - password = config["nebulance"]["password"] - profile_url = config["nebulance"]["profile_url"] - - driver.get(profile_url) - - # Navigation - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.NAME, "login").click() - - take_screenshot("NBL") - print("Nebulance Screenshoted") - -if "TL" in config["wanted-trackers"]["trackers"]: - print("Entering TorrentLeech") - username = config["torrentleech"]["username"] - password = config["torrentleech"]["password"] - profile_url = config["torrentleech"]["profile_url"] - - driver.get(profile_url) - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.CLASS_NAME, "btn").click() - - take_screenshot("TL") - print("TorrentLeech Screenshoted") - -if "OPS" in config["wanted-trackers"]["trackers"]: - print("Entering Orpheus") - username = config["orpheus"]["username"] - password = config["orpheus"]["password"] - profile_url = config["orpheus"]["profile_url"] - driver.get( - "https://orpheus.network/login.php" - ) # Keep the link as it is, DO NOT CHANGE. - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - twofa_field = driver.find_element(By.NAME, "twofa") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # 2FA, ask for the code - code = input( - "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " - ) - twofa_field.send_keys(code) - - # Login - driver.find_element(By.CLASS_NAME, "submit").click() - - # Load profile and screenshot - driver.get(profile_url) # Add your profile link - - take_screenshot("OPS") - print("OPS Screenshoted") - -if "SZN" in config["wanted-trackers"]["trackers"]: - print("Entering Swarmazon") - username = config["swarmazon"]["username"] - password = config["swarmazon"]["password"] - profile_url = config["swarmazon"]["profile_url"] - - driver.get("https://swarmazon.club/en/account/login.php") - - # Navigation - Login - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login - driver.find_element(By.CLASS_NAME, "btn").click() - - # Load profile and screenshot - driver.get(profile_url) # Keep as-is - - take_screenshot("Swarmazon") - print("Swarmazon Screenshoted") - -if "MTV" in config["wanted-trackers"]["trackers"]: - print("Entering MoreThanTV") - username = config["morethantv"]["username"] - password = config["morethantv"]["password"] - profile_url = config["morethantv"]["profile_url"] - - driver.get(profile_url) - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - driver.find_element(By.ID, "login_button").click() - - # 2FA is enabled, ask for the code - if driver.find_elements(By.NAME, "code"): - code = input("Please enter the 2FA code: ") - code_field = driver.find_element(By.NAME, "code") - code_field.send_keys(code) - driver.find_element(By.ID, "login_button").click() - - # Hide passkey - try: - passkey_li = driver.find_element(By.XPATH, "//li[contains(text(), 'Passkey')]") - driver.execute_script("arguments[0].style.display = 'none';", passkey_li) - except: # noqa: E722 - pass - - # Login and save screenshot - take_screenshot("MoreThanTV") - print("MoreThanTV Screenshoted") - -if "HDT" in config["wanted-trackers"]["trackers"]: - print("Entering HD-Torrents") - username = config["hdtorrents"]["username"] - password = config["hdtorrents"]["password"] - profile_url = config["hdtorrents"]["profile_url"] - - driver.get("https://hd-torrents.org") # Keep the link as it is, DO NOT CHANGE. - - # Navigation - Login - username_field = driver.find_element(By.NAME, "uid") - password_field = driver.find_element(By.NAME, "pwd") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login - driver.find_element( - By.XPATH, - "/html/body/div[3]/table/tbody/tr/td/form/table/tbody/tr/td[1]/table/tbody/tr/td[5]/input", - ).click() - - # Load profile and screenshot - driver.get(profile_url) # Add your profile link - - take_screenshot("HDT") - print("HDT Screenshoted") - -if "BTN" in config["wanted-trackers"]["trackers"]: - with SB(uc=True, locale_code="en") as sb: - print("Entering BroadcasTheNet") - username = config["broadcasthenet"]["username"] - password = config["broadcasthenet"]["password"] - profile_url = config["broadcasthenet"]["profile_url"] - - sb.driver.uc_open_with_reconnect(profile_url, 1) - - # Navigation - DO NOT CHANGE - username_field = "input[id='username']" - password_field = "input[id='password']" - login_button = "input[name='login']" - - # Send username and password - sb.type(username_field, username) - sb.type(password_field, password) - sb.driver.reconnect(0.1) - sb.driver.uc_click(login_button, reconnect_time=4) - sb.wait_for_text_not_visible("Checking", timeout=10) - - # 2FA is enabled, ask for the code - if sb.driver.find_elements(By.ID, "code"): - code = input("Please enter the 2FA code: ") - code_field = "input[id='code']" - sb.type(code_field, code) - submit_button = "input[type='submit']" - sb.driver.uc_click(submit_button, reconnect_time=4) - - sb.driver.get(profile_url) - - info_button = "a[href='#section2']" - sb.driver.uc_click(info_button, reconnect_time=4) - # Login and save screenshot - take_screenshot("BroadcasTheNet", sb.driver) - print("BroadcasTheNet Screenshoted") - -if "GGN" in config["wanted-trackers"]["trackers"]: - print("Entering GazelleGames") - username = config["gazellegames"]["username"] - password = config["gazellegames"]["password"] - profile_url = config["gazellegames"]["profile_url"] - - driver.get(profile_url) - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - twofa_field = driver.find_element(By.NAME, "authkey") - - print( - "Manually solve the captcha image. Press enter when done. (If you use 2FA then press enter after you type the code below)" - ) - code = input() - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - twofa_field.send_keys(code) - - driver.find_element(By.CLASS_NAME, "submit").click() - - # Login and save screenshot - take_screenshot("GazelleGames") - print("GazelleGames Screenshoted") - -if "PTP" in config["wanted-trackers"]["trackers"]: - print("Entering PassThePopcorn") - username = config["passthepopcorn"]["username"] - password = config["passthepopcorn"]["password"] - profile_url = config["passthepopcorn"]["profile_url"] - - driver.get(profile_url) - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - driver.find_element(By.ID, "login-button").click() - print("Manually solve the captcha image. Press enter when done.") - code = input() - driver.find_element(By.ID, "login-button").click() - - # 2FA is enabled, ask for the code - if driver.find_elements(By.ID, "tfa-code"): - code = input("Please enter the 2FA code: ") - code_field = driver.find_element(By.ID, "tfa-code") - code_field.send_keys(code) - verify_button = driver.find_element(By.CSS_SELECTOR, "input[value='Verify']") - verify_button.click() - - # is_load_at_runtime is set to ensure the full page screenshot is taken correctly - if config["settings"].get("full_page_screenshot", "false") == "true": - take_screenshot("PassThePopcorn", is_load_at_runtime=True) - else: - take_screenshot("PassThePopcorn") - print("PassThePopcorn Screenshoted") - -if "BHD" in config["wanted-trackers"]["trackers"]: - print("Entering BeyondHD") - username = config["beyond-hd"]["username"] - password = config["beyond-hd"]["password"] - profile_url = config["beyond-hd"]["profile_url"] - - driver.get(profile_url) - - # Navigation - DO NOT CHANGE - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - print("Manually solve the captcha. Press enter when done.") - code = input() - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - driver.find_element(By.ID, "login-button").click() - - # 2FA is enabled, ask for the code - if driver.find_elements(By.ID, "code"): - code = input("Please enter the 2FA code: ") - code_field = driver.find_element(By.ID, "code") - code_field.send_keys(code) - driver.find_element(By.ID, "login-button").click() - - driver.get(profile_url) - # Login and save screenshot - take_screenshot("BeyondHD") - print("BeyondHD Screenshoted") - -if "OTW" in config["wanted-trackers"]["trackers"]: - print("Entering OTW.") - username = config["oldtoons"]["username"] - password = config["oldtoons"]["password"] - profile_url = config["oldtoons"]["profile_url"] - - driver.get(profile_url) - - # Navigation - username_field = driver.find_element(By.NAME, "username") - password_field = driver.find_element(By.NAME, "password") - - # Send username and password - username_field.send_keys(username) - password_field.send_keys(password) - - # Login and save screenshot - driver.find_element(By.CLASS_NAME, "auth-form__primary-button").click() - - # 2FA is enabled, ask for the code - if driver.find_elements(By.ID, "code"): - code = input("Please enter the 2FA code: ") - code_field = driver.find_element(By.ID, "code") - code_field.send_keys(code) - - take_screenshot("OTW") - print("OTW Screenshoted") - -else: - driver.quit() + # Create an instance of the tracker class and run it + tracker_instance = tracker_class(driver, config) + tracker_instance.run() driver.quit() - # GitHub: https://github.com/KlevGG/TrackerScreenshot diff --git a/trackers/__init__.py b/trackers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/trackers/aither.py b/trackers/aither.py new file mode 100644 index 0000000..b167b3b --- /dev/null +++ b/trackers/aither.py @@ -0,0 +1,15 @@ +from .base_tracker import BaseTracker + +class AitherTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "aither" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/animebytes.py b/trackers/animebytes.py new file mode 100644 index 0000000..7f225b6 --- /dev/null +++ b/trackers/animebytes.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class AnimebytesTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "animebytes" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login(login_url=self.config[self.tracker_name]["login_url"]) + + def click_login_button(self): + login_button = self.driver.find_element(By.CLASS_NAME, "submit") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/animetorrents.py b/trackers/animetorrents.py new file mode 100644 index 0000000..2f46eb0 --- /dev/null +++ b/trackers/animetorrents.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class AnimetorrentsTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "animetorrents" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login(login_url=self.config[self.tracker_name]["login_url"]) + + def click_login_button(self): + login_button = self.driver.find_element(By.ID, "login-element-6") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/base_tracker.py b/trackers/base_tracker.py new file mode 100644 index 0000000..5c88c88 --- /dev/null +++ b/trackers/base_tracker.py @@ -0,0 +1,63 @@ +import datetime +from selenium.webdriver.common.by import By +from Screenshot import Screenshot # type: ignore + +class BaseTracker: + def __init__(self, driver, config, tracker_name): + self.driver = driver + self.config = config + self.tracker_name = tracker_name + self.ob = Screenshot.Screenshot() + + def login(self, login_url=None): + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL or login URL + if login_url: + self.driver.get(login_url) + else: + self.driver.get(profile_url) + + self.enter_credentials() + self.click_login_button() + + if login_url: + self.driver.get(profile_url) + + def enter_credentials(self, username_field=None, password_field=None): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + + # Find the username, password and login button elements + if not username_field: + username_field = self.driver.find_element(By.NAME, "username") + if not password_field: + password_field = self.driver.find_element(By.NAME, "password") + + # Type username and password + username_field.send_keys(username) + password_field.send_keys(password) + + def click_login_button(self): + login_button = self.driver.find_element(By.ID, "login-button") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + date_string = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S") + image_name = tracker_name + "_" + date_string + ".png" + + if self.config["settings"]["full_page_screenshot"] == "true": + self.ob.full_screenshot( + self.driver, + save_path="screenshots", + image_name=image_name, + is_load_at_runtime=is_load_at_runtime, + ) + else: + self.driver.save_screenshot("screenshots/" + image_name) + + def run(self): + print("Capturing " + self.tracker_name) + self.login() + self.take_screenshot(self.tracker_name) + print("Captured " + self.tracker_name) \ No newline at end of file diff --git a/trackers/beyond-hd.py b/trackers/beyond-hd.py new file mode 100644 index 0000000..c9059bd --- /dev/null +++ b/trackers/beyond-hd.py @@ -0,0 +1,46 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class BeyondhdTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "beyond-hd" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the usernam, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element(By.ID, "login-button") + + print("Manually solve the captcha. Press enter when done.") + code = input() + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.ID, "code") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) + login_button = self.driver.find_element(By.ID, "login-button") + login_button.click() + + self.driver.get(profile_url) + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/blutopia.py b/trackers/blutopia.py new file mode 100644 index 0000000..1121a01 --- /dev/null +++ b/trackers/blutopia.py @@ -0,0 +1,39 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class BlutopiaTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "blutopia" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the usernam, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element(By.CLASS_NAME, "auth-form__primary-button") + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.ID, "code") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/broadcasthenet.py b/trackers/broadcasthenet.py new file mode 100644 index 0000000..234f47b --- /dev/null +++ b/trackers/broadcasthenet.py @@ -0,0 +1,45 @@ +from seleniumbase import SB # type: ignore +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class BroadcasthenetTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "broadcasthenet" + super().__init__(driver, config, self.tracker_name) + + def run(self): + with SB(uc=True, locale_code="en") as sb: + self.driver = sb.driver + print("Capturing " + self.tracker_name) + username = self.config["broadcasthenet"]["username"] + password = self.config["broadcasthenet"]["password"] + profile_url = self.config["broadcasthenet"]["profile_url"] + + sb.driver.uc_open_with_reconnect(profile_url, 1) + + username_field = "input[id='username']" + password_field = "input[id='password']" + login_button = "input[name='login']" + + # Send username and password + sb.type(username_field, username) + sb.type(password_field, password) + sb.driver.reconnect(0.1) + sb.driver.uc_click(login_button, reconnect_time=4) + sb.wait_for_text_not_visible("Checking", timeout=10) + + # 2FA is enabled, ask for the code + if sb.driver.find_elements(By.ID, "code"): + code = input("Please enter the 2FA code: ") + code_field = "input[id='code']" + sb.type(code_field, code) + submit_button = "input[type='submit']" + sb.driver.uc_click(submit_button, reconnect_time=4) + + sb.driver.get(profile_url) + + info_button = "a[href='#section2']" + sb.driver.uc_click(info_button, reconnect_time=4) + # Login and save screenshot + super().take_screenshot("broadcasthenet") + print("Captured " + self.tracker_name) \ No newline at end of file diff --git a/trackers/cathode-raytube.py b/trackers/cathode-raytube.py new file mode 100644 index 0000000..8266223 --- /dev/null +++ b/trackers/cathode-raytube.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class CathoderaytubeTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "cathode-raytube" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login(login_url=self.config[self.tracker_name]["login_url"]) + + def click_login_button(self): + login_button = self.driver.find_element(By.ID, "login_button") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/filelist.py b/trackers/filelist.py new file mode 100644 index 0000000..9794233 --- /dev/null +++ b/trackers/filelist.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class FilelistTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "filelist" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def click_login_button(self): + login_button = self.driver.find_element(By.CLASS_NAME, "btn") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/gazellegames.py b/trackers/gazellegames.py new file mode 100644 index 0000000..1aaabec --- /dev/null +++ b/trackers/gazellegames.py @@ -0,0 +1,40 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class GazellegamesTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "gazellegames" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the username, password and 2fa elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + twofa_field = self.driver.find_element(By.NAME, "authkey") + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # 2FA, ask for the code + code = input( + "Manually solve the captcha image. Press enter when done. (If you use 2FA then press enter after you type the code below)" + ) + twofa_field.send_keys(code) + + login_button = self.driver.find_element(By.CLASS_NAME, "submit") + # Click on the login button + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/greatposterwall.py b/trackers/greatposterwall.py new file mode 100644 index 0000000..dc7ca47 --- /dev/null +++ b/trackers/greatposterwall.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class GreatposterwallTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "greatposterwall" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def click_login_button(self): + login_button = self.driver.find_element(By.CLASS_NAME, "Button") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/hdtorrents.py b/trackers/hdtorrents.py new file mode 100644 index 0000000..6317fa1 --- /dev/null +++ b/trackers/hdtorrents.py @@ -0,0 +1,26 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class HdtorrentsTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "hdtorrents" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login(login_url=self.config[self.tracker_name]["login_url"]) + + def enter_credentials(self): + username_field = self.driver.find_element(By.NAME, "uid") + password_field = self.driver.find_element(By.NAME, "pwd") + + super().enter_credentials(username_field, password_field) + + def click_login_button(self): + login_button = self.driver.find_element(By.XPATH, "/html/body/div[3]/table/tbody/tr/td/form/table/tbody/tr/td[1]/table/tbody/tr/td[5]/input") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/huno.py b/trackers/huno.py new file mode 100644 index 0000000..ad2b3a0 --- /dev/null +++ b/trackers/huno.py @@ -0,0 +1,56 @@ + +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class HunoTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "huno" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config["huno"]["username"] + password = self.config["huno"]["password"] + profile_url = self.config["huno"]["profile_url"] + skip = False + + # Open the profile URL + self.driver.get(profile_url) + + if self.driver.find_elements(By.ID, "challenge-running"): + print( + "Please solve the challenge and press enter to continue or type 'n' and press enter to skip." + ) + response = input() + if response == "n": + skip = True + if not skip: + # Find the username, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element(By.ID, "login-button") + + # Type username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.ID, "v_input") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) + + verify_button = self.driver.find_element(By.ID, "submit_verification") + verify_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + # super().take_screenshot(self.tracker_name) + if self.config["settings"]["full_page_screenshot"] == "true": + super().take_screenshot(self.tracker_name, is_load_at_runtime=True) + else: + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/jme.py b/trackers/jme.py new file mode 100644 index 0000000..5d8ccb6 --- /dev/null +++ b/trackers/jme.py @@ -0,0 +1,15 @@ +from .base_tracker import BaseTracker + +class JmeTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "jme" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login(login_url=self.config[self.tracker_name]["login_url"]) + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/lst.py b/trackers/lst.py new file mode 100644 index 0000000..3de04c9 --- /dev/null +++ b/trackers/lst.py @@ -0,0 +1,15 @@ +from .base_tracker import BaseTracker + +class LstTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "lst" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/morethantv.py b/trackers/morethantv.py new file mode 100644 index 0000000..86a4387 --- /dev/null +++ b/trackers/morethantv.py @@ -0,0 +1,41 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class MorethantvTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "morethantv" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the usernam, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element(By.ID, "login_button") + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.NAME, "code") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) + login_button = self.driver.find_element(By.ID, "login_button") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/myanonamouse.py b/trackers/myanonamouse.py new file mode 100644 index 0000000..98656f5 --- /dev/null +++ b/trackers/myanonamouse.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class MyanonamouseTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "myanonamouse" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def click_login_button(self): + login_button = self.driver.find_element(By.CLASS_NAME, "btn") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/nebulance.py b/trackers/nebulance.py new file mode 100644 index 0000000..8a2e39b --- /dev/null +++ b/trackers/nebulance.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class NebulanceTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "nebulance" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def click_login_button(self): + login_button = self.driver.find_element(By.NAME, "login") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/orpheus.py b/trackers/orpheus.py new file mode 100644 index 0000000..a8fe792 --- /dev/null +++ b/trackers/orpheus.py @@ -0,0 +1,44 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class OrpheusTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "orpheus" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + login_url = self.config[self.tracker_name]["login_url"] + + # Open the login URL + self.driver.get(login_url) + + # Find the username, password and 2fa elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + twofa_field = self.driver.find_element(By.NAME, "twofa") + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # 2FA, ask for the code + code = input( + "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " + ) + twofa_field.send_keys(code) + + login_button = self.driver.find_element(By.CLASS_NAME, "submit") + # Click on the login button + login_button.click() + + # Open the profile URL + self.driver.get(profile_url) + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/passthepopcorn.py b/trackers/passthepopcorn.py new file mode 100644 index 0000000..be9a419 --- /dev/null +++ b/trackers/passthepopcorn.py @@ -0,0 +1,49 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class PassthepopcornTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "passthepopcorn" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the usernam, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element(By.ID, "login-button") + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + captcha_container = self.driver.find_element(By.ID, "captcha_container") + + if captcha_container.get_attribute("class") == "hidden": + login_button.click() + + print("Manually solve the captcha. Press enter when done.") + code = input() + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.ID, "tfa-code") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) + verify_button = self.driver.find_element(By.CSS_SELECTOR, "input[value='Verify']") + verify_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name, is_load_at_runtime=True) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/redacted.py b/trackers/redacted.py new file mode 100644 index 0000000..86bd264 --- /dev/null +++ b/trackers/redacted.py @@ -0,0 +1,40 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class RedactedTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "redacted" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the username, password and 2fa elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + twofa_field = self.driver.find_element(By.NAME, "qrcode_confirm") + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # 2FA, ask for the code + code = input( + "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " + ) + twofa_field.send_keys(code) + + login_button = self.driver.find_element(By.CLASS_NAME, "submit") + # Click on the login button + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/reelflix.py b/trackers/reelflix.py new file mode 100644 index 0000000..bc3cd59 --- /dev/null +++ b/trackers/reelflix.py @@ -0,0 +1,15 @@ +from .base_tracker import BaseTracker + +class ReelflixTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "reelflix" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/skipthecommercials.py b/trackers/skipthecommercials.py new file mode 100644 index 0000000..b076b8a --- /dev/null +++ b/trackers/skipthecommercials.py @@ -0,0 +1,15 @@ +from .base_tracker import BaseTracker + +class SkipthecommercialsTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "skipthecommercials" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/skipthetrailers.py b/trackers/skipthetrailers.py new file mode 100644 index 0000000..f68bbf9 --- /dev/null +++ b/trackers/skipthetrailers.py @@ -0,0 +1,15 @@ +from .base_tracker import BaseTracker + +class SkipthetrailersTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "skipthetrailers" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/speedapp.py b/trackers/speedapp.py new file mode 100644 index 0000000..0e2d895 --- /dev/null +++ b/trackers/speedapp.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class SpeedappTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "speedapp" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def click_login_button(self): + login_button = self.driver.find_element(By.TAG_NAME, "button") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/swarmazon.py b/trackers/swarmazon.py new file mode 100644 index 0000000..0f670d9 --- /dev/null +++ b/trackers/swarmazon.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class SwarmazonTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "swarmazon" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login(login_url=self.config[self.tracker_name]["login_url"]) + + def click_login_button(self): + login_button = self.driver.find_element(By.NAME, "btn") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/thedarkcommunity.py b/trackers/thedarkcommunity.py new file mode 100644 index 0000000..6d22496 --- /dev/null +++ b/trackers/thedarkcommunity.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class CathoderaytubeTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "cathode-raytube" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login(login_url=self.config[self.tracker_name]["login_url"]) + + def click_login_button(self): + login_button = self.driver.find_element(By.CLASS_NAME, "submit") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file diff --git a/trackers/torrentleech.py b/trackers/torrentleech.py new file mode 100644 index 0000000..199ff16 --- /dev/null +++ b/trackers/torrentleech.py @@ -0,0 +1,20 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + +class TorrentleechTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "torrentleech" + super().__init__(driver, config, self.tracker_name) + + def login(self): + super().login() + + def click_login_button(self): + login_button = self.driver.find_element(By.CLASS_NAME, "btn") + login_button.click() + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() \ No newline at end of file From 1b486320956f647889cda04365b4d2e26ce96333 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Tue, 11 Jun 2024 13:25:07 +0100 Subject: [PATCH 03/15] Update CRT login url and support 2FA --- config.ini.example | 2 +- trackers/cathode-raytube.py | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/config.ini.example b/config.ini.example index 11aceeb..95015f5 100644 --- a/config.ini.example +++ b/config.ini.example @@ -105,7 +105,7 @@ username = YOUR USERNAME password = YOUR PASSWORD profile_url = https://www.cathode-ray.tube/user.php?id=XXX # DO NOT CHANGE -login_url = https://www.cathode-ray.tube/login.php +login_url = https://www.cathode-ray.tube/login [myanonamouse] username = YOUR EMAIL diff --git a/trackers/cathode-raytube.py b/trackers/cathode-raytube.py index 8266223..8805394 100644 --- a/trackers/cathode-raytube.py +++ b/trackers/cathode-raytube.py @@ -7,7 +7,36 @@ def __init__(self, driver, config): super().__init__(driver, config, self.tracker_name) def login(self): - super().login(login_url=self.config[self.tracker_name]["login_url"]) + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + login_url = self.config[self.tracker_name]["login_url"] + + # Open the login URL + self.driver.get(login_url) + + # Find the usernam, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element(By.ID, "login_button") + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.NAME, "code") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) + login_button = self.driver.find_element(By.ID, "login_button") + login_button.click() + + # Open the profile URL + self.driver.get(profile_url) def click_login_button(self): login_button = self.driver.find_element(By.ID, "login_button") From 0c791ebab93a229aed7d81d71278908863ad9d53 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Tue, 11 Jun 2024 13:37:55 +0100 Subject: [PATCH 04/15] Hide CRT and MTV passkeys --- trackers/base_tracker.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/trackers/base_tracker.py b/trackers/base_tracker.py index 5c88c88..be2fa2d 100644 --- a/trackers/base_tracker.py +++ b/trackers/base_tracker.py @@ -1,6 +1,7 @@ import datetime from selenium.webdriver.common.by import By -from Screenshot import Screenshot # type: ignore +from Screenshot import Screenshot # type: ignore + class BaseTracker: def __init__(self, driver, config, tracker_name): @@ -42,6 +43,17 @@ def click_login_button(self): login_button = self.driver.find_element(By.ID, "login-button") login_button.click() + def hide_passkey(self): + try: + passkey_li = self.driver.find_element( + By.XPATH, "//li[contains(text(), 'Passkey')]" + ) + self.driver.execute_script( + "arguments[0].style.display = 'none';", passkey_li + ) + except: # noqa: E722 + pass + def take_screenshot(self, tracker_name, is_load_at_runtime=False): date_string = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S") image_name = tracker_name + "_" + date_string + ".png" @@ -59,5 +71,6 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): def run(self): print("Capturing " + self.tracker_name) self.login() + self.hide_passkey() self.take_screenshot(self.tracker_name) - print("Captured " + self.tracker_name) \ No newline at end of file + print("Captured " + self.tracker_name) From 9bb55ea6ebf9e0b848b17b6fac4e96cdaac8dc6f Mon Sep 17 00:00:00 2001 From: SavageCore Date: Tue, 11 Jun 2024 14:14:49 +0100 Subject: [PATCH 05/15] Fix `usernam` typo --- trackers/beyond-hd.py | 5 +++-- trackers/blutopia.py | 9 ++++++--- trackers/cathode-raytube.py | 5 +++-- trackers/morethantv.py | 5 +++-- trackers/passthepopcorn.py | 9 ++++++--- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/trackers/beyond-hd.py b/trackers/beyond-hd.py index c9059bd..ac8127b 100644 --- a/trackers/beyond-hd.py +++ b/trackers/beyond-hd.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class BeyondhdTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "beyond-hd" @@ -14,7 +15,7 @@ def login(self): # Open the profile URL self.driver.get(profile_url) - # Find the usernam, password and login button elements + # Find the username, password and login button elements username_field = self.driver.find_element(By.NAME, "username") password_field = self.driver.find_element(By.NAME, "password") login_button = self.driver.find_element(By.ID, "login-button") @@ -43,4 +44,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/blutopia.py b/trackers/blutopia.py index 1121a01..802b2df 100644 --- a/trackers/blutopia.py +++ b/trackers/blutopia.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class BlutopiaTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "blutopia" @@ -14,10 +15,12 @@ def login(self): # Open the profile URL self.driver.get(profile_url) - # Find the usernam, password and login button elements + # Find the username, password and login button elements username_field = self.driver.find_element(By.NAME, "username") password_field = self.driver.find_element(By.NAME, "password") - login_button = self.driver.find_element(By.CLASS_NAME, "auth-form__primary-button") + login_button = self.driver.find_element( + By.CLASS_NAME, "auth-form__primary-button" + ) # Send username and password username_field.send_keys(username) @@ -36,4 +39,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/cathode-raytube.py b/trackers/cathode-raytube.py index 8805394..9c7132a 100644 --- a/trackers/cathode-raytube.py +++ b/trackers/cathode-raytube.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class CathoderaytubeTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "cathode-raytube" @@ -15,7 +16,7 @@ def login(self): # Open the login URL self.driver.get(login_url) - # Find the usernam, password and login button elements + # Find the username, password and login button elements username_field = self.driver.find_element(By.NAME, "username") password_field = self.driver.find_element(By.NAME, "password") login_button = self.driver.find_element(By.ID, "login_button") @@ -46,4 +47,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/morethantv.py b/trackers/morethantv.py index 86a4387..3d61745 100644 --- a/trackers/morethantv.py +++ b/trackers/morethantv.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class MorethantvTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "morethantv" @@ -14,7 +15,7 @@ def login(self): # Open the profile URL self.driver.get(profile_url) - # Find the usernam, password and login button elements + # Find the username, password and login button elements username_field = self.driver.find_element(By.NAME, "username") password_field = self.driver.find_element(By.NAME, "password") login_button = self.driver.find_element(By.ID, "login_button") @@ -38,4 +39,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/passthepopcorn.py b/trackers/passthepopcorn.py index be9a419..4e1a324 100644 --- a/trackers/passthepopcorn.py +++ b/trackers/passthepopcorn.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class PassthepopcornTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "passthepopcorn" @@ -14,7 +15,7 @@ def login(self): # Open the profile URL self.driver.get(profile_url) - # Find the usernam, password and login button elements + # Find the username, password and login button elements username_field = self.driver.find_element(By.NAME, "username") password_field = self.driver.find_element(By.NAME, "password") login_button = self.driver.find_element(By.ID, "login-button") @@ -39,11 +40,13 @@ def login(self): if code_field: code = input("Please enter the 2FA code: ") code_field.send_keys(code) - verify_button = self.driver.find_element(By.CSS_SELECTOR, "input[value='Verify']") + verify_button = self.driver.find_element( + By.CSS_SELECTOR, "input[value='Verify']" + ) verify_button.click() def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name, is_load_at_runtime=True) def run(self): - super().run() \ No newline at end of file + super().run() From 762de03b32efc1751b05aa3b3e3ab619e96aaad1 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Tue, 11 Jun 2024 14:19:35 +0100 Subject: [PATCH 06/15] Add black codestyle --- trackers/aither.py | 3 ++- trackers/animebytes.py | 3 ++- trackers/animetorrents.py | 3 ++- trackers/broadcasthenet.py | 5 +++-- trackers/filelist.py | 3 ++- trackers/gazellegames.py | 3 ++- trackers/greatposterwall.py | 3 ++- trackers/hdtorrents.py | 8 ++++++-- trackers/huno.py | 4 ++-- trackers/jme.py | 3 ++- trackers/lst.py | 3 ++- trackers/myanonamouse.py | 3 ++- trackers/nebulance.py | 3 ++- trackers/orpheus.py | 3 ++- trackers/redacted.py | 3 ++- trackers/reelflix.py | 3 ++- trackers/skipthecommercials.py | 3 ++- trackers/skipthetrailers.py | 3 ++- trackers/speedapp.py | 3 ++- trackers/swarmazon.py | 3 ++- trackers/thedarkcommunity.py | 3 ++- trackers/torrentleech.py | 3 ++- 22 files changed, 49 insertions(+), 25 deletions(-) diff --git a/trackers/aither.py b/trackers/aither.py index b167b3b..b478cfe 100644 --- a/trackers/aither.py +++ b/trackers/aither.py @@ -1,5 +1,6 @@ from .base_tracker import BaseTracker + class AitherTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "aither" @@ -12,4 +13,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/animebytes.py b/trackers/animebytes.py index 7f225b6..6ecfae7 100644 --- a/trackers/animebytes.py +++ b/trackers/animebytes.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class AnimebytesTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "animebytes" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/animetorrents.py b/trackers/animetorrents.py index 2f46eb0..fa4b4b4 100644 --- a/trackers/animetorrents.py +++ b/trackers/animetorrents.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class AnimetorrentsTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "animetorrents" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/broadcasthenet.py b/trackers/broadcasthenet.py index 234f47b..c2565b2 100644 --- a/trackers/broadcasthenet.py +++ b/trackers/broadcasthenet.py @@ -1,7 +1,8 @@ -from seleniumbase import SB # type: ignore +from seleniumbase import SB # type: ignore from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class BroadcasthenetTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "broadcasthenet" @@ -42,4 +43,4 @@ def run(self): sb.driver.uc_click(info_button, reconnect_time=4) # Login and save screenshot super().take_screenshot("broadcasthenet") - print("Captured " + self.tracker_name) \ No newline at end of file + print("Captured " + self.tracker_name) diff --git a/trackers/filelist.py b/trackers/filelist.py index 9794233..4855b24 100644 --- a/trackers/filelist.py +++ b/trackers/filelist.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class FilelistTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "filelist" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/gazellegames.py b/trackers/gazellegames.py index 1aaabec..49ded35 100644 --- a/trackers/gazellegames.py +++ b/trackers/gazellegames.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class GazellegamesTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "gazellegames" @@ -37,4 +38,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/greatposterwall.py b/trackers/greatposterwall.py index dc7ca47..3cbb0cf 100644 --- a/trackers/greatposterwall.py +++ b/trackers/greatposterwall.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class GreatposterwallTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "greatposterwall" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/hdtorrents.py b/trackers/hdtorrents.py index 6317fa1..87aca9e 100644 --- a/trackers/hdtorrents.py +++ b/trackers/hdtorrents.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class HdtorrentsTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "hdtorrents" @@ -16,11 +17,14 @@ def enter_credentials(self): super().enter_credentials(username_field, password_field) def click_login_button(self): - login_button = self.driver.find_element(By.XPATH, "/html/body/div[3]/table/tbody/tr/td/form/table/tbody/tr/td[1]/table/tbody/tr/td[5]/input") + login_button = self.driver.find_element( + By.XPATH, + "/html/body/div[3]/table/tbody/tr/td/form/table/tbody/tr/td[1]/table/tbody/tr/td[5]/input", + ) login_button.click() def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/huno.py b/trackers/huno.py index ad2b3a0..f524e16 100644 --- a/trackers/huno.py +++ b/trackers/huno.py @@ -1,7 +1,7 @@ - from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class HunoTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "huno" @@ -53,4 +53,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/jme.py b/trackers/jme.py index 5d8ccb6..beeb6c9 100644 --- a/trackers/jme.py +++ b/trackers/jme.py @@ -1,5 +1,6 @@ from .base_tracker import BaseTracker + class JmeTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "jme" @@ -12,4 +13,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/lst.py b/trackers/lst.py index 3de04c9..9211fdb 100644 --- a/trackers/lst.py +++ b/trackers/lst.py @@ -1,5 +1,6 @@ from .base_tracker import BaseTracker + class LstTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "lst" @@ -12,4 +13,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/myanonamouse.py b/trackers/myanonamouse.py index 98656f5..cddf68b 100644 --- a/trackers/myanonamouse.py +++ b/trackers/myanonamouse.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class MyanonamouseTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "myanonamouse" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/nebulance.py b/trackers/nebulance.py index 8a2e39b..aa8fb86 100644 --- a/trackers/nebulance.py +++ b/trackers/nebulance.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class NebulanceTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "nebulance" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/orpheus.py b/trackers/orpheus.py index a8fe792..e6bf37f 100644 --- a/trackers/orpheus.py +++ b/trackers/orpheus.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class OrpheusTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "orpheus" @@ -41,4 +42,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/redacted.py b/trackers/redacted.py index 86bd264..d3de406 100644 --- a/trackers/redacted.py +++ b/trackers/redacted.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class RedactedTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "redacted" @@ -37,4 +38,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/reelflix.py b/trackers/reelflix.py index bc3cd59..40a3845 100644 --- a/trackers/reelflix.py +++ b/trackers/reelflix.py @@ -1,5 +1,6 @@ from .base_tracker import BaseTracker + class ReelflixTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "reelflix" @@ -12,4 +13,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/skipthecommercials.py b/trackers/skipthecommercials.py index b076b8a..ee983b4 100644 --- a/trackers/skipthecommercials.py +++ b/trackers/skipthecommercials.py @@ -1,5 +1,6 @@ from .base_tracker import BaseTracker + class SkipthecommercialsTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "skipthecommercials" @@ -12,4 +13,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/skipthetrailers.py b/trackers/skipthetrailers.py index f68bbf9..0fe636d 100644 --- a/trackers/skipthetrailers.py +++ b/trackers/skipthetrailers.py @@ -1,5 +1,6 @@ from .base_tracker import BaseTracker + class SkipthetrailersTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "skipthetrailers" @@ -12,4 +13,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/speedapp.py b/trackers/speedapp.py index 0e2d895..f32de81 100644 --- a/trackers/speedapp.py +++ b/trackers/speedapp.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class SpeedappTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "speedapp" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/swarmazon.py b/trackers/swarmazon.py index 0f670d9..b4da30f 100644 --- a/trackers/swarmazon.py +++ b/trackers/swarmazon.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class SwarmazonTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "swarmazon" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/thedarkcommunity.py b/trackers/thedarkcommunity.py index 6d22496..3652a92 100644 --- a/trackers/thedarkcommunity.py +++ b/trackers/thedarkcommunity.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class CathoderaytubeTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "cathode-raytube" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() diff --git a/trackers/torrentleech.py b/trackers/torrentleech.py index 199ff16..dd36b62 100644 --- a/trackers/torrentleech.py +++ b/trackers/torrentleech.py @@ -1,6 +1,7 @@ from selenium.webdriver.common.by import By from .base_tracker import BaseTracker + class TorrentleechTracker(BaseTracker): def __init__(self, driver, config): self.tracker_name = "torrentleech" @@ -17,4 +18,4 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) def run(self): - super().run() \ No newline at end of file + super().run() From cd9696c5cb782e9ae769ef9cc3adbfc2ae11a8e1 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Mon, 17 Jun 2024 00:36:18 +0100 Subject: [PATCH 07/15] Default `full_page_screenshot` to false --- trackers/base_tracker.py | 2 +- trackers/huno.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/trackers/base_tracker.py b/trackers/base_tracker.py index be2fa2d..21ed471 100644 --- a/trackers/base_tracker.py +++ b/trackers/base_tracker.py @@ -58,7 +58,7 @@ def take_screenshot(self, tracker_name, is_load_at_runtime=False): date_string = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S") image_name = tracker_name + "_" + date_string + ".png" - if self.config["settings"]["full_page_screenshot"] == "true": + if self.config["settings"].get("full_page_screenshot", "false") == "true": self.ob.full_screenshot( self.driver, save_path="screenshots", diff --git a/trackers/huno.py b/trackers/huno.py index f524e16..872a640 100644 --- a/trackers/huno.py +++ b/trackers/huno.py @@ -46,8 +46,7 @@ def login(self): verify_button.click() def take_screenshot(self, tracker_name, is_load_at_runtime=False): - # super().take_screenshot(self.tracker_name) - if self.config["settings"]["full_page_screenshot"] == "true": + if self.config["settings"].get("full_page_screenshot", "false") == "true": super().take_screenshot(self.tracker_name, is_load_at_runtime=True) else: super().take_screenshot(self.tracker_name) From a34652a0b766791bf245f139a52e4cd3738e76fd Mon Sep 17 00:00:00 2001 From: SavageCore Date: Tue, 10 Sep 2024 01:58:00 +0100 Subject: [PATCH 08/15] Add oldtoons --- config.ini.example | 4 ++-- trackers/oldtoons.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 trackers/oldtoons.py diff --git a/config.ini.example b/config.ini.example index 95015f5..a84ce4e 100644 --- a/config.ini.example +++ b/config.ini.example @@ -10,11 +10,11 @@ full_page_screenshot = false [wanted-trackers] trackers = ["aither", "reelflix", "lst", "blutopia", "huno", "speedapp", "filelist", "greatposterwall", "jme", "animetorrents", "redacted", "skipthecommercials", "skipthetrailers", "animebytes", "thedarkcommunity", "cathode-raytube", "myanonamouse", "nebulance", "torrentleech", "orpheus", - "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd"] + "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd", "oldtoons"] # Reference: ["aither", "reelflix", "lst", "blutopia", "huno", "speedapp", "filelist", "greatposterwall", "jme", "animetorrents", # "redacted", "skipthecommercials", "skipthetrailers", "animebytes", "thedarkcommunity", "cathode-raytube", "myanonamouse", "nebulance", "torrentleech", "orpheus", -# "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd"] +# "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd", "oldtoons"] #Edit the trackers you want to use with your details. [aither] diff --git a/trackers/oldtoons.py b/trackers/oldtoons.py new file mode 100644 index 0000000..a8c6d2c --- /dev/null +++ b/trackers/oldtoons.py @@ -0,0 +1,42 @@ +from selenium.webdriver.common.by import By +from .base_tracker import BaseTracker + + +class OldtoonsTracker(BaseTracker): + def __init__(self, driver, config): + self.tracker_name = "oldtoons" + super().__init__(driver, config, self.tracker_name) + + def login(self): + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the username, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element( + By.CLASS_NAME, "auth-form__primary-button" + ) + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.ID, "code") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) + + def take_screenshot(self, tracker_name, is_load_at_runtime=False): + super().take_screenshot(self.tracker_name) + + def run(self): + super().run() From 4d2131eca771a20fedc85154fffbe6861a5d43bf Mon Sep 17 00:00:00 2001 From: SavageCore Date: Tue, 10 Sep 2024 02:12:12 +0100 Subject: [PATCH 09/15] Fix Aither login by @Slinky6267 --- trackers/aither.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/trackers/aither.py b/trackers/aither.py index b478cfe..72e0d99 100644 --- a/trackers/aither.py +++ b/trackers/aither.py @@ -1,3 +1,4 @@ +from selenium.webdriver.common.by import By from .base_tracker import BaseTracker @@ -7,7 +8,32 @@ def __init__(self, driver, config): super().__init__(driver, config, self.tracker_name) def login(self): - super().login() + username = self.config[self.tracker_name]["username"] + password = self.config[self.tracker_name]["password"] + profile_url = self.config[self.tracker_name]["profile_url"] + + # Open the profile URL + self.driver.get(profile_url) + + # Find the username, password and login button elements + username_field = self.driver.find_element(By.NAME, "username") + password_field = self.driver.find_element(By.NAME, "password") + login_button = self.driver.find_element( + By.CLASS_NAME, "auth-form__primary-button" + ) + + # Send username and password + username_field.send_keys(username) + password_field.send_keys(password) + + # Click on the login button + login_button.click() + + # 2FA is enabled, ask for the code + code_field = self.driver.find_element(By.ID, "code") + if code_field: + code = input("Please enter the 2FA code: ") + code_field.send_keys(code) def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) From b4b72d2ecb4d20fda6a879db608b218eb875453b Mon Sep 17 00:00:00 2001 From: SavageCore Date: Fri, 13 Sep 2024 02:01:26 +0100 Subject: [PATCH 10/15] Hide notifications on gazelle trackers --- trackers/base_tracker.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/trackers/base_tracker.py b/trackers/base_tracker.py index 21ed471..6fde40d 100644 --- a/trackers/base_tracker.py +++ b/trackers/base_tracker.py @@ -54,6 +54,14 @@ def hide_passkey(self): except: # noqa: E722 pass + def hide_notifications(self): + try: + self.driver.execute_script( + "document.querySelector('#noty_bottomRight_layout_container').style.display = 'none';" + ) + except: # noqa: E722 + pass + def take_screenshot(self, tracker_name, is_load_at_runtime=False): date_string = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S") image_name = tracker_name + "_" + date_string + ".png" @@ -72,5 +80,6 @@ def run(self): print("Capturing " + self.tracker_name) self.login() self.hide_passkey() + self.hide_notifications() self.take_screenshot(self.tracker_name) print("Captured " + self.tracker_name) From af8aaff75ef590d2b08946df3e25c52ec47b52c3 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Fri, 13 Sep 2024 16:43:48 +0100 Subject: [PATCH 11/15] Option to store 2FA secrets and automatically fill them --- .gitignore | 1 + config.ini.example | 12 ++--- requirements.txt | 5 +- screenshots.py | 60 ++++++++++++++++++++- trackers/aither.py | 11 +++- trackers/base_tracker.py | 2 +- trackers/beyond-hd.py | 11 +++- trackers/blutopia.py | 12 ++++- trackers/broadcasthenet.py | 15 ++++-- trackers/cathode-raytube.py | 11 +++- trackers/gazellegames.py | 16 ++++-- trackers/huno.py | 11 +++- trackers/morethantv.py | 14 ++++- trackers/oldtoons.py | 11 +++- trackers/orpheus.py | 15 ++++-- trackers/passthepopcorn.py | 11 +++- trackers/redacted.py | 15 ++++-- trackers/torrentleech.py | 31 +++++++++++ utils.py | 101 ++++++++++++++++++++++++++++++++++++ 19 files changed, 336 insertions(+), 29 deletions(-) create mode 100644 utils.py diff --git a/.gitignore b/.gitignore index ba35e2a..2dde1f5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ config.ini screenshots downloaded_files __pycache__ +secrets.ini diff --git a/config.ini.example b/config.ini.example index a84ce4e..1cee430 100644 --- a/config.ini.example +++ b/config.ini.example @@ -8,13 +8,13 @@ full_page_screenshot = false # List of supported trackers. Remove the trackers that you don't want to screenshot. Only keep what you want. [wanted-trackers] -trackers = ["aither", "reelflix", "lst", "blutopia", "huno", "speedapp", "filelist", "greatposterwall", "jme", "animetorrents", - "redacted", "skipthecommercials", "skipthetrailers", "animebytes", "thedarkcommunity", "cathode-raytube", "myanonamouse", "nebulance", "torrentleech", "orpheus", - "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd", "oldtoons"] +trackers = ["animetorrents", "animebytes", "aither", "blutopia", "beyond-hd", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", + "huno", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "redacted", "reelflix", "skipthecommercials", "skipthetrailers", + "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] -# Reference: ["aither", "reelflix", "lst", "blutopia", "huno", "speedapp", "filelist", "greatposterwall", "jme", "animetorrents", -# "redacted", "skipthecommercials", "skipthetrailers", "animebytes", "thedarkcommunity", "cathode-raytube", "myanonamouse", "nebulance", "torrentleech", "orpheus", -# "swarmazon", "morethantv", "hdtorrents", "broadcasthenet", "gazellegames", "beyond-hd", "oldtoons"] +# Reference: ["animetorrents", "animebytes", "aither", "blutopia", "beyond-hd", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", +# "huno", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "redacted", "reelflix", "skipthecommercials", "skipthetrailers", +# "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] #Edit the trackers you want to use with your details. [aither] diff --git a/requirements.txt b/requirements.txt index 36cae0c..839d033 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ seleniumbase==4.27.4 Selenium-Screenshot==2.1.0 -black==24.4.2 \ No newline at end of file +black==24.4.2 +argon2-cffi==23.1.0 +cryptography==43.0.1 +pyotp==2.9.0 \ No newline at end of file diff --git a/screenshots.py b/screenshots.py index 173b72a..f733bf0 100644 --- a/screenshots.py +++ b/screenshots.py @@ -1,12 +1,70 @@ # Required Libraries - You can change the browser driver if you would like to. More details on GitHub. -from seleniumbase import Driver # type: ignore import configparser import json +import os +from getpass import getpass + +from argon2 import PasswordHasher +from seleniumbase import Driver + +from utils import encrypt_secrets, get_decrypted_secrets # type: ignore # Read config file config = configparser.ConfigParser(interpolation=None) config.read("config.ini") +if "auto_2fa" in config["settings"] and config["settings"]["auto_2fa"] == "true": + ph = PasswordHasher() + # Check if master password is stored in config file + if "master_password" not in config["settings"]: + # Prompt the user to enter the master password + print("Master password not found in config file, please enter it.") + master_password = getpass("") + # Hash the master password + master_password_hash = ph.hash(master_password) + salt = os.urandom(16) + # Store the master password hash in the config file + config["settings"]["master_password"] = master_password_hash + config["settings"]["salt"] = salt.hex() + with open("config.ini", "w") as configfile: + config.write(configfile) + + twofa_trackers = [ + "blutopia", + "huno", + "redacted", + "broadcasthenet", + "gazellegames", + "passthepopcorn", + "beyond-hd", + "oldtoons", + "cathode-raytube", + "morethantv", + "orpheus", + "torrentleech", + ] + + # Decrypt the secrets + decrypted_secrets = get_decrypted_secrets() + + # Prompt for any missing 2FA secrets + for tracker in twofa_trackers: + if tracker not in decrypted_secrets: + decrypted_secrets[tracker] = input( + f"Please enter the 2FA secret for {tracker}: " + ) + + # Write the secrets to the secrets file + secrets_config = configparser.ConfigParser() + secrets_config.read("secrets.ini") + + # Encrypt the secrets and write them to the secrets file + encrypted_secrets = encrypt_secrets(decrypted_secrets) + secrets_config["secrets"] = encrypted_secrets + with open("secrets.ini", "w") as secretsfile: + secrets_config.write(secretsfile) + + if "browser" not in config["settings"]: config["settings"]["browser"] = "chrome" browser = config["settings"]["browser"] diff --git a/trackers/aither.py b/trackers/aither.py index 72e0d99..c34355d 100644 --- a/trackers/aither.py +++ b/trackers/aither.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -32,7 +36,12 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.ID, "code") if code_field: - code = input("Please enter the 2FA code: ") + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) def take_screenshot(self, tracker_name, is_load_at_runtime=False): diff --git a/trackers/base_tracker.py b/trackers/base_tracker.py index 6fde40d..3782cec 100644 --- a/trackers/base_tracker.py +++ b/trackers/base_tracker.py @@ -82,4 +82,4 @@ def run(self): self.hide_passkey() self.hide_notifications() self.take_screenshot(self.tracker_name) - print("Captured " + self.tracker_name) + print("Captured " + self.tracker_name + "\n") diff --git a/trackers/beyond-hd.py b/trackers/beyond-hd.py index ac8127b..61ec91f 100644 --- a/trackers/beyond-hd.py +++ b/trackers/beyond-hd.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -33,7 +37,12 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.ID, "code") if code_field: - code = input("Please enter the 2FA code: ") + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) login_button = self.driver.find_element(By.ID, "login-button") login_button.click() diff --git a/trackers/blutopia.py b/trackers/blutopia.py index 802b2df..b737c43 100644 --- a/trackers/blutopia.py +++ b/trackers/blutopia.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -32,7 +36,13 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.ID, "code") if code_field: - code = input("Please enter the 2FA code: ") + # if auto_2fa is enabled, use the 2fa secret from decrypted_secrets + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) def take_screenshot(self, tracker_name, is_load_at_runtime=False): diff --git a/trackers/broadcasthenet.py b/trackers/broadcasthenet.py index c2565b2..68ea61d 100644 --- a/trackers/broadcasthenet.py +++ b/trackers/broadcasthenet.py @@ -1,5 +1,9 @@ -from seleniumbase import SB # type: ignore +import pyotp from selenium.webdriver.common.by import By +from seleniumbase import SB # type: ignore + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -31,7 +35,12 @@ def run(self): # 2FA is enabled, ask for the code if sb.driver.find_elements(By.ID, "code"): - code = input("Please enter the 2FA code: ") + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field = "input[id='code']" sb.type(code_field, code) submit_button = "input[type='submit']" @@ -43,4 +52,4 @@ def run(self): sb.driver.uc_click(info_button, reconnect_time=4) # Login and save screenshot super().take_screenshot("broadcasthenet") - print("Captured " + self.tracker_name) + print("Captured " + self.tracker_name + "\n") diff --git a/trackers/cathode-raytube.py b/trackers/cathode-raytube.py index 9c7132a..2b955de 100644 --- a/trackers/cathode-raytube.py +++ b/trackers/cathode-raytube.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -31,7 +35,12 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.NAME, "code") if code_field: - code = input("Please enter the 2FA code: ") + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) login_button = self.driver.find_element(By.ID, "login_button") login_button.click() diff --git a/trackers/gazellegames.py b/trackers/gazellegames.py index 49ded35..4cac577 100644 --- a/trackers/gazellegames.py +++ b/trackers/gazellegames.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -25,9 +29,15 @@ def login(self): password_field.send_keys(password) # 2FA, ask for the code - code = input( - "Manually solve the captcha image. Press enter when done. (If you use 2FA then press enter after you type the code below)" - ) + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + input("Manually solve the captcha image. Press enter when done.") + else: + code = input( + "Manually solve the captcha image. Press enter when done. (If you use 2FA then press enter after you type the code below)" + ) twofa_field.send_keys(code) login_button = self.driver.find_element(By.CLASS_NAME, "submit") diff --git a/trackers/huno.py b/trackers/huno.py index 872a640..d1d7583 100644 --- a/trackers/huno.py +++ b/trackers/huno.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -39,7 +43,12 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.ID, "v_input") if code_field: - code = input("Please enter the 2FA code: ") + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) verify_button = self.driver.find_element(By.ID, "submit_verification") diff --git a/trackers/morethantv.py b/trackers/morethantv.py index 3d61745..cbcf41a 100644 --- a/trackers/morethantv.py +++ b/trackers/morethantv.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -30,7 +34,15 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.NAME, "code") if code_field: - code = input("Please enter the 2FA code: ") + decrypted_secrets = get_decrypted_secrets() + if ( + self.config["settings"]["auto_2fa"] == "true" + and self.tracker_name in decrypted_secrets + ): + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) login_button = self.driver.find_element(By.ID, "login_button") login_button.click() diff --git a/trackers/oldtoons.py b/trackers/oldtoons.py index a8c6d2c..a3b88e3 100644 --- a/trackers/oldtoons.py +++ b/trackers/oldtoons.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -32,7 +36,12 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.ID, "code") if code_field: - code = input("Please enter the 2FA code: ") + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) def take_screenshot(self, tracker_name, is_load_at_runtime=False): diff --git a/trackers/orpheus.py b/trackers/orpheus.py index e6bf37f..76fbe86 100644 --- a/trackers/orpheus.py +++ b/trackers/orpheus.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -26,9 +30,14 @@ def login(self): password_field.send_keys(password) # 2FA, ask for the code - code = input( - "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " - ) + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input( + "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " + ) twofa_field.send_keys(code) login_button = self.driver.find_element(By.CLASS_NAME, "submit") diff --git a/trackers/passthepopcorn.py b/trackers/passthepopcorn.py index 4e1a324..fb3850b 100644 --- a/trackers/passthepopcorn.py +++ b/trackers/passthepopcorn.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -38,7 +42,12 @@ def login(self): # 2FA is enabled, ask for the code code_field = self.driver.find_element(By.ID, "tfa-code") if code_field: - code = input("Please enter the 2FA code: ") + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") code_field.send_keys(code) verify_button = self.driver.find_element( By.CSS_SELECTOR, "input[value='Verify']" diff --git a/trackers/redacted.py b/trackers/redacted.py index d3de406..793382e 100644 --- a/trackers/redacted.py +++ b/trackers/redacted.py @@ -1,4 +1,8 @@ +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -25,9 +29,14 @@ def login(self): password_field.send_keys(password) # 2FA, ask for the code - code = input( - "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " - ) + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input( + "Please enter the 2FA code: (If you don't have 2FA, just press enter.) " + ) twofa_field.send_keys(code) login_button = self.driver.find_element(By.CLASS_NAME, "submit") diff --git a/trackers/torrentleech.py b/trackers/torrentleech.py index dd36b62..8b1c06f 100644 --- a/trackers/torrentleech.py +++ b/trackers/torrentleech.py @@ -1,4 +1,9 @@ +import time +import pyotp from selenium.webdriver.common.by import By + +from utils import get_decrypted_secrets + from .base_tracker import BaseTracker @@ -14,6 +19,32 @@ def click_login_button(self): login_button = self.driver.find_element(By.CLASS_NAME, "btn") login_button.click() + prefcode = self.driver.find_element(By.ID, "prefcode") + + if prefcode: + # if auto_2fa is enabled, use the 2fa secret from decrypted_secrets + if self.config["settings"]["auto_2fa"] == "true": + decrypted_secrets = get_decrypted_secrets() + totp = pyotp.TOTP(decrypted_secrets[self.tracker_name]) + code = totp.now() + else: + code = input("Please enter the 2FA code: ") + + code_fields = self.driver.find_elements(By.CLASS_NAME, "prefcode_otp") + for i in range(6): + code_fields[i].send_keys(code[i]) + + continue_button = self.driver.find_element( + By.CLASS_NAME, "button2facontinue" + ) + + time.sleep(5) + + continue_button.click() + + profile_url = self.config[self.tracker_name]["profile_url"] + self.driver.get(profile_url) + def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..2da96c0 --- /dev/null +++ b/utils.py @@ -0,0 +1,101 @@ +import base64 +import configparser +import sys +from getpass import getpass + +from argon2 import PasswordHasher +from argon2.exceptions import VerifyMismatchError +from cryptography.fernet import Fernet +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC + +_cached_master_password = None + + +# Generate a key from the master password +def generate_key(): + # Read the config file + config = configparser.ConfigParser() + config.read("config.ini") + + # Get the salt from the config file + salt = bytes.fromhex(config["settings"]["salt"]) + password = _cached_master_password + + # Derive a key using PBKDF2HMAC + kdf = PBKDF2HMAC( + algorithm=hashes.SHA256(), + length=32, + salt=salt, + iterations=100000, + backend=default_backend(), + ) + key = base64.urlsafe_b64encode(kdf.derive(password.encode("utf-8"))) + return key + + +# Encrypt the 2FA secrets +def encrypt_secrets(secrets): + key = generate_key() + + fernet = Fernet(key) + encrypted_secrets = {} + for tracker, secret in secrets.items(): + if secret == "0": + encrypted_secrets[tracker] = "0" + else: + encrypted_secrets[tracker] = fernet.encrypt(secret.encode("utf-8")).decode( + "utf-8" + ) + return encrypted_secrets + + +# Decrypt the 2FA secrets +def decrypt_secrets(encrypted_secrets): + key = generate_key() + + fernet = Fernet(key) + decrypted_secrets = {} + for tracker, encrypted_secret in encrypted_secrets.items(): + if encrypted_secret == "0": + decrypted_secrets[tracker] = "0" + else: + decrypted_secrets[tracker] = fernet.decrypt( + encrypted_secret.encode("utf-8") + ).decode("utf-8") + return decrypted_secrets + + +def get_cached_master_password(): + global _cached_master_password + return _cached_master_password + + +def get_decrypted_secrets(): + global _cached_master_password + + # Read the secrets file + secrets_config = configparser.ConfigParser() + secrets_config.read("secrets.ini") + + # Read the config file + config = configparser.ConfigParser() + config.read("config.ini") + + # Verify the master password + if _cached_master_password is None: + _cached_master_password = getpass("Enter the master password: " + "\n") + + master_password_hash = config["settings"]["master_password"] + ph = PasswordHasher() + try: + ph.verify(master_password_hash, _cached_master_password) + except VerifyMismatchError: + sys.exit(1) + + # Decrypt the secrets + encrypted_secrets = secrets_config["secrets"] + decrypted_secrets = decrypt_secrets(encrypted_secrets) + + return decrypted_secrets From e294bdbed7b090c1049bc294fabbfde1a17f9765 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Fri, 13 Sep 2024 17:27:24 +0100 Subject: [PATCH 12/15] Hide IP on CRT, MTV and OTW --- trackers/base_tracker.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/trackers/base_tracker.py b/trackers/base_tracker.py index 3782cec..b49d47e 100644 --- a/trackers/base_tracker.py +++ b/trackers/base_tracker.py @@ -62,6 +62,32 @@ def hide_notifications(self): except: # noqa: E722 pass + def hide_ip(self): + # CRT + try: + element = self.driver.find_element(By.ID, "statuscont0") + self.driver.execute_script("arguments[0].style.display = 'none';", element) + except: # noqa: E722 + pass + + # MTV + try: + element = self.driver.find_element(By.ID, "statuscont1") + self.driver.execute_script("arguments[0].style.display = 'none';", element) + except: # noqa: E722 + pass + + # OTW + try: + element = self.driver.find_element( + By.XPATH, "//h2[contains(text(), 'Clients and IP-Addresses')]" + ) + self.driver.execute_script( + "arguments[0].parentNode.style.display = 'none';", element + ) + except: # noqa: E722 + pass + def take_screenshot(self, tracker_name, is_load_at_runtime=False): date_string = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S") image_name = tracker_name + "_" + date_string + ".png" @@ -81,5 +107,6 @@ def run(self): self.login() self.hide_passkey() self.hide_notifications() + self.hide_ip() self.take_screenshot(self.tracker_name) print("Captured " + self.tracker_name + "\n") From b5b73d77f56a9fc379dc807d7675559d1c42f7c1 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Fri, 13 Sep 2024 17:29:00 +0100 Subject: [PATCH 13/15] Hide secrets on TL IRC Key RSS Key Torrent Passkey Alt 2FA Token IP / VPN warning --- trackers/torrentleech.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/trackers/torrentleech.py b/trackers/torrentleech.py index 8b1c06f..708648f 100644 --- a/trackers/torrentleech.py +++ b/trackers/torrentleech.py @@ -45,6 +45,36 @@ def click_login_button(self): profile_url = self.config[self.tracker_name]["profile_url"] self.driver.get(profile_url) + self.hide_secrets() + + def hide_secrets(self): + irc_tr = self.driver.find_element(By.XPATH, "//td[text()='IRC Key']/..") + irc_td = irc_tr.find_elements(By.XPATH, "./*")[1] + self.driver.execute_script("arguments[0].textContent = 'Hidden';", irc_td) + + rss_tr = self.driver.find_element(By.XPATH, "//td[text()='RSS Key']/..") + rss_td = rss_tr.find_elements(By.XPATH, "./*")[1] + self.driver.execute_script("arguments[0].textContent = 'Hidden';", rss_td) + + passkey_tr = self.driver.find_element( + By.XPATH, "//td[text()='Torrent Passkey']/.." + ) + passkey_td = passkey_tr.find_elements(By.XPATH, "./*")[1] + self.driver.execute_script("arguments[0].textContent = 'Hidden';", passkey_td) + + alt_2fa_tr = self.driver.find_element( + By.XPATH, "//td[text()='Alt 2FA Token']/.." + ) + alt_2fa_td = alt_2fa_tr.find_elements(By.XPATH, "./*")[1] + self.driver.execute_script("arguments[0].textContent = 'Hidden';", alt_2fa_td) + + vpn_msg_placeholder = self.driver.find_element( + By.CLASS_NAME, "vpn-msg-placeholder" + ) + self.driver.execute_script( + "arguments[0].style.display = 'none';", vpn_msg_placeholder + ) + def take_screenshot(self, tracker_name, is_load_at_runtime=False): super().take_screenshot(self.tracker_name) From 4cefe820186f93568b3d776856a82d5b45485591 Mon Sep 17 00:00:00 2001 From: SavageCore Date: Wed, 13 Nov 2024 17:10:26 +0000 Subject: [PATCH 14/15] Add missing trackers to wanted-trackers in config --- config.ini.example | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config.ini.example b/config.ini.example index 1cee430..4ed0ee1 100644 --- a/config.ini.example +++ b/config.ini.example @@ -8,13 +8,13 @@ full_page_screenshot = false # List of supported trackers. Remove the trackers that you don't want to screenshot. Only keep what you want. [wanted-trackers] -trackers = ["animetorrents", "animebytes", "aither", "blutopia", "beyond-hd", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", - "huno", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "redacted", "reelflix", "skipthecommercials", "skipthetrailers", - "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] +trackers = ["aither", "animetorrents", "animebytes", "beyond-hd", "blutopia", "broadcasthenet", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", + "huno", "jme", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "passthepopcorn", "redacted", "reelflix", "skipthecommercials", + "skipthetrailers", "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] -# Reference: ["animetorrents", "animebytes", "aither", "blutopia", "beyond-hd", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", -# "huno", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "redacted", "reelflix", "skipthecommercials", "skipthetrailers", -# "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] +# Reference: ["aither", "animetorrents", "animebytes", "beyond-hd", "blutopia", "broadcasthenet", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", + "huno", "jme", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "passthepopcorn", "redacted", "reelflix", "skipthecommercials", + "skipthetrailers", "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] #Edit the trackers you want to use with your details. [aither] From 2c8384f29c323a08f3b26128313d610607f3280f Mon Sep 17 00:00:00 2001 From: SavageCore Date: Wed, 13 Nov 2024 17:36:38 +0000 Subject: [PATCH 15/15] Ensure we only ask for the 2FA secret of chosen trackers Also fix for missing secrets.ini --- config.ini.example | 10 ++++++---- screenshots.py | 9 ++++----- utils.py | 6 +++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/config.ini.example b/config.ini.example index 4ed0ee1..ac71415 100644 --- a/config.ini.example +++ b/config.ini.example @@ -5,15 +5,17 @@ browser = chrome binary_location = C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe # Set to true if you want to take full page screenshots. Set to false if you want to take only the visible part of the page. full_page_screenshot = false +# Set to true if you want to store the 2FA secrets and use them for auto-filling 2FA codes. +auto_2fa = false # List of supported trackers. Remove the trackers that you don't want to screenshot. Only keep what you want. [wanted-trackers] -trackers = ["aither", "animetorrents", "animebytes", "beyond-hd", "blutopia", "broadcasthenet", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", - "huno", "jme", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "passthepopcorn", "redacted", "reelflix", "skipthecommercials", +trackers = ["aither", "animetorrents", "animebytes", "beyond-hd", "blutopia", "broadcasthenet", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", + "huno", "jme", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "passthepopcorn", "redacted", "reelflix", "skipthecommercials", "skipthetrailers", "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] -# Reference: ["aither", "animetorrents", "animebytes", "beyond-hd", "blutopia", "broadcasthenet", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", - "huno", "jme", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "passthepopcorn", "redacted", "reelflix", "skipthecommercials", +# Reference: ["aither", "animetorrents", "animebytes", "beyond-hd", "blutopia", "broadcasthenet", "cathode-raytube", "filelist", "gazellegames", "greatposterwall", "hdtorrents", + "huno", "jme", "lst", "morethantv", "myanonamouse", "nebulance", "oldtoons", "orpheus", "passthepopcorn", "redacted", "reelflix", "skipthecommercials", "skipthetrailers", "speedapp", "swarmazon", "thedarkcommunity", "torrentleech"] #Edit the trackers you want to use with your details. diff --git a/screenshots.py b/screenshots.py index f733bf0..862d991 100644 --- a/screenshots.py +++ b/screenshots.py @@ -13,6 +13,8 @@ config = configparser.ConfigParser(interpolation=None) config.read("config.ini") +trackers_list = json.loads(config["wanted-trackers"]["trackers"]) + if "auto_2fa" in config["settings"] and config["settings"]["auto_2fa"] == "true": ph = PasswordHasher() # Check if master password is stored in config file @@ -47,9 +49,9 @@ # Decrypt the secrets decrypted_secrets = get_decrypted_secrets() - # Prompt for any missing 2FA secrets + # Prompt for any missing 2FA secrets, as long as the tracker is also in trackers_list for tracker in twofa_trackers: - if tracker not in decrypted_secrets: + if tracker not in decrypted_secrets and tracker in trackers_list: decrypted_secrets[tracker] = input( f"Please enter the 2FA secret for {tracker}: " ) @@ -87,9 +89,6 @@ driver = Driver(uc=True, browser=browser) driver.implicitly_wait(6) - -trackers_list = json.loads(config["wanted-trackers"]["trackers"]) - # For each tracker in the config file, run the tracker class for tracker in trackers_list: try: diff --git a/utils.py b/utils.py index 2da96c0..3520c26 100644 --- a/utils.py +++ b/utils.py @@ -1,5 +1,6 @@ import base64 import configparser +import os import sys from getpass import getpass @@ -75,7 +76,10 @@ def get_cached_master_password(): def get_decrypted_secrets(): global _cached_master_password - # Read the secrets file + # Read the secrets file, create it if it doesn't exist + if not os.path.exists("secrets.ini"): + with open("secrets.ini", "w") as secretsfile: + secretsfile.write("[secrets]\n") secrets_config = configparser.ConfigParser() secrets_config.read("secrets.ini")