1

I'm trying to access : temp-mail.org they remove to possibility of extracting the email using an API, so i was trying to extract it using python (selenium)

I'm using the following code to avoid detection by cloudflare, but still, sometimes I got caught.

from selenium.webdriver.common.proxy import Proxy, ProxyType
from streamlit import caching
from selenium import webdriver
 
 
 
option = webdriver.ChromeOptions()
option.add_argument("user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1")
driver = webdriver.Chrome(os.getcwd()+"chromedriver.exe")



PROXY =[
{"host": "104.248.123.76", "port":18080},
{"host": "136.144.54.195", "port":80}
]
 
index = int(uniform(0, len(PROXY)))
PROXY = PROXY[index]["host"]+":"+str(PROXY[index]["port"])
 
webdriver.DesiredCapabilities.CHROME['proxy']={
    "httpProxy":PROXY,
    "ftpProxy":PROXY,
    "sslProxy":PROXY,
    "proxyType":"MANUAL",
 
}

caching.clear_cache()
driver.delete_all_cookies()

driver.get('website')

Should I need to change the website from which I'm grabbing the proxies or is there any other solutions!!

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Onavty
  • 11
  • 3

1 Answers1

0

A bit unclear why you felt Cloudflare detects your program as a bot.

To extract the Temporary Email Address from https://temp-mail.org/ you can use the following Locator Strategy based solution:

  • Code Block:

    from selenium import webdriver
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    import win32clipboard
    
    options = webdriver.ChromeOptions() 
    options.add_argument("start-maximized")
    driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
    driver.get('https://temp-mail.org/')
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='btn-rds icon-btn bg-theme click-to-copy copyIconGreenBtn']"))).click()
    # get clipboard data
    win32clipboard.OpenClipboard()
    data = win32clipboard.GetClipboardData()
    win32clipboard.CloseClipboard()
    print(data)
    
  • Console Output:

    soton18826@girtipo.com
    
  • Browser and Console snapshot: tempmail

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I already grabbed the email without using a proxy(the way that you did use), but in my case i am trying to grab it using a proxy but i get caught by CloudFlare. – Onavty Jan 05 '21 at 13:37
  • @Onavty _...using the following code to avoid detection by cloudflare..._ you don't really need proxy in this usecase. Now why your proxy is getting detected is altogether a different issue and can happen for even while accessing https://www.google.com/ – undetected Selenium Jan 05 '21 at 13:39