• 微信图


    import requests
    from lxml import etree
    # User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
    
    def body():
        url = "https://mp.weixin.qq.com/s/BzDw9nWASnOkmgWcfl6MuA"
        header = {'User-Agent':'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36'}
        respones = requests.get(url,headers=header)
        # print(respones)
        respones.encoding = "utf_8"
        html = respones.text
        obj = etree.HTML(html)
        obj_body = obj.xpath('//div[@class="rich_media_content "]//img/@data-src')
        del obj_body[0]
        print(obj_body)
        ret = len(obj_body)
        print(ret)
        obj_titer = obj.xpath('//div[@class="rich_media_content "]//strong//span/text()')
        y = []
        for i in obj_titer:
            res = i.strip('xa0xa0☟')
            y.append(res)
        print(y)
    
    
    
    
    
    
    
        for i,ref in zip(obj_body,y):
            r = requests.get(i)
            with open(r"F:day08人民日报微信图片\%s.gif"%ref,"wb") as f:
                f.write(r.content)
    
    body()
    

      

  • 相关阅读:
    201006120100630
    2010080120100901
    20101120至20101220
    201155学习总结
    PublishReport.rss
    windowservice创建及部署
    提示要角色管理工具安装Microsoft .NET Framework 3.5
    部署SSIS包
    ETL及SSIS
    IbatisNet
  • 原文地址:https://www.cnblogs.com/heluobing/p/10909667.html
Copyright © 2020-2023  润新知