使用**完成極驗驗證碼的識別,需要了解一下幾點:
定義crackgeetest()類,該類中定義通過該驗證碼的方法。
**:
通過驗證:from selenium import webdriver
from selenium.webdriver.common.by import by
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import webdriverwait
import time
from io import bytesio
from pil import image
from selenium.webdriver import actionchains
from selenium.common.exceptions import timeoutexception
import random
"""[summary]
使用極驗滑動驗證碼的官網為例,若沒有賬號先註冊。
"""email = '873560792@qq.com'
password = '密碼'
class crackgeetest():
"""[summary]
初始化"""
def __init__(self):
self.url = ''
self.browser = webdriver.chrome()
self.wait = webdriverwait(self.browser, 5)
self.email = email
self.password = password
def __del__(self):
self.browser.close()
def open(self):
"""[summary]
輸入使用者及密碼
"""self.browser.get(self.url)
email = self.wait.until(ec.presence_of_element_located((by.id, 'email')))
password = self.wait.until(ec.presence_of_element_located((by.id, 'password')))
email.send_keys(self.email)
password.send_keys(self.password)
def get_geetest_button(self):
"""[summary]
獲取初始驗證按鈕
返回按鈕物件
"""button = self.wait.until(ec.element_to_be_clickable((by.class_name, 'geetest_radar_tip')))
return button
# 餘下**見github
Python網路爬蟲
找到url,也就是相當於入口,找到你要爬取的鏈結,獲取整個頁面資料 使用正規表示式,匹配到你想要爬取的內容,這裡使用的主要是正規表示式和一些常用的開源庫 最後一步就是寫入文字以及儲存問題了,如文字檔案 資料庫 coding utf 8 是用來指定檔案編碼為utf 8 from urllib impo...
python網路爬蟲
這篇部落格簡單的實現了乙個網路爬蟲指令碼,所謂網路爬蟲就是從 某乙個頁面 通常是首頁 開始,讀取網頁的內容,找到在網頁中的其它鏈結位址,然後通過這些鏈結位址尋找下乙個網頁,這樣一直迴圈下去,直到把這個 所有的網頁都抓取完為止。下面就是乙個簡單地網路爬蟲程式 note 這個命令的意思是,從爬去尋找關鍵...
python網路爬蟲
前言去掉所有標籤 dr re.compile r re.s dd dr.sub jiner 任意內容 可以匹配多位數字 可以匹配用逗號隔開的數字 可以匹配一位的數字 可以匹配帶小數點的數字 匹配空白符 匹配最後兩位 re.search 0 9 0 9 0 9 s.dd 當然,爬蟲還有乙個很關鍵的就通...