import requests ,re,json,pandas as pd,time
from selenium import webdriver #selenium2.48.0 支持phantomjs
from lxml import etree
import os,time
#表明我是谁??
driver=webdriver.PhantomJS(executable_path=r'C:\Users\V\Desktop\phantomjs-2.1.1-windows\bin\phantomjs.exe')

url="https://image.baidu.com/search/index?tn=baiduimage&ct=201326592&lm=-1&cl=2&ie=gb18030&word=%C3%C0%C5%AE%CD%BC%C6%AC&fr=ala&ala=1&alatpl=cover&pos=0&hs=2&xthttps=111111"
driver.get(url=url)
tree=etree.HTML(driver.page_source)

tupian_url_1=tree.xpath('.//img/@data-imgurl')

print(len(tupian_url_1))
os.makedirs('tupian_folder')#先生成一个空文件夹
a=1
for i in tupian_url_1:
a=a+1
time.sleep(1)
print(i)
response=requests.get(url=i)
with open('tupian_folder' + '/'+'美女'+str(a)+".jpg", 'wb+') as f:
f.write(response.content)
#article_folder + '/'+title+".jpg"