def getHtml(sUrl, data=None): # S'occupe des requetes if 'firstonetv' in sUrl: cookies = GestionCookie().Readcookie('firstonetv') if 'myfree-tivi' and 'watch' in sUrl and not data is None: # VSlog(data) cookies = GestionCookie().Readcookie('myfree_tivi') headers = { 'Host': 'www.myfree-tivi.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', 'Referer': sUrl, 'X-CSRF-Token': data.replace('\n', '').replace('\r', ''), 'Connection': 'keep-alive', 'Cookie': cookies, 'Content-Length': '0', 'TE': 'Trailers' } r = requests.post('https://www.myfree-tivi.com/getdata', headers=headers) elif 'firstonetv' and '/France/' in sUrl: # On passe les redirection aResult = re.findall('Live/.+?/*[^<>]+(?:-)([^"]+)', sUrl) idChannel = aResult[0] apiNumber = random.uniform(0.0000000000000000, 0.9999999999999999) url = 'https://www.firstonetv.net/api/?cacheFucker=' + str(apiNumber) oRequestHandler = cRequestHandler(url) oRequestHandler.setRequestType(1) oRequestHandler.addHeaderEntry('User-Agent', UA) oRequestHandler.addHeaderEntry('Cookie', cookies) oRequestHandler.addParameters('action', 'hiro') oRequestHandler.addParameters('result', 'get') data = oRequestHandler.request() hiro = unFuckFirst(data) # On decode Hiro sPattern = '"hiro":(.+?),"hash":"(.+?)","time":(.+?),' oParser = cParser() aResult = oParser.parse(hiro, sPattern) for aEntry in aResult[1]: hiro = aEntry[0] Hash = aEntry[1] time = aEntry[2] apiNumber = random.uniform(0.0000000000000000, 0.9999999999999999) url = 'https://www.firstonetv.net/api/?cacheFucker=' + str(apiNumber) oRequestHandler = cRequestHandler(url) oRequestHandler.setRequestType(1) oRequestHandler.addHeaderEntry('User-Agent', UA) oRequestHandler.addHeaderEntry('Cookie', cookies) oRequestHandler.addParameters('action', 'hiro') oRequestHandler.addParameters('result', hiro) oRequestHandler.addParameters('time', time) oRequestHandler.addParameters('hash', Hash) data = oRequestHandler.request() aResult = re.findall('"ctoken":"(.+?)"}', data) cToken = aResult[0] apiNumber = random.uniform(0.0000000000000000, 0.9999999999999999) url = 'https://www.firstonetv.net/api/?cacheFucker=' + str(apiNumber) oRequestHandler = cRequestHandler(url) oRequestHandler.setRequestType(1) oRequestHandler.addHeaderEntry('User-Agent', UA) oRequestHandler.addHeaderEntry('Cookie', cookies) oRequestHandler.addParameters('action', 'channel') oRequestHandler.addParameters('ctoken', cToken) oRequestHandler.addParameters('c', 'fr') oRequestHandler.addParameters('id', idChannel) oRequestHandler.addParameters('native_hls', '0') oRequestHandler.addParameters('unsecure_hls', '0') data = oRequestHandler.request() return data elif 'firstonetv' in sUrl: oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('User-Agent', UA) oRequestHandler.addHeaderEntry('Host', 'www.firstonetv.net') oRequestHandler.addHeaderEntry('Cookie', cookies) data = oRequestHandler.request() return data if data == None and 'watch' in sUrl: oRequestHandler = cRequestHandler(sUrl) data = oRequestHandler.request() cookies = oRequestHandler.GetCookies() GestionCookie().SaveCookie('myfree_tivi', cookies) return data else: oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('User-Agent', UA) if not data is None and 'watch' in sUrl: data = r.text VSlog(data) else: data = oRequestHandler.request() # VSlog(data) return data
def getHtml(sUrl, data=None):#S'occupe des requetes if 'firstonetv' in sUrl: cookies = GestionCookie().Readcookie('firstonetv') if 'myfree-tivi' and 'watch' in sUrl and not data is None: #VSlog(data) cookies = GestionCookie().Readcookie('myfree_tivi') headers = {'Host': 'www.myfree-tivi.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', 'Referer': sUrl, 'X-CSRF-Token': data.replace('\n','').replace('\r',''), 'Connection': 'keep-alive', 'Cookie':cookies, 'Content-Length':'0', 'TE': 'Trailers'} r = requests.post('https://www.myfree-tivi.com/getdata', headers=headers) elif 'firstonetv'and '/France/' in sUrl:#On passe les redirection aResult = re.findall('Live/.+?/*[^<>]+(?:-)([^"]+)',sUrl) idChannel = aResult[0] apiNumber = random.uniform(0.0000000000000000,0.9999999999999999) url = 'https://www.firstonetv.net/api/?cacheFucker=' + str(apiNumber) oRequestHandler = cRequestHandler(url) oRequestHandler.setRequestType(1) oRequestHandler.addHeaderEntry('User-Agent',UA) oRequestHandler.addHeaderEntry('Cookie',cookies) oRequestHandler.addParameters('action','hiro') oRequestHandler.addParameters('result','get') data = oRequestHandler.request() hiro = unFuckFirst(data)#On decode Hiro sPattern = '"hiro":(.+?),"hash":"(.+?)","time":(.+?),' oParser = cParser() aResult = oParser.parse(hiro, sPattern) for aEntry in aResult[1]: hiro = aEntry[0] Hash = aEntry[1] time = aEntry[2] apiNumber = random.uniform(0.0000000000000000,0.9999999999999999) url = 'https://www.firstonetv.net/api/?cacheFucker=' + str(apiNumber) oRequestHandler = cRequestHandler(url) oRequestHandler.setRequestType(1) oRequestHandler.addHeaderEntry('User-Agent',UA) oRequestHandler.addHeaderEntry('Cookie',cookies) oRequestHandler.addParameters('action','hiro') oRequestHandler.addParameters('result',hiro) oRequestHandler.addParameters('time',time) oRequestHandler.addParameters('hash',Hash) data = oRequestHandler.request() aResult = re.findall('"ctoken":"(.+?)"}',data) cToken = aResult[0] apiNumber = random.uniform(0.0000000000000000,0.9999999999999999) url = 'https://www.firstonetv.net/api/?cacheFucker=' + str(apiNumber) oRequestHandler = cRequestHandler(url) oRequestHandler.setRequestType(1) oRequestHandler.addHeaderEntry('User-Agent',UA) oRequestHandler.addHeaderEntry('Cookie',cookies) oRequestHandler.addParameters('action','channel') oRequestHandler.addParameters('ctoken',cToken) oRequestHandler.addParameters('c','fr') oRequestHandler.addParameters('id',idChannel) oRequestHandler.addParameters('native_hls','0') oRequestHandler.addParameters('unsecure_hls','0') data = oRequestHandler.request() return data elif 'firstonetv' in sUrl: oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('User-Agent',UA) oRequestHandler.addHeaderEntry('Host','www.firstonetv.net') oRequestHandler.addHeaderEntry('Cookie',cookies) data = oRequestHandler.request() return data if data == None and 'watch' in sUrl: oRequestHandler = cRequestHandler(sUrl) data = oRequestHandler.request() cookies = oRequestHandler.GetCookies() GestionCookie().SaveCookie('myfree_tivi', cookies) return data else: oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('User-Agent',UA) if not data is None and 'watch' in sUrl: data = r.text VSlog(data) else: data = oRequestHandler.request() #VSlog(data) return data