# Tool to check if name is taken

**URL:** <https://forum.spyhub.tv/t/tool-to-check-if-name-is-taken/27204>\
**Category:** General Discussion\
**Created:** [February 4, 2023, 12:41am UTC](https://forum.spyhub.tv/t/tool-to-check-if-name-is-taken/27204 "2023-02-04T00:41:37Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![jabbath1987](https://forum-cdn.spyhub.tv/user_avatar/forum.spyhub.tv/jabbath1987/32/727042_2.png) [@jabbath1987](https://forum.spyhub.tv/u/jabbath1987)\
**Post date:** [January 25, 2025, 1:28pm UTC](https://forum.spyhub.tv/t/tool-to-check-if-name-is-taken/27204/31 "2025-01-25T13:28:29Z")

</div>

Here is the new version of the tool to work with the new archives:

1. It is OS agnostic but **currently does not work on Android**. I am working on a fix for that
2. **Python** installation **3.10 or newer** is required
3. Copy it into a text document and make sure the file extension is **.py**
4. **Read the _READ ME BEFORE RUNNNG_ section** at the beginning of the script and do exactly what is written there.

```auto
#######################################################################################################################################################################
# ##############################################################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 3) 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/moments")
        
        # 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

```

---

_[View the full topic](https://forum.spyhub.tv/t/tool-to-check-if-name-is-taken/27204)._
