import requests
import os
def download_pic():
num=input('请输入一个群QQ号:').strip()
r=url='https://qun.qq.com/cgi-bin/qun_mgr/search_group_members'
headers={'cookie':'RK=AXM7O6tvGN; pgv_pvi=3061371904; pac_uid=1_1041192092; pgv_pvid=4191324976; o_cookie=1041192092; ptcz=f91291599716fbf7f446bf5aa57920f957b99e26341209ae6bfdea8beb9acc6a; pt2gguin=o1041192092; uin=o1041192092; pgv_si=s1943470080; pgv_info=ssid=s7204878420; rv2=80257F0A3C964F480BFD052DD4EEE39A4B75C6F61E98A74353; property20=1EB4AE24C4D9070FAEDA1B167DB641F7CCCDA1BDE85487093A4A267D2180C6B6222CAB50602D77CA; skey=@gIx9jhWic; ptisp=cnc; pt4_token=bCWOG8pXqFwE2uiuZqEz39RXtQPZbfLkhD9GKyvhCPA_; p_skey=xAZt07ZkFPhjUQRmBMsXdwWegf-YN4ZIBnD3kmXUKlw_; monitor_count=8; __guid=14431543.321282391317751500.1541491631598.9312; _qpsvr_localtk=0.5875996921107682; p_uin=o1041192092'}
data = {'gc': num, 'st': '0','end':'70','sort':'0','bkn':'388269627'}
r = requests.post(url, data=data,headers=headers) # 发post请求
#print(r.json())
mems_msg=r.json().get('mems')
for mem in mems_msg:
#print(mem)
if mem.get('card'):
name=mem.get('card')
else:
name=mem.get('nick')
#print(name)
qq_num=mem.get('uin')
#print(qq_num)
url1='https://q4.qlogo.cn/g?b=qq&nk=%s&s=140'%qq_num
r = requests.get(url1)
f = open('%s.jpg'%(os.path.join(r'E:\python20181026\day8\pictures',name)), 'wb')
f.write(r.content)
f.close()
download_pic()