import requests as rq
from lxml import etree
def geturl(url):
try:
headers={'user-agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36'}
r=rq.get(url,headers=headers,timeout=300)
r.raise_for_status()
r.encoding = r.apparent_encoding
rt=r.text
s=etree.HTML(rt)
lianj='//*[@id="main"]/div/ul/li/a/img/@src'
tu_url=s.xpath(lianj)
#print(tu_url)
for j in range(1,len(tu_url),1):
x_url=str(tu_url[j][0:38]+tu_url[j][43:75]+tu_url[j][85:89])
#print(x_url)
tupian=rq.get(x_url,headers=headers,timeout=300).content
with open('i'+str(i)+'+'+