# 图集原图集合
def oringin(page,name):
print(name+'正在爬取')
dir = 'G:\python 资源\python project\美桌网壁纸爬取\护眼图片\\'
oringin = []
response = requests.get(page,headers=header)
res = re.findall('li.*href="(.*)".*><img.*/li',response.text)
for url in res:
result = re.findall('(.*)" target', url)
oringin.append(result)
num = len(oringin)
for url in oringin:
count = uuid.uuid1()
res = requests.get(url.pop(), headers=header)
with open(dir+str(count)+'.jpg','wb') as file:
file.write(res.content)
# time.sleep(1)
# print(oringin)
def main(rooturl):
pagename,pageset = graph_set(rooturl)
# for url,name in dict(zip(pageset,pagename)).items():
# orin = parser(url)
# oringin(orin,name)
# print(url,name)
p = Pool()
p.map(parser,zip(pageset,pagename))
if __name__ == '__main__':
for i in range(1,6):
pageurl = rooturl + str(i) + '.html'
print(str(i)+'页面开始爬取......')
main(pageurl)