Skip to content

Instantly share code, notes, and snippets.

@loony175
Last active Sep 1, 2018
Embed
What would you like to do?
Pocket48Live
{
"张语格": 1,
"陈观慧": 3,
"呵呵姐": 4,
"袁雨桢": 5,
"董艳芸": 6,
"冯薪朵": 7,
"孙芮": 8,
"何晓玉": 10,
"温晶婕": 11,
"唐安琪": 12,
"徐子轩": 14,
"李艺彤": 16,
"蒋芸": 17,
"徐晨辰": 18,
"孔肖吟": 19,
"李宇琪": 20,
"许佳琪": 21,
"黄婷婷": 22,
"林思意": 24,
"万丽娜": 25,
"龚诗淇": 26,
"赵粤": 27,
"李清扬": 28,
"郝婉晴": 32,
"易嘉爱": 33,
"陆婷": 34,
"莫寒": 35,
"钱蓓婷": 36,
"陈思": 37,
"戴萌": 38,
"吴哲晗": 39,
"邱欣怡": 40,
"徐伊人": 43,
"谢妮": 45,
"刘佩鑫": 46,
"王柏硕": 47,
"曾艳芬": 49,
"袋王": 63,
"袁丹妮": 67,
"陈问言": 68,
"刘炅然": 1544,
"徐晗": 2470,
"张昕": 2508,
"林楠": 5562,
"吴燕文": 5564,
"许杨玉琢": 5566,
"杨惠婷": 5567,
"张雨鑫": 5574,
"SNH48": 5973,
"赵晔": 6429,
"冯晓菲": 6432,
"李晶": 6734,
"李钊": 6735,
"邵雪聪": 6737,
"宋昕冉": 6738,
"孙歆文": 6739,
"汪佳翎": 6740,
"汪束": 6741,
"王晓佳": 6742,
"谢天依": 6743,
"杨冰怡": 6744,
"闫明筠": 6745,
"杨韫玉": 6746,
"张丹三": 6747,
"影视君": 9073,
"周怡": 49003,
"沈梦瑶": 49005,
"王露皎": 49006,
"袁航": 49007,
"陈珂": 63548,
"陈美君": 63549,
"陈韫凌": 63551,
"陈雨琪": 63552,
"杜雨微": 63553,
"段艺璇": 63554,
"费沁源": 63555,
"高源婧": 63557,
"洪珮雲": 63558,
"胡晓慧": 63559,
"姜杉": 63560,
"蒋舒婷": 63561,
"林嘉佩": 63562,
"刘梦雅": 63563,
"李沁洁": 63564,
"刘筱筱": 63565,
"刘增艳": 63566,
"潘瑛琪": 63567,
"宋思娴": 63568,
"宋雨珊": 63570,
"田姝丽": 63571,
"谢蕾蕾": 63572,
"严佼君": 63574,
"阳青颖": 63576,
"曾艾佳": 63577,
"邹佳佳": 63579,
"张凯祺": 63580,
"张文静": 63581,
"张怡": 63582,
"成珏": 286973,
"黄彤扬": 286976,
"孙珍妮": 286977,
"王金铭": 286978,
"张嘉予": 286979,
"林忆宁": 286980,
"吕梦莹": 286982,
"李佳恩": 286983,
"胡怡莹": 327557,
"罗寒月": 327558,
"张琼予": 327560,
"周倩玉": 327561,
"陈慧婧": 327562,
"陈楠茜": 327563,
"陈欣妤": 327564,
"冯嘉希": 327565,
"洪静雯": 327566,
"刘力菲": 327567,
"刘倩倩": 327568,
"卢静": 327569,
"孙馨": 327570,
"唐莉佳": 327571,
"冼燊楠": 327572,
"肖文铃": 327573,
"熊心瑶": 327574,
"郑丹妮": 327575,
"左嘉欣": 327576,
"左婧媛": 327577,
"林溪荷": 327578,
"刘姝贤": 327579,
"张梦慧": 327580,
"青钰雯": 327581,
"孙姗": 327582,
"夏越": 327585,
"牛聪聪": 327586,
"冯思佳": 327587,
"陈姣荷": 327588,
"罗雪丽": 327589,
"李梓": 327591,
"李媛媛": 327592,
"李想": 327594,
"郑一凡": 327595,
"马玉灵": 327596,
"苏杉杉": 327597,
"张笑盈": 327598,
"林堃": 327599,
"顼凘炀": 327600,
"陈倩楠": 327601,
"刘胜男": 327602,
"易妍倩": 327603,
"BEJ48": 327682,
"GNZ48": 327683,
"吕一": 399631,
"潘燕琦": 399652,
"赵韩倩": 399654,
"江真仪": 399662,
"张雅梦": 399665,
"刘瀛": 399667,
"许逸": 399668,
"袁一琦": 399669,
"祁静": 399672,
"徐诗琪": 399674,
"吴月黎": 407071,
"陈逸菲": 407077,
"房蕾": 407103,
"葛司琪": 407104,
"黄恩茹": 407106,
"刘闲": 407110,
"任心怡": 407112,
"任玥霖": 407114,
"石羽莎": 407119,
"孙语姗": 407121,
"叶苗苗": 407124,
"杨晔": 407126,
"张怀瑾": 407127,
"李娜(一期生)": 407132,
"杨一帆": 407135,
"黄黎蓉": 410175,
"向芸": 410177,
"李伊虹": 410180,
"陈桂君": 417311,
"陈梓荧": 417315,
"代玲": 417316,
"杜秋霖": 417317,
"刘嘉怡": 417318,
"龙亦瑞": 417320,
"农燕萍": 417321,
"王翠菲": 417324,
"王炯义": 417325,
"王偲越": 417326,
"王秭歆": 417329,
"杨可璐": 417330,
"杨媛媛": 417331,
"于珊珊": 417332,
"张心雨": 417333,
"赵欣雨": 417335,
"许婉玉": 444081,
"李慧": 458335,
"南翎璞": 458358,
"徐静妍": 459988,
"王诗蒙": 459989,
"卢天惠": 459991,
"刘娜": 459992,
"刘娇": 459993,
"秦玺": 459994,
"赖梓惜": 459995,
"关思雨": 459996,
"朱燕": 459997,
"韩家乐": 459999,
"付紫琪": 460002,
"冯译莹": 460003,
"杨允涵": 460004,
"赵佳蕊": 460005,
"孙敏": 460007,
"SHY48": 460933,
"董思佳": 480656,
"高志娴": 480665,
"寇承希": 480666,
"刘静晗": 480667,
"李晴": 480668,
"李熙凝": 480670,
"曲悦萌": 480671,
"任雨情": 480672,
"徐斐然": 480673,
"张爱静": 480675,
"郑洁丽": 480676,
"张云梦": 480679,
"SNH48澳洲行活动1": 485376,
"SNH48澳洲行活动2": 485380,
"SNH48澳洲行活动3": 485381,
"GNZ48星梦剧院": 524597,
"SNH48星梦剧院": 526172,
"胡丽芝": 528094,
"李沐遥": 528106,
"毛其羽": 528118,
"孙晓艳": 528329,
"赵笛儿": 528334,
"金锣赛": 528335,
"兰昊": 528336,
"刘一菲": 528337,
"乔钰珂": 528339,
"陈奕君": 529991,
"菅瑞静": 530378,
"叶锦童": 530380,
"臧聪": 530381,
"郑诗琪": 530383,
"方诗涵": 530384,
"高崇": 530385,
"龚梦婷": 530386,
"逯芳竹": 530387,
"王菲妍": 530388,
"王睿琦": 530390,
"张羽涵": 530392,
"呵呵妹": 530431,
"陈俊宏": 530433,
"程一心": 530435,
"方晓瑜": 530436,
"高雪逸": 530439,
"赖俊亦": 530440,
"梁可": 530443,
"刘小末": 530444,
"唐诗怡": 530446,
"谢艾琳": 530447,
"张秋怡": 530450,
"郑悦": 530451,
"朱怡欣": 530452,
"郭倩芸": 530584,
"陶波尔": 533852,
"文文": 534729,
"沈小爱": 538697,
"金莹玥": 538735,
"赵梦婷": 540106,
"林歆源": 541132,
"CKG48": 565225,
"贺苏堃": 592320,
"孙亚萍": 593820,
"王奕": 594003,
"熊沁娴": 594005,
"梁婉琳": 601302,
"马凡": 606343,
"毕瑞珊": 607507,
"程子钰": 607510,
"符冰冰": 607513,
"黄楚茵": 607515,
"何梦瑶": 607516,
"罗可嘉": 607521,
"林芝": 607523,
"汪慕远": 607524,
"吴羽霏": 607591,
"叶晓梦": 607592,
"余芷媛": 607594,
"李彬玉": 608995,
"司珀琳": 608997,
"赵天杨": 609002,
"相望": 610040,
"唐霖": 610042,
"柏欣妤": 614528,
"李恩锐": 614725,
"李姗姗": 614727,
"雷宇霄": 614728,
"李泽亚": 614729,
"孟玥": 614730,
"毛译晗": 614731,
"谯玉珍": 614733,
"冉蔚": 614734,
"田倩兰": 614735,
"陶菀瑞": 614736,
"伍寒琪": 614738,
"王梦竹": 614739,
"王娱博": 614740,
"曾佳": 614741,
"左欣": 614742,
"周源": 614743,
"艾芷亦": 614749,
"邓倩": 614750,
"郝婧怡": 614753,
"韩林芹": 614754,
"黄琬璎": 614755,
"林舒晴": 614756,
"李瑜璇": 614757,
"石勤": 614758,
"田祯臻": 614760,
"吴学雨": 614761,
"夏文倩": 614762,
"章宇阳": 614770,
"郑阳莹": 614772,
"赵泽慧": 614773,
"吴晶晶": 614776,
"程戈": 618319,
"李娜": 623828,
"何阳青青": 624121,
"李晨曦": 624311,
"舒湘": 624312,
"王梦媛": 624313,
"徐佳音": 624314,
"肖文静": 624315,
"张紫颖": 624318,
"杨鑫": 652650,
"周洁艺": 652652,
"青春大本营": 654707,
"陈盼": 677395,
"李星羽": 677397,
"李玉倩": 677398,
"王溪源": 677399,
"王欣颜甜甜": 677400,
"杨令仪": 677401,
"杨美琪": 677402,
"张茜": 677403,
"周诗雨": 677404,
"朱小丹": 677405,
"张馨月": 677406,
"陈俊羽": 679448,
"刁滢": 679455,
"黄嘉怡": 679459,
"李苏洪": 679462,
"王嘉瑜": 679464,
"王雨兰": 679466,
"朱敏": 679467,
"戴紫薇": 707365,
"魏小燕": 707369,
"徐楚雯": 707371,
"徐慧玲": 707372,
"余梦露": 707373,
"周桐冉": 707375,
"付奕萱": 711725,
"高蔚然": 711726,
"李清雨": 711728,
"楼澍": 711730,
"曲美霖": 711735,
"熊鑫": 711739,
"杨宇馨": 711741,
"张丹丹": 711745,
"周湘": 711746,
"郭铱宁": 722778,
"梁娇": 722780,
"梁乔": 722781,
"门秀天": 722782,
"谢菲菲": 722784,
"章泽婷": 722787,
"戚予珠": 820988,
"程宇璐": 825969,
"李丽满": 825996,
"SHY48-星梦剧院": 844552,
"袋王活动直播": 846528
}
#!/usr/bin/env python3
#coding=gb18030
import json
import operator
import re
import requests
def main():
data=[]
members=[]
resp=requests.post('https://plive.48.cn/livesystem/api/live/v1/memberLivePage',headers={'Content-Type':'application/json','version':'5.3.1','os':'android'},json={'lastTime':0,'groupId':0,'memberId':0,'limit':30000}).json()
for dict in sorted(resp['content']['reviewList'],key=operator.itemgetter('memberId')):
if dict['memberId'] not in members:
data.append(dict)
members.append(dict['memberId'])
members={}
for dict in data:
if dict['memberId']==4:
member_name='呵呵姐'
elif dict['memberId']==530431:
member_name='呵呵妹'
else:
member_name=re.match(r'^(.*)的.*(回放生成中)$',dict['title']).group(1)
members[member_name]=dict['memberId']
f=open('member_id.json','w')
f.write(json.dumps(members,indent=2,ensure_ascii=False))
f.close()
if __name__=='__main__':
main()
#!/usr/bin/env python3
import argparse
import arrow
import base64
import json
import re
import requests
def get_member_id(member_name):
return json.loads(open('member_id.json','r').read())[member_name]
def request_process(is_review,last_time,group_id,member_id,limit):
resp=requests.post('https://plive.48.cn/livesystem/api/live/v1/memberLivePage',headers={'Content-Type':'application/json','version':'5.3.1','os':'android'},json={'lastTime':last_time,'groupId':group_id,'memberId':member_id,'limit':limit}).json()
if is_review:
data=resp['content']['reviewList']
else:
data=resp['content']['liveList']
intermediate=[]
for dict in data:
info={}
info['title']=dict['title']
sub_title={}
sub_title['raw']=dict['subTitle']
sub_title['base64']=bytes.decode(base64.b64encode(str.encode(dict['subTitle'])))
info['subTitle']=sub_title
info['picPath']=['https://source.48.cn%s'%obj for obj in dict['picPath'].split(',')]
start_time={}
start_time['timestamp']=dict['startTime']
start_time['datetime']=arrow.get(dict['startTime']/1000).to('Asia/Shanghai').strftime('%Y-%m-%dT%H:%M:%SZ')
info['startTime']=start_time
info['memberId']=dict['memberId']
info['liveType']=dict['liveType']
info['streamPath']=dict['streamPath'].replace('http://','https://')
intermediate.append(info)
return intermediate
def update_timestamp(intermediate):
return [dict['startTime']['timestamp'] for dict in intermediate][-1]
def filter(intermediate,type,format,members):
if type:
intermediate=[dict for dict in intermediate if dict['liveType']==type]
if format:
intermediate=[dict for dict in intermediate if '.%s'%format in dict['streamPath']]
if members:
intermediate=[dict for dict in intermediate if dict['memberId'] in members]
return intermediate
def main():
parser=argparse.ArgumentParser()
add=parser.add_argument
add('-r','--review',action='store_true')
add('-t','--last-time',type=int,default=0)
add('-g','--group',type=int,choices=[0,10,11,12,13,14],default=0)
add('-m','--member')
add('-l','--limit',type=int,default=20)
add('-T','--type',type=int,choices=[1,2])
add('-f','--format',choices=['mp4','m3u8'])
add('-M','--members',choices=['SII','NII','HII','X','Ft','B','E','J','G','NIII','Z','SIII','HIII','C','K'])
add('-d','--date',nargs='?',const='today')
add('-q','--quiet',action='store_true')
add('-n','--sum',action='store_true')
add('-N','--no-sum',action='store_true')
args=parser.parse_args()
members=None
if args.member:
member_id=get_member_id(args.member)
else:
member_id=0
if args.limit==0:
args.limit=30000
if args.date:
m=re.match('^((?P<year>\d{4})-)?((?P<month>\d{2})-)?(?P<day>\d{2})?$',args.date)
now=arrow.now('Asia/Shanghai')
try:
year=int(m.group('year') or now.year)
month=int(m.group('month') or now.month)
day=int(m.group('day') or now.day)
except AttributeError:
year=now.year
month=now.month
day=now.day
base_timestamp=arrow.get(year,month,day,tzinfo='Asia/Shanghai').timestamp*1000
args.last_time=base_timestamp+86400000
args.limit=100
num_request=args.limit
if args.type or args.format:
num_request*=2
if args.members:
num_request*=5
if args.members in ['SII','NII','HII','X','Ft']:
args.group=10
gid=10
elif args.members in ['B','E','J']:
args.group=11
gid=20
elif args.members in ['G','NIII','Z']:
args.group=12
gid=30
elif args.members in ['SIII','HIII']:
args.group=13
gid=40
elif args.members in ['C','K']:
args.group=14
gid=50
resp=requests.get('http://h5.snh48.com/resource/jsonp/members.php?gid=%d'%gid).json()
member_names=[dict['sname'] for dict in resp['rows'] if dict['tname']==args.members]
members=[]
for member in member_names:
try:
members.append(get_member_id(member))
except KeyError:
pass
intermediate=request_process(args.review,args.last_time,args.group,member_id,num_request)
if args.review:
timestamp=update_timestamp(intermediate)
intermediate=filter(intermediate,args.type,args.format,members)
if args.review:
if args.date:
while update_timestamp(intermediate)>base_timestamp:
new_intermediate=request_process(args.review,timestamp,args.group,member_id,num_request)
if len(new_intermediate)==0:
break
timestamp=update_timestamp(new_intermediate)
new_intermediate=filter(new_intermediate,args.type,args.format,members)
intermediate+=new_intermediate
intermediate=[dict for dict in intermediate if dict['startTime']['timestamp']>=base_timestamp]
else:
while len(intermediate)<args.limit:
new_intermediate=request_process(args.review,timestamp,args.group,member_id,num_request)
if len(new_intermediate)==0:
break
timestamp=update_timestamp(new_intermediate)
new_intermediate=filter(new_intermediate,args.type,args.format,members)
intermediate+=new_intermediate
intermediate=intermediate[:args.limit]
if args.quiet:
stdout=[]
for dict in intermediate:
info={}
info['title']=dict['title']
info['subTitle']=dict['subTitle']['raw']
info['startTime']=dict['startTime']['datetime']
info['streamPath']=dict['streamPath']
stdout.append(info)
else:
stdout=intermediate
if not args.sum:
print(json.dumps(stdout,indent=2,ensure_ascii=False))
if not args.no_sum:
print('%d objects found.'%len(stdout))
else:
print(len(stdout))
if __name__=='__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment