这是验证码的src:data:image/jpg;base64,(后面省略)
可是我用xpath爬取的结果没有显示“base64,”后面的内容。
import requests
from lxml import etree
#1.对验证码图片进行捕获和识别
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36 Edg/100.0.1185.36'
}
url = 'http://www.renren.com/login?to=http%3A%2F%2Fwww.renren.com%2F'
page_text = requests.get(url=url,headers=headers).text
tree = etree.HTML(page_text)
code_img_src = tree.xpath('//*[@id="app"]/div[3]/div/div[1]/div[2]/div[2]/div[3]/div/img/@src')[0]
print(code_img_src)
data:image/jpg;base64,
Process finished with exit code 0
我希望能够显示完整的验证码src。