def tryTologin(self): printDBG('tryTologin start') loginUrl = self.getFullUrl('?view=perfil') if None == self.loggedIn or self.login != config.plugins.iptvplayer.dixmax_login.value or self.password != config.plugins.iptvplayer.dixmax_password.value: loginCookie = GetCookieDir('dixmax.com.login') self.login = config.plugins.iptvplayer.dixmax_login.value self.password = config.plugins.iptvplayer.dixmax_password.value sts, data = self.getPage(loginUrl) if sts: self.setMainUrl(self.cm.meta['url']) freshSession = False if sts and 'logout.php' in data: printDBG('Check hash') hash = hexlify(md5('%s@***@%s' % (self.login, self.password)).digest()) prevHash = ReadTextFile(loginCookie)[1].strip() printDBG('$hash[%s] $prevHash[%s]' % (hash, prevHash)) if hash == prevHash: self.loggedIn = True return freshSession = True rm(loginCookie) rm(self.COOKIE_FILE) if freshSession: sts, data = self.getPage(self.getMainUrl(), MergeDicts(self.defaultParams, {'use_new_session': True})) self.loggedIn = False if '' == self.login.strip() or '' == self.password.strip(): msg = _('The host %s requires registration. \nPlease fill your login and password in the host configuration. Available under blue button.' % self.getMainUrl()) self.sessionEx.waitForFinishOpen(MessageBox, msg, type=MessageBox.TYPE_INFO, timeout=10) return False msgTab = [_('Login failed.')] if sts: actionUrl = self.getFullUrl('/session.php?action=1') post_data = {'username': self.login, 'password': self.password, 'remember': '1'} httpParams = dict(self.defaultParams) httpParams['header'] = MergeDicts(httpParams['header'], {'Referer': self.cm.meta['url'], 'Accept': '*/*'}) sts, data = self.getPage(actionUrl, httpParams, post_data) printDBG(data) if sts: msgTab.append(ph.clean_html(data)) sts, data = self.getPage(loginUrl) # if sts and 'logout.php' in data: if sts and 'local_out' in data: printDBG('tryTologin OK') self.loggedIn = True else: printDBG(data) self.sessionEx.waitForFinishOpen(MessageBox, '\n'.join(msgTab), type=MessageBox.TYPE_ERROR, timeout=10) printDBG('tryTologin failed') if self.loggedIn: hash = hexlify(md5('%s@***@%s' % (self.login, self.password)).digest()) WriteTextFile(loginCookie, hash) return self.loggedIn
def stepRemoveUnnecessaryFiles(self): printDBG("stepRemoveUnnecessaryFiles") playerSelectorPath = os_path.join(self.ExtensionTmpPath, 'IPTVPlayer/icons/PlayerSelector/') logosPath = os_path.join(self.ExtensionTmpPath, 'IPTVPlayer/icons/logos/') hostsPath = os_path.join(self.ExtensionTmpPath, 'IPTVPlayer/hosts/') webPath = os_path.join(self.ExtensionTmpPath, 'IPTVPlayer/Web/') cmds = [] iconSize = int(config.plugins.iptvplayer.IconsSize.value) if not config.plugins.iptvplayer.ListaGraficzna.value: iconSize = 0 for size in [135, 120, 100]: if size != iconSize: cmds.append('rm -f %s' % (playerSelectorPath + '*{0}.png'.format(size))) cmds.append( 'rm -f %s' % (playerSelectorPath + 'marker{0}.png'.format(size + 45))) # remove Web iterface module if not needed if not config.plugins.iptvplayer.IPTVWebIterface.value: cmds.append('rm -rf %s' % (webPath)) # removing not needed hosts if config.plugins.iptvplayer.remove_diabled_hosts.value: enabledHostsList = GetEnabledHostsList() hostsFromList = GetHostsList(fromList=True, fromHostFolder=False) hostsFromFolder = GetHostsList(fromList=False, fromHostFolder=True) hostsToRemove = [] for hostItem in hostsFromList: if hostItem not in enabledHostsList and hostItem in hostsFromFolder: cmds.append( 'rm -f %s' % (playerSelectorPath + '{0}*.png'.format(hostItem))) cmds.append('rm -f %s' % (logosPath + '{0}logo.png'.format(hostItem))) cmds.append('rm -f %s' % (hostsPath + 'host{0}.py*'.format(hostItem))) # we need to prepare temporary file with removing cmds because cmd can be to long cmdFilePath = GetTmpDir('.iptv_remove_cmds.sh') cmds.insert(0, '#!/bin/sh') cmds.append('exit 0\n') text = '\n'.join(cmds) WriteTextFile(cmdFilePath, text, 'ascii') cmd = '/bin/sh "{0}" '.format(cmdFilePath) #cmd = '/bin/sh "{0}" && rm -rf "{1}" '.format(cmdFilePath, cmdFilePath) else: cmd = ' && '.join(cmds) printDBG("stepRemoveUnnecessaryFiles cmdp[%s]" % cmd) self.cmd = iptv_system(cmd, self.__removeUnnecessaryFilesCmdFinished)
def tryTologin(self): printDBG('tryTologin start') self.selectDomain() if None == self.loggedIn or self.login != config.plugins.iptvplayer.filmixco_login.value or\ self.password != config.plugins.iptvplayer.filmixco_password.value: loginCookie = GetCookieDir('filmix.co.login') self.login = config.plugins.iptvplayer.filmixco_login.value self.password = config.plugins.iptvplayer.filmixco_password.value sts, data = self.getPage(self.getMainUrl()) if sts: self.setMainUrl(self.cm.meta['url']) freshSession = False if sts and 'action=logout' in data: printDBG("Check hash") hash = hexlify(md5('%s@***@%s' % (self.login, self.password)).digest()) prevHash = ReadTextFile(loginCookie)[1].strip() printDBG("$hash[%s] $prevHash[%s]" % (hash, prevHash)) if hash == prevHash: self.loggedIn = True return else: freshSession = True rm(loginCookie) rm(self.COOKIE_FILE) if freshSession: sts, data = self.getPage(self.getMainUrl(), MergeDicts(self.defaultParams, {'use_new_session':True})) self.loggedIn = False if '' == self.login.strip() or '' == self.password.strip(): return False msgTab = [_('Login failed.')] if sts: actionUrl = self.getFullUrl('/engine/ajax/user_auth.php') post_data = {'login_name':self.login, 'login_password':self.password, 'login_not_save':'1', 'login':'******'} httpParams = dict(self.defaultParams) httpParams['header'] = MergeDicts(httpParams['header'], {'Referer':self.cm.meta['url'], 'Accept':'*/*', 'X-Requested-With':'XMLHttpRequest', 'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'}) sts, data = self.getPage(actionUrl, httpParams, post_data) printDBG(data) if sts: msgTab.append(ph.clean_html(data)) sts, data = self.getPage(self.getMainUrl()) if sts and 'action=logout' in data: printDBG('tryTologin OK') self.loggedIn = True else: printDBG(data) self.sessionEx.waitForFinishOpen(MessageBox, '\n'.join(msgTab), type = MessageBox.TYPE_ERROR, timeout = 10) printDBG('tryTologin failed') if self.loggedIn: hash = hexlify(md5('%s@***@%s' % (self.login, self.password)).digest()) WriteTextFile(loginCookie, hash) return self.loggedIn
def tryTologin(self): printDBG('tryTologin start') if None == self.loggedIn or self.login != config.plugins.iptvplayer.serienstreamto_login.value or\ self.password != config.plugins.iptvplayer.serienstreamto_password.value: loginCookie = GetCookieDir('s.to.login') self.login = config.plugins.iptvplayer.serienstreamto_login.value self.password = config.plugins.iptvplayer.serienstreamto_password.value sts, data = self.cm.getPage(self.getMainUrl(), self.defaultParams) if sts: self.setMainUrl(self.cm.meta['url']) freshSession = False if sts and '/home/logout' in data: printDBG("Check hash") hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) prevHash = ReadTextFile(loginCookie)[1].strip() printDBG("$hash[%s] $prevHash[%s]" % (hash, prevHash)) if hash == prevHash: self.loggedIn = True return else: freshSession = True rm(loginCookie) rm(self.COOKIE_FILE) if freshSession: sts, data = self.cm.getPage( self.getMainUrl(), MergeDicts(self.defaultParams, {'use_new_session': True})) self.loggedIn = False if '' == self.login.strip() or '' == self.password.strip(): return False actionUrl = self.getFullUrl('/login') post_data = { 'email': self.login, 'password': self.password, 'autoLogin': '******' } tries = 0 while tries < 3: tries += 1 errorMsg = '' httpParams = dict(self.defaultParams) httpParams['header'] = dict(httpParams['header']) httpParams['header']['Referer'] = actionUrl sts, data = self.getPage(actionUrl, httpParams, post_data) printDBG( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++") printDBG(data) printDBG( "+++++++++++++++++++++++++++++++++++++++++++++++++++++++") if sts and not data.strip(): sts, data = self.getPage(actionUrl) if sts and '/home/logout' in data: printDBG('tryTologin OK') self.loggedIn = True break elif sts: errorMsg = ph.clean_html( ph.find(data, ('<div', '>', 'messageAlert'), '</div>', flags=0)[1]) tmp1 = ph.find(data, ('<div', '>', 'formCaptcha'), '</div>', flags=0)[1] imgUrl = self.getFullUrl( ph.search(tmp1, ph.IMAGE_SRC_URI_RE)[1], self.cm.meta['url']) tmp2 = ph.find(data, ('<input', '>', 'captcha'), flags=0)[1] if imgUrl: captchaLabel = _('Captcha') captchaTitle = errorMsg sendLabel = _('Send') header = dict(httpParams['header']) header['Accept'] = 'image/png,image/*;q=0.8,*/*;q=0.5' params = dict(self.defaultParams) params.update({ 'maintype': 'image', 'subtypes': ['jpeg', 'png'], 'check_first_bytes': ['\xFF\xD8', '\xFF\xD9', '\x89\x50\x4E\x47'], 'header': header }) filePath = GetTmpDir('.iptvplayer_captcha.jpg') rm(filePath) ret = self.cm.saveWebFile(filePath, imgUrl.replace('&', '&'), params) if not ret.get('sts'): SetIPTVPlayerLastHostError( _('Fail to get "%s".') % imgUrl) return params = deepcopy(IPTVMultipleInputBox.DEF_PARAMS) params['accep_label'] = sendLabel params['title'] = captchaLabel params['status_text'] = captchaTitle params['status_text_hight'] = 200 params['with_accept_button'] = True params['list'] = [] item = deepcopy(IPTVMultipleInputBox.DEF_INPUT_PARAMS) item['label_size'] = (660, 110) item['input_size'] = (680, 25) item['icon_path'] = filePath item['title'] = _('Answer') item['input']['text'] = '' params['list'].append(item) #params['vk_params'] = {'invert_letters_case':True} ret = 0 retArg = self.sessionEx.waitForFinishOpen( IPTVMultipleInputBox, params) printDBG(retArg) if retArg and len(retArg) and retArg[0]: printDBG(retArg[0]) post_data['captcha'] = retArg[0][0] continue else: break if self.loggedIn: hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) WriteTextFile(loginCookie, hash) else: self.sessionEx.open(MessageBox, _('Login failed.') + '\n' + errorMsg, type=MessageBox.TYPE_ERROR, timeout=10) return self.loggedIn
def getVideoLinks(self, videoUrl): printDBG("BSTO.getVideoLinks [%s]" % videoUrl) urlTab = [] key = strwithmeta(videoUrl).meta.get('links_key', '') if key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if self.cacheLinks[key][idx][ 'url'] == videoUrl and not self.cacheLinks[key][idx][ 'name'].startswith('*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx]['name'] sts, data = self.getPage(videoUrl) if not sts: return [] errorMsgTab = [] baseUrl = self.cm.ph.getSearchGroups( data, '''href=['"][^'^"]*?(/out/[^'^"]+?)['"]''')[0] url = self.getFullUrl(baseUrl) prevUrl = url linkId = self.cm.ph.getSearchGroups(url, '''/out/([0-9]+)''')[0] hostUrl = BSTO.LINKS_CACHE.get(linkId, '') if hostUrl == '' and config.plugins.iptvplayer.bsto_linkcache.value: hostUrl = ReadTextFile(GetCacheSubDir('bs.to', linkId))[1] if hostUrl == '': sts, data = self.cm.getPage(prevUrl, self.defaultParams) if not sts: return [] url = data.meta['url'] if url == prevUrl: query = {} tmp = self.cm.ph.getDataBeetwenNodes(data, ('<form', '>'), ('</form', '>'), False)[1] tmp = self.cm.ph.getAllItemsBeetwenMarkers( tmp, '<input', '>', False) for item in tmp: name = self.cm.ph.getSearchGroups( item, '''name=['"]([^'^"]+?)['"]''')[0] value = self.cm.ph.getSearchGroups( item, '''value=['"]([^'^"]+?)['"]''')[0] if name != '': query[name] = value sitekey = self.cm.ph.getSearchGroups( data, '''['"]sitekey['"]\s*?:\s*?['"]([^'^"]+?)['"]''')[0] if sitekey != '' and 'bitte das Captcha' in data: token, errorMsgTab = self.processCaptcha( sitekey, self.cm.meta['url'], config.plugins.iptvplayer.bsto_bypassrecaptcha.value) if token != '': sts, data = self.cm.getPage( url + '?t=%s&s=%s' % (token, query.get('s', '')), self.defaultParams) if not sts: return [] url = data.meta['url'] if 1 != self.up.checkHostSupport(url): url = baseUrl.replace('/out/', '/watch/')[1:] hostUrl = '' try: sts, data = self.cm.getPage(self.getFullUrl('/api/' + url), self.getHeaders(url)) if not sts: return [] data = byteify(json.loads(data)) printDBG(data) hostUrl = data['fullurl'] except Exception: printExc() else: hostUrl = url if 1 != self.up.checkHostSupport(hostUrl): SetIPTVPlayerLastHostError('\n'.join(errorMsgTab)) elif self.cm.isValidUrl(hostUrl): BSTO.LINKS_CACHE[linkId] = hostUrl if config.plugins.iptvplayer.bsto_linkcache.value: WriteTextFile(GetCacheSubDir('bs.to', linkId), hostUrl) urlTab = self.up.getVideoLinkExt(hostUrl) return urlTab
def tryTologin(self): printDBG('tryTologin start') if None == self.loggedIn or self.login != config.plugins.iptvplayer.vidcorn_login.value or\ self.password != config.plugins.iptvplayer.vidcorn_password.value: loginCookie = GetCookieDir('vidcorn.com.login') self.login = config.plugins.iptvplayer.vidcorn_login.value self.password = config.plugins.iptvplayer.vidcorn_password.value sts, data = self.getPage(self.getMainUrl()) if sts: self.setMainUrl(self.cm.meta['url']) freshSession = False if sts and '/logout' in data: printDBG("Check hash") hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) prevHash = ReadTextFile(loginCookie)[1].strip() printDBG("$hash[%s] $prevHash[%s]" % (hash, prevHash)) if hash == prevHash: self.loggedIn = True return else: freshSession = True rm(loginCookie) rm(self.COOKIE_FILE) if freshSession: sts, data = self.getPage( self.getMainUrl(), MergeDicts(self.defaultParams, {'use_new_session': True})) self.loggedIn = False if '' == self.login.strip() or '' == self.password.strip(): return False if sts: data = self.cm.ph.getDataBeetwenNodes( data, ('<form', '>', 'login-form'), ('</form', '>'), True, False)[1] actionUrl = self.getFullUrl('/services/login') post_data = {'username': self.login, 'password': self.password} sitekey = self.cm.ph.getSearchGroups( data, '''sitekey=['"]([^'^"]+?)['"]''')[0] if sitekey != '': token, errorMsgTab = self.processCaptcha( sitekey, self.cm.meta['url']) if token == '': return False post_data['g-recaptcha-response'] = token httpParams = dict(self.defaultParams) httpParams['header'] = MergeDicts( httpParams['header'], { 'Referer': self.cm.meta['url'], 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }) sts, data = self.getPage(actionUrl, httpParams, post_data) if sts and data.strip() == 'success': printDBG('tryTologin OK') self.loggedIn = True else: msgTab = [_('Login failed.')] if sts: data = self.cm.ph.getAllItemsBeetwenMarkers( data, 'error-modal', ');') for item in data: item = self.cleanHtmlStr( self.cm.ph.getDataBeetwenMarkers( item, '(', ')', False)[1].strip()[1:-1]) if item != '': msgTab.append(item) self.sessionEx.waitForFinishOpen(MessageBox, '\n'.join(msgTab), type=MessageBox.TYPE_ERROR, timeout=10) printDBG('tryTologin failed') if self.loggedIn: hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) WriteTextFile(loginCookie, hash) return self.loggedIn
def start(self, url, filePath, params={}): ''' Owervrite start from BaseDownloader ''' self.url = url self.filePath = filePath self.downloaderParams = params self.fileExtension = '' # should be implemented in future self.outData = '' self.contentType = 'unknown' cmdTab = [DMHelper.GET_FFMPEG_PATH(), '-y'] tmpUri = strwithmeta(url) if 'iptv_video_rep_idx' in tmpUri.meta: cmdTab.extend( ['-video_rep_index', str(tmpUri.meta['iptv_video_rep_idx'])]) if 'iptv_audio_rep_idx' in tmpUri.meta: cmdTab.extend( ['-audio_rep_index', str(tmpUri.meta['iptv_audio_rep_idx'])]) if 'iptv_m3u8_live_start_index' in tmpUri.meta: cmdTab.extend([ '-live_start_index', str(tmpUri.meta['iptv_m3u8_live_start_index']) ]) if 'iptv_m3u8_key_uri_replace_old' in tmpUri.meta and 'iptv_m3u8_key_uri_replace_new' in tmpUri.meta: cmdTab.extend([ '-key_uri_old', str(tmpUri.meta['iptv_m3u8_key_uri_replace_old']), '-key_uri_new', str(tmpUri.meta['iptv_m3u8_key_uri_replace_new']) ]) if "://" in self.url: url, httpParams = DMHelper.getDownloaderParamFromUrlWithMeta( tmpUri, True) headers = [] for key in httpParams: if key == 'Range': #Range is always used by ffmpeg continue elif key == 'User-Agent': cmdTab.extend(['-user-agent', httpParams[key]]) else: headers.append('%s: %s' % (key, httpParams[key])) if len(headers): cmdTab.extend(['-headers', '\r\n'.join(headers)]) if self.url.startswith("merge://"): try: urlsKeys = self.url.split('merge://', 1)[1].split('|') for item in urlsKeys: cmdTab.extend(['-i', self.url.meta[item]]) except Exception: printExc() else: cmdTab.extend(['-i', url]) cmdTab.extend([ '-c:v', 'copy', '-c:a', 'copy', '-f', self.ffmpegOutputContener, self.filePath ]) self.fileCmdPath = self.filePath + '.iptv.cmd' rm(self.fileCmdPath) WriteTextFile(self.fileCmdPath, '|'.join(cmdTab)) cmd = GetCmdwrapPath() + (' "%s" "|" %s ' % (self.fileCmdPath, GetNice() + 2)) printDBG("FFMPEGDownloader::start cmd[%s]" % cmd) self.console = eConsoleAppContainer() self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self._cmdFinished) self.console_stderrAvail_conn = eConnectCallback( self.console.stderrAvail, self._dataAvail) self.console.execute(cmd) self.status = DMHelper.STS.DOWNLOADING self.onStart() return BaseDownloader.CODE_OK
def js_execute_ext(items, params={}): fileList = [] tmpFiles = [] tid = thread.get_ident() uniqueId = 0 ret = {'sts': False, 'code': -13, 'data': ''} try: for item in items: # we can have source file or source code path = item.get('path', '') code = item.get('code', '') name = item.get('name', '') if name: # cache enabled hash = item.get('hash', '') if not hash: # we will need to calc hash by our self if path: sts, code = ReadTextFile(path) if not sts: raise Exception('Faile to read file "%s"!' % path) hash = hexlify(md5(code).digest()) byteFileName = GetJSCacheDir(name + '.byte') metaFileName = GetJSCacheDir(name + '.meta') if fileExists(byteFileName): sts, tmp = ReadTextFile(metaFileName) if sts: tmp = tmp.split('|') # DUKTAPE_VER|hash if DUKTAPE_VER != tmp[0] or hash != tmp[-1].strip(): sts = False if not sts: rm(byteFileName) rm(metaFileName) else: sts = False if not sts: # we need compile here if not path: path = '.%s.js' % name sts, path = CreateTmpFile(path, code) if not sts: raise Exception('Faile to create file "%s" "%s"' % (path, code)) tmpFiles.append(path) # remove old meta rm(metaFileName) # compile if 0 != duktape_execute('-c "%s" "%s" ' % (byteFileName, path))['code']: raise Exception( 'Compile to bytecode file "%s" > "%s" failed!' % (path, byteFileName)) # update meta if not WriteTextFile(metaFileName, '%s|%s' % (DUKTAPE_VER, hash)): raise Exception('Faile to write "%s" file!' % metaFileName) fileList.append(byteFileName) else: if path: fileList.append(path) else: path = 'e2i_js_exe_%s_%s.js' % (uniqueId, tid) uniqueId += 1 sts, path = CreateTmpFile(path, code) if not sts: raise Exception('Faile to create file "%s"' % path) tmpFiles.append(path) fileList.append(path) #ret = duktape_execute('-t %s ' % params.get('timeout_sec', 20) + ' '.join([ '"%s"' % file for file in fileList ]) ) ret = duktape_execute(' '.join(['"%s"' % file for file in fileList])) except Exception: printExc() # leave last script for debug purpose if getDebugMode() == '': for file in tmpFiles: rm(file) return ret
def getVideoLinks(self, videoUrl): printDBG("MRPiracyGQ.getVideoLinks [%s]" % videoUrl) errorMsgTab = [] urlTab = [] # mark requested link as used one if len(self.cacheLinks.keys()): for key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if videoUrl in self.cacheLinks[key][idx]['url']: if not self.cacheLinks[key][idx]['name'].startswith( '*'): self.cacheLinks[key][idx][ 'name'] = '*' + self.cacheLinks[key][idx][ 'name'] break if self.cm.isValidUrl(videoUrl): return self.up.getVideoLinkExt(videoUrl) playerData = strwithmeta(videoUrl).meta linkId = '' imdbId = '' try: tmp = [] for it in ['playertype', 'episodio', 'id']: tmp.append(playerData.get(it, '')) imdbId = self.cm.ph.getSearchGroups(playerData['ref_url'], '''imdb=(tt[0-9]+)''')[0] tmp.insert(0, imdbId) linkId = '_'.join(tmp) except Exception: printExc() printDBG(">>> linkId[%s]" % linkId) hostUrl = MRPiracyGQ.LINKS_CACHE.get(linkId, '') if hostUrl == '' and config.plugins.iptvplayer.mrpiracy_linkcache.value: hostUrl = ReadTextFile(GetCacheSubDir('mrpiracy', linkId))[1] if hostUrl == '': try: jscode = playerData.pop('jscode', '') jscode += '''var iptv_fake_element={hide:function(){},show:function(){},addClass:function(){},removeClass:function(){}};playertype="iptv_player_data";var iptv_player_data=''' + json.dumps( playerData ) + ''';$=function(){return 1==arguments.length&&arguments[0].endsWith(playertype)?{data:function(a){return iptv_player_data[a]}}:iptv_fake_element},$.ajax=function(){print(JSON.stringify(arguments[0]))},''' + playerData[ 'callback'] + '''(iptv_player_data.sitekey);''' ret = js_execute(jscode) data = ret['data'].strip() data = byteify(json.loads(data)) url = self.getFullUrl(data['url']) post_data = data['data'] urlParams = dict(self.defaultParams) urlParams['header'] = dict(self.AJAX_HEADER) urlParams['header']['Referer'] = playerData['ref_url'] if 'sitekey' in playerData: token, errorMsgTab = self.processCaptcha( playerData['sitekey'], playerData['ref_url'], config. plugins.iptvplayer.mrpiracy_bypassrecaptcha.value) printDBG('> token "%s" ' % token) post_data['token'] = token sts, data = self.getPage(url, urlParams, post_data) printDBG("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$") printDBG(data) printDBG("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$") tmp = re.compile('''['"](https?://[^'^"]+?)['"]''').findall( data) for item in tmp: if 1 == self.up.checkHostSupport(item): hostUrl = item if hostUrl == '': url = self.getFullUrl( self.cm.ph.getSearchGroups( data, '<iframe[^>]+?src="([^"]+?)"', 1, ignoreCase=True)[0]) if url != '': urlParams = dict(self.defaultParams) urlParams['header'] = dict(urlParams['header']) urlParams['header']['Referer'] = playerData['ref_url'] sts, data = self.getPage(url, urlParams) hostUrl = self.cm.ph.getSearchGroups( data, '''location\.href=['"]([^'^"]+?)['"]''')[0] except Exception: printExc() if self.cm.isValidUrl(hostUrl): if linkId != '': if config.plugins.iptvplayer.mrpiracy_linkcache.value and linkId not in MRPiracyGQ.LINKS_CACHE: WriteTextFile(GetCacheSubDir('mrpiracy', linkId), hostUrl) MRPiracyGQ.LINKS_CACHE[linkId] = hostUrl urlTab = self.up.getVideoLinkExt(hostUrl) if 0 == len(urlTab): SetIPTVPlayerLastHostError('\n'.join(errorMsgTab)) else: subUrl = 'https://cdn.mrpiracy.xyz/subs/%s.srt' % imdbId sts, data = self.getPage(subUrl) if sts and '00:' in data: for idx in range(len(urlTab)): urlTab[idx]['url'] = strwithmeta(urlTab[idx]['url']) if 'external_sub_tracks' not in urlTab[idx]['url'].meta: urlTab[idx]['url'].meta['external_sub_tracks'] = [] urlTab[idx]['url'].meta['external_sub_tracks'].append({ 'title': '', 'url': subUrl, 'lang': 'pt', 'format': 'srt' }) return urlTab
def tryTologin(self): printDBG('tryTologin start') if None == self.loggedIn or self.login != config.plugins.iptvplayer.cda_login.value or\ self.password != config.plugins.iptvplayer.cda_password.value: loginCookie = GetCookieDir('cda.pl.login') self.login = config.plugins.iptvplayer.cda_login.value self.password = config.plugins.iptvplayer.cda_password.value sts, data = self.getPage(self.getMainUrl(), self.defaultParams) if sts: self.setMainUrl(self.cm.meta['url']) freshSession = False if sts and '/logout' in data: printDBG("Check hash") hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) prevHash = ReadTextFile(loginCookie)[1].strip() printDBG("$hash[%s] $prevHash[%s]" % (hash, prevHash)) if hash == prevHash: self.loggedIn = True return else: freshSession = True rm(loginCookie) rm(self.COOKIE_FILE) if freshSession: sts, data = self.getPage( self.getMainUrl(), MergeDicts(self.defaultParams, {'use_new_session': True})) self.loggedIn = False if '' == self.login.strip() or '' == self.password.strip(): return False actionUrl = 'https://www.cda.pl/login' sitekey = '' sts, data = self.getPage(actionUrl, self.defaultParams) tries = 0 while tries < 2: msgTab = [_('Login failed.')] tries += 1 if sts: r = ph.search( data, '''name=['"]r['"][^>]+?value=['"]([^'^"]+?)['"]''', flags=ph.I)[0] post_data = { "r": r, "username": self.login, "password": self.password, "login": "******" } params = dict(self.defaultParams) HEADER = dict(self.AJAX_HEADER) HEADER['Referer'] = self.MAIN_URL params.update({'header': HEADER}) tmp = ph.findall(data, ('<form', '>', '/login'), '</form>', flags=ph.I) for item in tmp: if 'data-sitekey' in item: sitekey = ph.search( item, '''data\-sitekey=['"]([^'^"]+?)['"]''')[0] break if sitekey != '': token, errorMsgTab = self.processCaptcha( sitekey, self.cm.meta['url']) if token != '': post_data['g-recaptcha-response'] = token # login sts, data = self.getPage(actionUrl, params, post_data) printDBG(data) if sts: msgTab.append( ph.clean_html( ph.find(data, ('<p', '>', 'error-form'), '</p>', flags=0)[1])) if sts and '/logout' in data: printDBG('tryTologin OK') self.loggedIn = True elif sts and sitekey == '' and 'data-sitekey' in data: continue else: #printDBG(data) self.sessionEx.waitForFinishOpen( MessageBox, '\n'.join(msgTab), type=MessageBox.TYPE_ERROR, timeout=10) printDBG('tryTologin failed') break if self.loggedIn: hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) WriteTextFile(loginCookie, hash) return self.loggedIn
def tryTologin(self): printDBG('tryTologin start') if None == self.loggedIn or self.login != config.plugins.iptvplayer.hdfull_login.value or \ self.password != config.plugins.iptvplayer.hdfull_password.value: self.cm.clearCookie(self.COOKIE_FILE, removeNames=['language']) loginCookie = GetCookieDir('hdfull.me.login') self.login = config.plugins.iptvplayer.hdfull_login.value self.password = config.plugins.iptvplayer.hdfull_password.value sts, data = self.getPage(self.getMainUrl()) if sts: self.setMainUrl(self.cm.meta['url']) freshSession = False if sts and '/logout' in data: printDBG("Check hash") hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) prevHash = ReadTextFile(loginCookie)[1].strip() printDBG("$hash[%s] $prevHash[%s]" % (hash, prevHash)) if hash == prevHash: self.loggedIn = True return else: freshSession = True rm(loginCookie) rm(self.COOKIE_FILE) if freshSession: sts, data = self.getPage( self.getMainUrl(), MergeDicts(self.defaultParams, {'use_new_session': True})) self.loggedIn = False if '' == self.login.strip() or '' == self.password.strip(): return False if sts: actionUrl = self.cm.meta['url'] post_data = {} data = self.cm.ph.getDataBeetwenNodes( data, ('<form', '>', 'login_form'), ('</form', '>'), True, False)[1] data = self.cm.ph.getAllItemsBeetwenMarkers( data, '<input', '>', False) for item in data: name = self.cm.ph.getSearchGroups( item, '''name=['"]([^"^']+?)['"]''')[0] value = self.cm.ph.getSearchGroups( item, '''value=['"]([^"^']+?)['"]''')[0] if name != '': post_data[name] = value post_data.update({ 'username': self.login, 'password': self.password, 'action': 'login' }) httpParams = dict(self.defaultParams) httpParams['header'] = MergeDicts( httpParams['header'], { 'Referer': self.cm.meta['url'], 'Content-Type': 'application/x-www-form-urlencoded' }) sts, data = self.getPage(actionUrl, httpParams, post_data) if sts and '/logout' in data: printDBG('tryTologin OK') self.loggedIn = True else: msgTab = [_('Login failed.')] self.sessionEx.waitForFinishOpen(MessageBox, '\n'.join(msgTab), type=MessageBox.TYPE_ERROR, timeout=10) printDBG('tryTologin failed') if self.loggedIn: hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) WriteTextFile(loginCookie, hash) return self.loggedIn
def saveLoginMarker(self): printDBG("PlusDEDE.saveLoginMarker") marker = self.calcLoginMarker(PlusDEDE.login, PlusDEDE.password) printDBG("marker[%s]" % marker) return WriteTextFile(self.LOGIN_MARKER_FILE, marker)
def getVideoLinks(self, videoUrl): printDBG("BSTO.getVideoLinks [%s]" % videoUrl) urlTab = [] key = strwithmeta(videoUrl).meta.get('links_key', '') if key in self.cacheLinks: for idx in range(len(self.cacheLinks[key])): if self.cacheLinks[key][idx]['url'] == videoUrl and not self.cacheLinks[key][idx]['name'].startswith('*'): self.cacheLinks[key][idx]['name'] = '*' + self.cacheLinks[key][idx]['name'] sts, data = self.getPage(videoUrl) if not sts: return [] #printDBG("---------------------------") #printDBG(data) #printDBG("---------------------------") errorMsgTab = [] # LID #<div class="hoster-player" data-lid="4778534"> # token #<meta name="security_token" content="edfafd7a9fa9a7d005f88c96" /> # ticket <- token from recaptcha # recaptcha sitekey #series.init (1, 1, '6LeiZSYUAAAAAI3JZXrRnrsBzAdrZ40PmD57v_fs') lid = self.cm.ph.getSearchGroups(data, "data-lid=['\"]([^'^\"]+?)['\"]")[0] printDBG("Data LID : %s " % lid) token = self.cm.ph.getSearchGroups(data, "<meta.*security_token.*content=\"(.*?)\"")[0] printDBG("Security token : %s " % token) if not lid or not token: return [] sitekey = self.cm.ph.getSearchGroups(data, "'([0-9a-zA-Z_]{38,}?)'\)")[0] if sitekey != '': ticket, errorMsgTab = self.processCaptcha(sitekey, self.cm.meta['url'], bypassCaptchaService=config.plugins.iptvplayer.bsto_bypassrecaptcha.value) if not ticket : SetIPTVPlayerLastHostError(errorMsgTab) return [] printDBG("ticket: %s" % ticket) # post data postData = {'token': token, 'LID': lid, 'ticket': ticket} ajaxUrl = self.MAIN_URL + "ajax/embed.php" ajaxParams = self.defaultParams ajaxParams['header']= self.AJAX_HEADER ajaxParams['header']['Referer'] = videoUrl sts, ajaxData = self.cm.getPage(ajaxUrl, ajaxParams, post_data=postData) if not sts: return [] printDBG("----------- ajax data ----------") printDBG(ajaxData) printDBG("--------------------------------") # {"success":true,"link":"https:\/\/vivo.sx\/2eaf981402","embed":"0"} jsonData = json_loads(ajaxData) hostUrl = jsonData.get('link','') if hostUrl: if 1 != self.up.checkHostSupport(hostUrl): SetIPTVPlayerLastHostError('\n'.join(errorMsgTab)) elif self.cm.isValidUrl(hostUrl): BSTO.LINKS_CACHE[lid] = hostUrl if config.plugins.iptvplayer.bsto_linkcache.value: WriteTextFile(GetCacheSubDir('bs.to', lid), hostUrl) urlTab = self.up.getVideoLinkExt(hostUrl) return urlTab
def tryTologin(self): printDBG('tryTologin start') if None == self.loggedIn or self.login != config.plugins.iptvplayer.seriesblanco_login.value or self.password != config.plugins.iptvplayer.seriesblanco_password.value: self.cm.clearCookie(self.COOKIE_FILE, removeNames=['language']) loginCookie = GetCookieDir('seriesblanco.org.login') self.login = config.plugins.iptvplayer.seriesblanco_login.value self.password = config.plugins.iptvplayer.seriesblanco_password.value sts, data = self.getPage(self.getMainUrl()) if sts: self.setMainUrl(self.cm.meta['url']) freshSession = False if sts and '/login' not in data: printDBG('Check hash') hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) prevHash = ReadTextFile(loginCookie)[1].strip() printDBG('$hash[%s] $prevHash[%s]' % (hash, prevHash)) if hash == prevHash: self.loggedIn = True return True freshSession = True loginUrl = self.getFullUrl('/login/') rm(loginCookie) rm(self.COOKIE_FILE) if freshSession: sts, data = self.getPage( loginUrl, MergeDicts(self.defaultParams, {'use_new_session': True})) else: sts, data = self.getPage(loginUrl, self.defaultParams) self.loggedIn = False if '' == self.login.strip() or '' == self.password.strip(): return False errorTab = [_('Problem with user "%s" login.') % self.login] loginUrl = self.getFullUrl( '/wp-content/themes/ficseriesb/include/login_register/sistemaLogin.php' ) sts, data = self.getPage(loginUrl, self.getDefaultParams(forAjax=True), { 'usernameya': self.login, 'pwd1': self.password }) if sts: try: printDBG(data) data = json_loads(data) errorTab.append(ph.clean_html(str(data.get('mensaje', '')))) if data.get('err', False): sts, data = self.getPage(self.getFullUrl('/profil')) if sts and '/login' not in data: self.loggedIn = True except Exception: printExc() if not self.loggedIn: self.sessionEx.open(MessageBox, '\n'.join(errorTab), type=MessageBox.TYPE_INFO, timeout=10) if self.loggedIn: hash = hexlify( md5('%s@***@%s' % (self.login, self.password)).digest()) WriteTextFile(loginCookie, hash) return self.loggedIn