zoukankan      html  css  js  c++  java
  • 爬取斗图

    一、 爬取斗图

    import re
    import requests
    """
    @author RansySun
    @create 2019-07-22-17:18
    """
    for i in range(1, 16):
        response = requests.get(f'https://www.doutula.com/photo/list/?page={i}')
        data = response.text
    
        """
        <img referrerpolicy="no-referrer" src="http://ww2.sinaimg.cn/bmiddle/9150e4e5gy1g58b6qkhgzj2095095t8x.jpg" style=" 100%; height: 196px;" data-original="http://ww2.sinaimg.cn/bmiddle/9150e4e5gy1g58b6qkhgzj2095095t8x.jpg" alt="滚呐" class="img-responsive lazy image_dta loaded" data-backup="http://img.doutula.com/production/uploads/image/2019/07/22/20190722785359_osqLXz.jpg" data-was-processed="true">
        
        """
        img_res = re.findall('data-original="(.*?)"', data)
        for res in img_res:
            img_response = requests.get(res)
            img_data = img_response.content
            img_name = res.split("/")[-1]
            print(res)
            with open(img_name, "wb") as fw:
                fw.write(img_data)
                fw.flush()
                print("成功")
    
    
    
    在当下的阶段,必将由程序员来主导,甚至比以往更甚。
  • 相关阅读:
    linux常用统计命令
    linux文件处理命令
    linux三剑客和管道使用
    bash编程语法
    第八章:用通配符进行过滤
    第七章:数据过滤
    第六章:过滤数据
    第五章:排序检索数据
    第四章:检索数据
    第二章:MYSQL简介
  • 原文地址:https://www.cnblogs.com/randysun/p/11231928.html
Copyright © 2011-2022 走看看