Last active
August 25, 2021 16:58
-
-
Save Justsoos/a3a583bcf6d8e775da449e5641e99a2a to your computer and use it in GitHub Desktop.
Revisions
-
Justsoos revised this gist
Mar 23, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def get_api(url): _hex = '0000009E10032C3C4C56066C6976657569660D6765744C6976696E67496E666F7D0000750800010604745265711D0000680A0A0300000000000000001620FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2600361777656226323031377633322E313131302E33266875796146005C0B1300000000{}2300000000{}3300000000000000000B8C980CA80C' hex_content = _hex.format( format(int(channel), 'X').zfill(8), format(int(sid), 'X').zfill(8) ) for i in range(10): r = sess.post('http://cdn.wup.huya.com/', data = bytearray.fromhex(hex_content)) if r.status_code == 200: break -
Justsoos revised this gist
Mar 23, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,7 @@ def get_api(url): vid = re.search(r'%s-%s[^f]+'%(channel, sid), r).group(0) wsSecret = re.search(r'wsSecret=([0-9a-z]{32})', r).group(1) wsTime = re.search(r'wsTime=([0-9a-z]{8})', r).group(1) line = re.search(r'://(\w+\.(flv|stream)\.huya\.com/(hqlive|huyalive))', r).group(1) flv_url = 'http://{}/{}.flv?wsSecret={}&wsTime={}'.format(line, vid, wsSecret, wsTime) return (flv_url) -
Justsoos revised this gist
Mar 23, 2018 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,10 @@ def get_api(url): _hex = '0000009E10032C3C4C56066C6976657569660D6765744C6976696E67496E666F7D0000750800010604745265711D0000680A0A0300000000000000001620FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2600361777656226323031377633322E313131302E33266875796146005C0B1300000000{}2300000000{}3300000000000000000B8C980CA80C' hex_content = _hex.format( format(int(channel), 'X').zfill(8), format(int(sid), 'X').zfill(8) ) for i in range(5): r = sess.post('http://cdn.wup.huya.com/', data = bytearray.fromhex(hex_content)) if r.status_code == 200: break r = r.content.decode('ISO-8859-1') if channel not in r: -
Justsoos revised this gist
Mar 21, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def get_api(url): hex_content = _hex.format( format(int(channel), 'X').zfill(8), format(int(sid), 'X').zfill(8) ) r = sess.post('http://cdn.wup.huya.com/', data = bytearray.fromhex(hex_content)) r = r.content.decode('ISO-8859-1') if channel not in r: raise Exception('Offline!!') -
Justsoos revised this gist
Feb 9, 2018 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,6 +32,9 @@ def get_api(url): r = sess.post('http://cdn.wup.huya.com/', data = bytearray.fromhex(hex_content)) r = r.text if channel not in r: raise Exception('Offline!!') vid = re.search(r'%s-%s[^f]+'%(channel, sid), r).group(0) wsSecret = re.search(r'wsSecret=([0-9a-z]{32})', r).group(1) -
Justsoos revised this gist
Feb 9, 2018 . 1 changed file with 21 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,36 +4,39 @@ import requests import argparse sess = requests.Session() def get_api(url): headers = {"User-Agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Mobile Safari/537.36"} url = re.sub(r'http.*huya.com','https://m.huya.com',url) r = sess.get(url,headers=headers) r = r.text try: islive = re.search(r'ISLIVE\s*=\s*([a-z]+)\s*;',r).group(1) except: raise ValueError("Can not find the ISLIVE value!!") if 'false' in islive: raise Exception('Offline') try: channel = re.search(r'TOPSID\s*=\s*\'(\d+)\'',r).group(1) sid = re.search(r'SUBSID\s*=\s*\'(\d+)\'',r).group(1) except: raise ValueError("Can not find the SID value!!") _hex = '0000009E10032C3C4C56066C6976657569660D6765744C6976696E67496E666F7D0000750800010604745265711D0000680A0A0300000000000000001620FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2600361777656226323031377633322E313131302E33266875796146005C0B1300000000{}2300000000{}3300000000000000000B8C980CA80C' hex_content = _hex.format( format(int(channel), 'X').zfill(8), format(int(sid), 'X').zfill(8) ) r = sess.post('http://cdn.wup.huya.com/', data = bytearray.fromhex(hex_content)) r = r.text vid = re.search(r'%s-%s[^f]+'%(channel, sid), r).group(0) wsSecret = re.search(r'wsSecret=([0-9a-z]{32})', r).group(1) wsTime = re.search(r'wsTime=([0-9a-z]{8})', r).group(1) line = re.search(r'://(.+\.(flv|stream)\.huya\.com/(hqlive|huyalive))', r).group(1) flv_url = 'http://{}/{}.flv?wsSecret={}&wsTime={}'.format(line, vid, wsSecret, wsTime) return (flv_url) -
Justsoos revised this gist
Jan 30, 2018 . No changes.There are no files selected for viewing
-
Justsoos revised this gist
Jan 26, 2018 . 1 changed file with 12 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,23 @@ #! /usr/bin/env python3 import re import requests import argparse def get_api(url): #r = requests.get('http://www.huya.com/{}'.format(room_id)) r = requests.get(url) try: channel = re.search(r'"channel":"(\d+)",', r.text).group(1) except: channel = re.search(r'"channel":(\d+),', r.text).group(1) try: sid = re.search(r'"sid":"(\d+)",', r.text).group(1) except: sid = re.search(r'"sid":(\d+),', r.text).group(1) if channel == '0' or sid == '0': print('Offline') raise Exception('Offline') -
Justsoos created this gist
Jan 24, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ #! /usr/bin/env python3 ''' import time import hashlib import random import sys import subprocess ''' import re import requests import argparse def get_api(url): #r = requests.get('http://www.huya.com/{}'.format(room_id)) r = requests.get(url) channel = re.search(r'"channel":"(\d+)"*,', r.text).group(1) sid = re.search(r'"sid":"(\d+)"*,', r.text).group(1) if channel == '0' or sid == '0': print('Offline') raise Exception('Offline') _hex = '0000009E10032C3C4C56066C6976657569660D6765744C6976696E67496E666F7D0000750800010604745265711D0000680A0A0300000000000000001620FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2600361777656226323031377633322E313131302E33266875796146005C0B1300000000{}2300000000{}3300000000000000000B8C980CA80C' hex_content = _hex.format( format(int(channel), 'X').zfill(8), format(int(sid), 'X').zfill(8) ) r = requests.post('http://cdn.wup.huya.com/', data = bytearray.fromhex(hex_content)) if channel not in r.text: print('Offline') raise Exception('Offline') vid = re.search(r'%s-%s[^f]+'%(channel, sid), r.text).group(0) wsSecret = re.search(r'wsSecret=([0-9a-z]{32})', r.text).group(1) wsTime = re.search(r'wsTime=([0-9a-z]{8})', r.text).group(1) line = re.search(r'://(.+\.(flv|stream)\.huya\.com/(hqlive|huyalive))', r.text).group(1) flv_url = 'http://{}/{}.flv?wsSecret={}&wsTime={}'.format(line, vid, wsSecret, wsTime) return (flv_url) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('url') parser.add_argument('ratio',nargs='?',default='') args = parser.parse_args() rid = args.url rat = args.ratio flv_url = get_api(rid) if rat: flv_url = flv_url + "&ratio=" + rat print (flv_url)