Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何从中提取临时电子邮件地址https://temp-mail.org 使用硒_Python_Selenium_Selenium Webdriver_Clipboard_Webdriverwait - Fatal编程技术网

Python 如何从中提取临时电子邮件地址https://temp-mail.org 使用硒

Python 如何从中提取临时电子邮件地址https://temp-mail.org 使用硒,python,selenium,selenium-webdriver,clipboard,webdriverwait,Python,Selenium,Selenium Webdriver,Clipboard,Webdriverwait,我正在尝试访问:temp-mail.org,他们删除了使用API提取电子邮件的可能性,所以我尝试使用python(selenium)提取电子邮件 我正在使用下面的代码来避免被cloudflare检测到,但有时还是会被抓到 from selenium.webdriver.common.proxy import Proxy, ProxyType from streamlit import caching from selenium import webdriver option = we

我正在尝试访问:temp-mail.org,他们删除了使用API提取电子邮件的可能性,所以我尝试使用python(selenium)提取电子邮件

我正在使用下面的代码来避免被cloudflare检测到,但有时还是会被抓到

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')

我是否需要更改获取代理的网站,或者是否有其他解决方案

有点不清楚为什么你觉得你的程序是机器人

要从中提取临时电子邮件地址,可以使用以下基于的解决方案:

  • 代码块:

    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)
    
  • 控制台输出:

    soton18826@girtipo.com
    
  • 浏览器和控制台快照:


有点不清楚为什么您觉得自己的程序是一个机器人

要从中提取临时电子邮件地址,可以使用以下基于的解决方案:

  • 代码块:

    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)
    
  • 控制台输出:

    soton18826@girtipo.com
    
  • 浏览器和控制台快照:


你想访问哪个网站?我想访问:他们排除了使用API提取电子邮件的可能性,所以我想使用python(selenium)提取电子邮件。你想访问哪个网站?我想访问:他们排除了使用API提取电子邮件的可能性,因此,我尝试使用python(selenium)提取它。我已经在不使用代理的情况下抓取了电子邮件(您使用的方式),但在我的情况下,我尝试使用代理抓取它,但我被CloudFlare捕获。@Onavty…使用以下代码避免CloudFlare检测到。。。在这个用例中,您实际上不需要代理。现在,为什么会检测到您的代理是一个完全不同的问题,即使在访问时也可能发生这种情况。我已经在不使用代理的情况下抓取了电子邮件(您使用的方式),但在我的情况下,我正试图使用代理抓取它,但却被CloudFlare捕获。@Onavty…使用以下代码避免CloudFlare检测到。。。在这个用例中,您实际上不需要代理。现在,为什么会检测到您的代理是一个完全不同的问题,甚至在访问时也可能发生