主页 M

python3应用selenium从天眼查批量采集公司邮箱

2024-11-04 网页编程网 网页编程网

1.序

先前的chrome,已被禁。

2.改用firefox

from selenium import webdriver

import time
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import re
option = webdriver.FirefoxOptions()
option.add_argument('--headless')
option.add_argument('--proxy-server=http://127.0.0.1:3096')
option.add_argument("--disable-gpu")
option.add_argument("blink-settings=imagesEnabled=false")
option.add_argument('--no-sandbox')
#option.add_argument('--hide-scrollbars')
driver = webdriver.Chrome(executable_path='/usr/local/bin/geckodriver', chrome_options=option)


url='https://www.tianyancha.com/search?key=%E4%BF%9D%E7%A8%8E%E7%89%A9%E6%B5%81&sessionNo=1730710358.83732659&base=sh&cacheCode=00310109V2020&customAreaCode=00310109V2020'
driver.get(url)
page_src = driver.page_source
#print(page_src)
allEmaill=re.findall(r'"mailto:(.*?)"',page_src)
#print(allEmaill)
for email in allEmaill:
  print(email)

#driver.quit()