爬虫自动抓取下载妹子图网站美女大图Python源码下载

爬虫自动抓取下载妹子图网站美女大图Python源码下载

预览截图

应用介绍

详情内容

Python只需要几十行代码,就可以实现全自动爬取妹子图www.mezitu.com网站大图和高清图片美女图片。

代码片段

import requestsimport osimport timeimport threadingfrom bs4 import BeautifulSoup
 
 def download_page(url):     '''    用于下载页面    '''     headers = {"User-Agent""Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"}
    r = requests.get(url, headers=headers)
    r.encoding = 'gb2312'     return r.text
 
 def get_pic_list(html):     '''    获取每个页面的套图列表,之后循环调用get_pic函数获取图片    '''     soup = BeautifulSoup(html, 'html.parser')
    pic_list = soup.find_all('li', class_='wp-item')
    for i in pic_list:
        a_tag = i.find('h3', class_='tit').find('a')
        link = a_tag.get('href')
        text = a_tag.get_text()
        get_pic(link, text)



点赞(0) 打赏

立即下载

温馨提示! 升级VIP会员免费下载,你当前 未登录
温馨提示! 你需要支付 ¥9.80 元后才可以下载

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部