zoukankan      html  css  js  c++  java
  • 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 #返回字符串
  • 相关阅读:
    YII配置rabbitMQ时前期工作各种坑
    7、easyui 表单
    6、easyUI-拖放事件及应用
    5-1、easyUI-菜单与按钮(上节问题与解决)
    4、easyUI-七种布局(layout)
    3、easyUI-创建 CRUD可创建展开行明细编辑dataGrid(表格)
    redis 集群,分布式
    vue.js
    ES6标准以及支持力度
    docker使用Oracle
  • 原文地址:https://www.cnblogs.com/lqcjlu/p/11924313.html
Copyright © 2011-2022 走看看