• python 网络请求、下载


    #获取qq群中的群成员qq号
    import requests
    members = []
    url = 'https://qun.qq.com/cgi-bin/qun_mgr/search_group_members'
    data = {'gc':93056308,'st':0,'end':20,'sort':0,'bkn':1780131332}
    #end 为获取群中qq的个数 若个数超过40 则需获取多次 第一次 0 - 40 第二次 41-80
    cookies = {'cookie':'pgv_pvid=5068418898; pgv_pvi=5954070528; RK=cLgRZwwYY2; ptcz=78e95cf667a2ffdb3d3ffc6f9ac6761499edc9d0017d98c3688b74ca05eaf9ed; ts_uid=2651496228; pac_uid=0_5d5a0945cef7f; pgv_info=ssid=s3263167933; _qpsvr_localtk=0.353670301347206; pgv_si=s4506134528; uin=o0740343919; skey=@KwasjI8j4; ptisp=cm; p_uin=o0740343919; pt4_token=fZD0cTBc7Vv2ewhOTIUciSsdg05AOkhMH66fZXyGFjQ_; p_skey=Fi2u7NF0i7KqHLb6*HPm95W8iiHNdRcNeY*P*JMivtg_; traceid=c8a9d51e8d; ts_last=qun.qq.com/member.html'}
    req = requests.post(url,data,headers=cookies)
    mem = req.json().get('mems')
    for i in mem:
    qq = i.get('uin')
    members.append(qq)
    print(members)

    import requests
    jpg_url ='https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1576911823&di=b8f93c7fdb79a39e3572b12297fb7957&imgtype=jpg&er=1&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20180807%2F88775677a47b43da90bfe25148b65025.jpeg'
    req = requests.get(jpg_url)
    f = open('桂林.jpg','wb')
    f.write(req.content)
    f.close()

    # req.content#返回二进制
    # req.json()#返回字典
    # req.text #返回字符串
  • 相关阅读:
    docker 上的第一个网址
    redis 和mongodb的区别
    在docker 里 搭建redis 主从节点
    .Net AOP 的简单入门 (静态代理 适配器模式完成aop)
    CocoaPods pod install下载慢问题
    [OC]OC基础概念
    [Swift]swift之随机数
    [Swift]iOS开发之气泡对话框的实现
    [Swift]CoreData防止数据冲突
    [Swift]iOS开发之初识CoreData
  • 原文地址:https://www.cnblogs.com/lqcjlu/p/11924313.html
Copyright © 2020-2023  润新知