Here you go
First make a new file:
Now you can select and run it
The new script is ready, I am just waiting for the test results from my beta tester to make sure it does not only run on my machine
I’m glad you did this because I’d have been here until next Christmas (not really) trying to figure out how to execute my brand new file within the Python environment.
Back in post numbers one and five when you said create a new file, give it a name and an extension of py, that’s exactly what I did, even before I installed the python environment.
So, I followed what you posted and got all the way to the save file step, but when I clicked the disc to save the file it said, file not saved. The script also didn’t have any color to it.
So, I came back to your instructions and started checking things. I noticed in one step your file name showed at the top of the screen but mine just had a question mark. Even though I had typed the file name and clicked okay, it didn’t take it, but I didn’t realize it didn’t take it because there was no error message.
I deleted that script and started over. This time everything worked fine and executed perfectly.
Thanks a lot for your help.
Cool. Happy to help. Enjoy
Here is the new version of the tool to work with the new archives:
#######################################################################################################################################################################
# ##############################################################READ ME BEFORE RUNNNG##################################################################################
# 1. Install the latest Firefox Browser for your system if you do not already have it #
# 2. You need to install Selenium for Python #
# Open a shell (Linux) or PowerShell (Windows) and type "pip install selenium" #
# 3. You need to download GeckoDriver for your OS, unpack it and place it in a location where you have executable rights (Public or user directory usually works best)#
# URL to download: https://github.com/mozilla/geckodriver/releases (Latest is recommended) #
# 4. Type in the location of your GeckoDriver from 1) in line 34 #
# 5. Save this script and make sure the ending is still .py and it is in a location where you have rights to execute it. #
# Now you are all set. Enjoy #
#######################################################################################################################################################################
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.common.by import By
import time
import re
while True:
# Enter the name you want to check
name = input("Enter a name to check:")
#Make sure the name is looked up as whole and not only a part of it
pattern = r'\b' + re.escape(name) + r'\b'
# Set up Firefox options for headless mode
options = Options()
options.add_argument("-headless")
options.add_argument("--width=1920")
options.add_argument("--height=1080")
# Path to GeckoDriver (Replace with your actual path)
driver_path = r"C:\Users\Public\geckodriver.exe"
# Setup service to run the driver
service = Service(driver_path)
# Initialize Firefox webdriver with options
driver = webdriver.Firefox(service=service, options=options)
try:
# Open the website
driver.get("https://voyeur-house.tv/moments2")
# Wait up to 10 seconds for the site to load
driver.implicitly_wait(10)
# Find the filter button and click on it to trigger the left side bar
filter_button = driver.find_element(
By.CSS_SELECTOR,
"#app > div > main > div > div > div > div > div > div > div.mb-sm.top-menu-wrapper > div.filters.mb-xs > div > a.btn.videos-filter-btn > i"
)
filter_button.click()
# Wait for the page to update
time.sleep(2)
# Find the participants drop down box
dropdown = driver.find_element(
By.CSS_SELECTOR,
"#app > div > main > div > div > div > div > div > aside > div > div:nth-child(6) > div > div.videos-aside-filter-select > div > div.multiselect__select"
)
# Scroll down to the dropdown box (Needed in headless mode)
driver.execute_script("arguments[0].scrollIntoView({block: 'center'});", dropdown)
# Click on the dropdown box to load the data for the partcipants list
dropdown.click()
# Wait for the page to update
time.sleep(2)
# Locate the loaded list element which contains the names
loaded_list = driver.find_element(By.XPATH, "/html/body/div[1]/div/main/div/div/div/div/div/aside/div/div[6]/div/div[2]/div/div[3]")
# Extract the text property of the list element which contains the names
names = driver.execute_script("return arguments[0].innerText;", loaded_list)
# Look up if the name to check is in the list of names.
if re.search(pattern, names):
print("Name taken")
else:
print("Name available")
# Exception handling
except Exception as e:
print(f"An error occurred: {e}")
input("Press Enter to exit...")
# Closing the browser
finally:
driver.quit()
# Choice if another name should be checked or the program should terminate
choice = input("Do you want to search for another name? (y/n)")
if choice.lower() != 'y':
break