当前位置: 首页 > news >正文

北京wap网站开发泰安市建设职工培训中心网站进不去

北京wap网站开发,泰安市建设职工培训中心网站进不去,增城营销型网站建设,重庆最新新闻发布会配置好接码api即可实现自动化注册登录试用一体。 运行后会注册账号并绑定邮箱与手机号进行登录试用。 测试结果30秒一个号 import re import time import requests from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.options imp…配置好接码api即可实现自动化注册登录试用一体。 运行后会注册账号并绑定邮箱与手机号进行登录试用。 测试结果30秒一个号 import re import time import requests from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import logging# 配置日志记录 logging.basicConfig(levellogging.INFO, format%(asctime)s - %(levelname)s - %(message)s) logger logging.getLogger(__name__)# 获取手机验证码 def get_phone_verification_code(url):while True:try:response requests.get(url)html_content response.text# 使用正则表达式匹配验证码match re.search(rYour Poe verification code is: (\d)\., html_content)if match:code match.group(1)logging.info(提取到的手机验证码: %s, code)return code # 找到验证码则退出循环并返回验证码logging.info(未找到手机验证码继续请求...)time.sleep(1) # 等待 1 秒后再次请求except Exception as e:logging.error(请求手机验证码出错: %s, e)time.sleep(1) # 出错时等待一段时间后再次请求# 获取邮箱验证码 def get_email_verification_code(url):while True:response requests.get(url)html_content response.text# 使用正则表达式匹配 6 位数字match re.search(r\b\d{6}\b, html_content)if match:code match.group()logging.info(提取到的邮箱验证码: %s, code)return code # 找到验证码则退出循环并返回验证码# 如果页面中没有 6 位数字验证码使用 BeautifulSoup 进行解析soup BeautifulSoup(html_content, html.parser)pre_element soup.find(pre)if pre_element:code pre_element.text.strip()logging.info(提取到的邮箱验证码: %s, code)return code # 找到验证码则退出循环并返回验证码logging.info(未找到邮箱验证码继续请求...)time.sleep(1) # 等待 1 秒后再次请求# 登录循环 def login_loop(driver, wait_time):try:driver.delete_all_cookies()driver.get(https://poe.com/login)# 使用显式等待来等待按钮可见并且可点击use_phone_button WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, //button[contains(text(), 使用电话)])))use_phone_button.click()logging.info(点击了 使用电话 按钮)# 获取电话号码with open(phone.txt, r) as file:lines file.readlines()first_line lines[0].strip()phone, phone_url first_line.split(----)logging.info(获取到的电话号码: %s, phone)with open(phone.txt, w) as file:file.writelines(lines[1:])# 输入电话号码并点击下一步按钮phone_input WebDriverWait(driver, wait_time).until(EC.presence_of_element_located((By.CSS_SELECTOR, input.PhoneNumberInput_phoneNumberInput__lTKZv)))phone_input.send_keys(phone)phone_input.send_keys(Keys.RETURN)logging.info(输入电话号码并点击下一步按钮)# 输入电话号码验证码code_input WebDriverWait(driver, wait_time).until(EC.presence_of_element_located((By.CSS_SELECTOR, input.VerificationCodeInput_verificationCodeInput__RgX85)))time.sleep(5)verification_code get_phone_verification_code(phone_url)code_input.send_keys(verification_code)code_input.send_keys(Keys.RETURN)logging.info(输入电话号码验证码)# 获取邮箱with open(emai.txt, r) as file:lines file.readlines()first_line lines[0].strip()email, email_url first_line.split(----)logging.info(获取到的邮箱: %s, email)with open(emai.txt, w) as file:file.writelines(lines[1:])# 输入邮件email_input WebDriverWait(driver, wait_time).until(EC.presence_of_element_located((By.CSS_SELECTOR, input.EmailInput_emailInput__OfOQ_)))email_input.send_keys(email)email_input.send_keys(Keys.RETURN)# 输入邮件验证码verification_code_input WebDriverWait(driver, wait_time).until(EC.presence_of_element_located((By.CSS_SELECTOR, input.VerificationCodeInput_verificationCodeInput__RgX85)))time.sleep(5)logging.info(获取邮箱验证码)verification_code get_email_verification_code(email_url)logging.info(提交邮箱验证码)verification_code_input.send_keys(verification_code)verification_code_input.send_keys(Keys.RETURN)finally:# 关闭浏览器driver.quit()def main():# 设置等待时间wait_time 30 # 以秒为单位while True:try:# 创建一个Chrome浏览器实例启动无痕模式chrome_options Options()chrome_options.add_argument(user-agentMozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36)chrome_options.add_argument(--langzh-CN)chrome_options.add_argument(--disable-blink-featuresAutomationControlled)chrome_options.add_argument(--incognito) # 启动无痕模式driver webdriver.Chrome(optionschrome_options)login_loop(driver, wait_time)finally:# 关闭浏览器driver.quit()if __name__ __main__:main()
http://www.hkea.cn/news/14485779/

相关文章:

  • 互联网做视频网站需要许可证吗台州网站制作报价
  • 免费的建站软件有哪些滨海新区建设和交通局网站
  • 哪里做网站seo开发公司 网站建设
  • wordpress 资源站模板邯郸比较有名的网络推广公司
  • 做外掛网站空间北京十大室内设计工作室
  • tdk标签影响网站权重网络营销的四种策略
  • 有哪些网站可以做ps挣钱旅游网站建站
  • 贵州省城乡住房建设厅网站张家港建网站
  • 青岛seo网站排名优化微信开发流程四步
  • 一键logo设计网广州seo顾问服务
  • 长沙企业模板建站做盗版系统网站会不会
  • 有什么网站可以做平面兼职给企业做网站的公司西安
  • 法国网站域名新网站建设方案
  • 静态网站怎么做wordpress 阿里云存储
  • 本地php网站搭建怎么创建个人的网站
  • 不知名网站开发唐山房地产网站建设
  • 靖江网站建设制作wordpress 主题制件
  • 什么专业可以做网站编辑lazy load wordpress
  • 简述可口可乐公司的企业网站建设福州做网站互联网公司
  • 2018年做返利网站企业建设厂房需要办哪些证
  • 教育平台网站餐饮网站建设方案
  • 简述网站建设有哪些步骤网站做视频播放占用cpu吗
  • 福田园岭网站建设深圳网络推广渠道
  • 河北省建设注册中心网站企业网站cms源码
  • asp资源下载网站建立网站一般包括什么等方式
  • 上海网站建设服务是什么清江开发公司官网
  • 南宁网站建设加q479185700网站安全的建设目标
  • 自己做网站需要的技术临沂哪里有做网站的
  • 临沂 网站建设孟州网站开发app
  • 男女做暖暖的视频试看网站房地产开发公司的简介