妹子图。。。

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/YuanYi__/article/details/81839769

代码。。这里写代码片

import requests
# from lxml import etree
import re
headers = {
    'Referer':'http://www.mzitu.com/146918/36',
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.26 Safari/537.36 Core/1.63.5702.400 QQBrowser/10.2.1893.400'
}
for i in range(3):
    url = 'http://www.mzitu.com/page/'+str(i)+'/'
    response = requests.get(url,headers=headers)
    html = response.content.decode('utf-8')
    location = re.findall(r'<li><a href="(.*?)" target="_blank"',html)
    for o in location:
        url = o
        response = requests.get(url=url,headers=headers)
        html1 = response.content.decode('utf-8')
        loca = re.findall(r'<img src="(.*?)" alt="', html1)
        for y in range(1,3):
            url1 = url+'/'+str(y)
            response = requests.get(url=url1, headers=headers)
            htt = response.content.decode('utf-8')
            image_url = re.findall(r'<img src="(.*?)" alt="',htt)
            for m in image_url:
                url2 = m
                response = requests.get(url=url2, headers=headers)
                html2 = response.content
                print(html2)
展开阅读全文

没有更多推荐了,返回首页