• 保存图片


    import requests
    import re

    headers = {
    "Accept": "*/*",
    "Accept-Encoding": "gzip, deflate",
    "X-Requested-With": "XMLHttpRequest",
    "Host": "tq.365taoquan.cn",
    "Cookie": "JSESSIONID=14B5326E4081413C9BD7C4BC002A53FA",
    "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 12_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.5(0x17000523) NetType/WIFI Language/zh_CN",
    "Referer": "http://tq.365taoquan.cn/seller/classify?agentId=-1&inviteBuyerId=-1&shareBuyerId=0&wxCode=365TQ",
    "Connection": "keep-alive"
    }
    url = 'http://tq.365taoquan.cn/seller/classify?agentId=-1&inviteBuyerId=-1&shareBuyerId=0&wxCode=365TQ'

    r = requests.get(url, headers=headers)
    # print(r.text)
    pic_url = re.findall(r'img class="product-img" src="(http.*?)"', r.text)
    res = re.findall((r'<p>(.*?)</p>'), r.text)
    print(res)
    print(pic_url)
    j = 5
    for i in pic_url:
    p = requests.get(i)
    with open("E:\图片logo\%s.jpg" % res[j], 'wb') as jpg:
    j += 1
    jpg.write(p.content)
  • 相关阅读:
    Mybatis的动态sql以及分页
    Mybatis入门
    使用java代码操作Redis
    Redis安装和基本操作
    idea安装以及使用
    卢卡斯定理 Lucas (p为素数)
    三分/优选法(黄金分割法)求单峰函数极值
    缩点tarjan
    tarjan 求割点
    tarjan
  • 原文地址:https://www.cnblogs.com/wapn/p/11445156.html
Copyright © 2020-2023  润新知