m3u8 Migu video live broadcast address TVBox APP configuration

This tool obtains the live broadcast address of Migu video in real time and saves it to ./lives/migu.txt for direct use. APP配置。
http://127.0.0.1:9978/file/TVBoxx/MeowTV/TVBoxx/lives/migu.txt 

/storage/emulated/0/ The saving path of this tool/TVBoxx/MeowTV/TVBoxx/You can modify it yourself
Timeliness: about 4 hours or more, specific self-test
No stuck, no stuck, no stuck, say important things three times,.

About Migu video m3u8 analyzes ## again
https://blog.csdn.net/chouzhou9701/article/details/119260799

m3u8咪咕视频直播地址TVBox APP配置-1

import requests,json,time,random from urllib import parse from pprint import pprint # all channels: https://m.miguvideo.com/m/home/f08583e602f846a5b870f3de3b673326?plt=sub&channelId=10010001005 def get_topVomsID(): # CCTV’s vomsID : url='https://program-sc.miguvideo.com/live/v2/tv-data/a5f78af9d160418eb679a6dd0429c920' res=requests.get(url,headers=headers) res_js=json.loads(res.text)[' body'] livelist=res_js['liveList'] #all:['Popular', 'Sports', 'CCTV', 'Satellite TV', 'Local', 'Film and TV', 'News', 'Education', 'Panda', 'Entertainment', 'Children', 'Documentary', 'Impression World', 'Radio'] mychannels=['Popular', 'Sports', 'CCTV', 'Satellite TV', 'Film and TV'] # optional channel #print(livelist ) #nowVomsId=res_js['nowVomsId'] top_names,vomsIDs=[],[] for list in livelist: top_name,vomsID=list['name'],list['vomsID'] if top_name in mychannels: top_names.append(top_name ) vomsIDs.append(vomsID) print(f'channel of choice: {top_names}') return top_names,vomsIDs def get_tv_id(id): #CCTV program list now|next, icon, pID, name # CCTV: url=f'https: //program-sc.miguvideo.com/live/v2/tv-data/{id}' #print(url) res=requests.get(url,headers=headers) res_js=json.loads(res.text)[' body'] datalist=res_js['dataList'] names,pIDs=[],[] for data in datalist: name=data['name'] pID=data['pID'] names.append(name) pIDs.append (pID) nw=data.get('now','') if nw!='': now=nw['startTime']+'-'+nw['endTime']+' '+nw['playName '] if 'next' in data: nt=data['next'] next=nt['startTime']+'-'+nt['endTime']+' '+nt['playName'] print(name, pID,now,next) else:print(name,pID,now) return names,pIDs def get_play_url(pIDs): #print(pIDs) h5_urls=[] for id in pIDs: #print(id) #rateType=3HD#print(id )# live broadcast "pID":"608807420" url=f'https://webapi.miguvideo.com/gateway/playurl/v3/play/playurl?contId={id}&rateType=3&startPlay=true' #url='http: //webapi.miguvideo.com/gateway/playurl/v2/play/playurlh5?contId=635491149&rateType=3&startPlay=true' #url='https://webapi.miguvideo.com/gateway/playurl/v3/play/playurl?contId =635491149&rateType=3&startPlay=true' #'http://webapi.miguvideo.com/gateway/playurl/v2/play/playurlh5?contId=631780532&rateType=3&clientId=5e31849abe9be8ad087ca5fbd67b0e14&startPlay=true&xh265=false&channel Id=0131_10010001005' #time.sleep(1) res =requests.get(url,headers=headers) play_jsons=json.loads(res.text)##Only one source message=play_jsons["message"] if message=="SUCCESS": #pprint(play_jsons) h5_url=play_jsons[' body']['urlInfo']['url'] #TypeError: 'NoneType' Copyright restricts access #cctv1608807420 h5_urls.append(h5_url) else: print(f'ID:{id}, copyright restriction, cannot be viewed') h5_urls.append ('error') return h5_urls def ddCalcu(url): #play_url parses the getm3u8 address again new_url = parse.urlparse(url) #print(new_url) para = dict(parse.parse_qsl(new_url.query)) #print(para) userid = para .get("userid","") timestamp = para.get("timestamp","") ProgramID = para.get("ProgramID","") Channel_ID = para.get("Channel_ID","") puData = para.get("puData","") t = userid if userid else "eeeeeeeee" r = timestamp if timestamp else "ttttttttttttttt" n = ProgramID if ProgramID else "ccccccccc" a = Channel_ID if Channel_ID else "nnnnnnnnnnnnnnnn" o = puData if puData else "" if not o: return url s = list("2624") u = list(t)[int(s[0])] or "e" l = list(r)[int(s[ 1])] or "t" c = list(n)[int(s[2])] or "c" f = list(a)[len(a)-int(s[3])] or "n " d = list(o) h = [] p = 0 #print(p*2 < len(d)) while p*2 < len(d): h.append(d[len(d)-p-1] ) if p < len(d) - p -1: h.append(o[p]) if p == 1: h.append(u) if p == 2: h.append(l) if p == 3: h.append(c) if p == 4: h.append(f) p += 1 v = "".join(h) return url + "&ddCalcu=" + v def api(new_url): #th Three parsing headers={ 'Host': 'h5live.gslb.cmvideo.cn', 'Connection': 'keep-alive', 'Accept': 'text/plain, */*; q=0.01', 'X -Requested-With': 'mark.via', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en ;q=0.7', 'Origin':'http://m.miguvideo.com', 'Referer':'http://m.miguvideo.com/', 'User-Agent':'Mozilla/5.0 ( Linux; Android 10; SP300 Build/CMDCSP300;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.105 Mobile Safari/537.36'} #param={'crossdomain':'www'} time.sleep(1 ) #104: Network connection exception try #requests.exceptions.ConnectionError: try: res=requests.get(new_url,headers=headers,timeout=10) #print(res.status_code) m3u8=str(res.text) return m3u8 except requests .exceptions.ConnectionError as e: print('✘Network connection exception: ', e) return False except requests.exceptions.Timeout as e: print('✘Connection timeout: ',e) except requests.exceptions.RequestException as e: print('✘Request exception: ', e) except requests.exceptions.HTTPError as e: print(f'✘HTTP error, status code: {e.response.status_code}, {e}') except ValueError as e: print('✘Response parsing exception: ', e) def run(): top_vmos=get_topVomsID() top_names,vomsIDs=top_vmos[0],top_vmos[1] ftime = time.strftime("%Y%m%d %H:%M ", time.localtime()) s='🎈🦋🦜🍀💋🎤🎗🎖\ 🏅&1 TP5T10024;🎋🌳🍃🌱🌿☘💥\ 🥇&#129352 ' 🎖Migu live broadcast source,#genre#\n ') f.write(f'updated by caliph21_{ftime}, https://15799848.s21v.faiusr.com/58/ABUIABA6GAAgr-2n9AUoqsakNg.mp4\n') f.write('skewer, https:// vd4.bdstatic.com/mda-mkn4iq79ihtufbc1/sc/cae_h264/1637639849265611965/mda-mkn4iq79ihtufbc1.mp4\n\n') f.close() for i in range(len(vomsIDs)): pic=random.choice(s ) top_name=top_names[i] print('\n',top_name,f'{i+1}/{len(vomsIDs)}') #time.sleep(1) tv_id=get_tv_id(vomsIDs[i]) print(' \n') #time.sleep(1) h5_urls=get_play_url(tv_id[1]) f=open('lives/migu.txt','a+') f.write(f'{pic}|{top_name},#genre# \n\n') f.close() for name,url in zip(tv_id[0],h5_urls): #print(url) if url!='error': new_url=ddCalcu(url) #print(new_url) #time. sleep(1) m3u8=api(new_url+'&crossdomain=www') #print(url==new_url) if m3u8!=False: # eliminates 104 network connection exception print(f'Updating source: {name}...') #print(m3u8) with open('lives/migu.txt','a+') as f: f.write(name+','+str(m3u8)+'\n') f.close() if __name__ == '__main__': #names,pIDs=[],[] headers={'User-Agent':'Mozilla/5.0 (Linux; Android 10; SP300 Build/CMDCSP300;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/93.0.4515.105 Mobile Safari/537.36'} run() #url = "https://h5live.gslb.cmvideo.cn/migu/kailu/20200324/cctv4meihd/50/index.m3u8?msisdn=20231224165648c5b9040c723843188ccd7 b0e30f81b36&mdspid=&spid=699004&netType =0&sid=2200179344&pid=2028597139×tamp=20231224165648&Channel_ID=0116_25000000-99000-100300010010001&ProgramID=608807416&ParentNodeID=-99&assertID=2200179 344&client_ip=240e:478:4840:1642:17a3:aca9:695:be83&SecurityKey=20231224165648&promotionId=&mvid=2200179344&mcid=500020&playurlVersion=WX- A1-6.12.1.1-RELEASE&userid=&jmhm=&videocodec=h264&bean=mgsph5&puData=8c5826a81b06fdc46a46a9128be66cd0" #url='https://h5live.gslb.cmvideo.cn/wd_r2/cctv/cctv1hd/600/index.m3 u8?msisdn=202312241405015bc0ae24f1bb42dc9e16ff0f7ac931f9&mdspid=&spid =699004&netType=0&sid=2201057821&pid=2028597139×tamp=20231224140501&Channel_ID=0116_25000000-99000-100300010010001&ProgramID=608807420&ParentNodeID=-99&asser tID=2201057821&client_ip=240e:478:4840:1642:17a3:aca9:695:be83&SecurityKey=20231224140501&promotionId=&mvid=2201057821&mcid=500020&playurlVersion= WX-A1-6.12.1.1-RELEASE&userid=&jmhm=&videocodec=h264&bean=mgsph5&puData=3f841e2a0b365c2914ee68cd75073bdb' #new_url = ddCalcu(url) #print(new_url) #from transformers import CLIPModel 1 TP5Tmodel = CLIPModel.from_pretrained("openai/clip-vit-large-patch14 ", from_tf=True)

 

5/5 - (1 vote)

Leave a Reply

Your email address will not be published. Required fields are marked *