def wizjalogin(): try: params = {} url = 'http://wizja.tv/users/index.php' #result, headers, content, cookie = client.request(url, output='extended') params['login']='******' params['user_name'] = control.get_setting('wizja.user') params['user_password'] = control.get_setting('wizja.pass') #login to site result, headers, content, cookie = client.request(url, post=params, headers=HOST, output='extended') control.set_setting('wizja.token', cookie) #wrong login if '<font color="#FF0000">Błędne hasło..</font>' in result: #zly login control.log('WIZJA.TV ZLY LOGIN: %s' % result) control.infoDialog(control.lang(30497).encode('utf-8'),time=6000) control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV',control.lang(30497).encode('utf-8'), '') raise Exception() elif 'lub hasło.</font>' in result: #zly login control.log('WIZJA.TV ZLY LOGIN: %s' % result) control.infoDialog(control.lang(30486).encode('utf-8'),time=6000) control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV',control.lang(30486).encode('utf-8'), '') raise Exception() elif 'Zalogowany jako :' in result: #no premium if '<font color=ff0000>Brak premium' in result: control.log('WIZJA.TV BRAK PREMIUM: %s' % result) control.infoDialog(control.lang(30490).encode('utf-8'), time=6000) control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV', control.lang(30490).encode('utf-8'), '') raise Exception('NO premium') else: try: premium = re.findall('Premium aktywne do (\d{4}.*?)</font>', result)[0] control.set_setting('wizja.expire', premium) control.infoDialog('Premium Wizja.tv do: '+ premium.encode('utf-8'), time=2000) except: pass return True, cookie #account locked - wait 60 minutes elif '<font color="#FF0000">Wpisa' in result: control.log('WIZJA.TV zbyt wiele razy pobowales - poczekaj 60 minut: %s' % result) control.infoDialog(control.lang(30487).encode('utf-8'),time=6000) control.dialog.ok(control.addonInfo('name') + ' - WIZJA TV',control.lang(30487).encode('utf-8'), '') raise Exception('zbyt wiele razy pobowales - poczekaj 60 minut') #Other error else: control.log('WIZJA.TV inny blad: %s' % result) control.infoDialog(control.lang(30488).encode('utf-8'), time=6000) raise Exception('Inny bład: '+ result) return False except Exception as e: control.log('Error wizja.login %s' % e) return False
def ipla_system_id(): systemid = control.setting('ipla.systemid').strip() if (systemid == ''): myrand = gen_hex_code(10) + '-' + gen_hex_code(4) + '-' + gen_hex_code(4) + '-' + gen_hex_code( 4) + '-' + gen_hex_code(12) control.set_setting('ipla.systemid', myrand) return True
def streamrefresh(): try: mynow = int(str(int(time.mktime(datetime.datetime.now().timetuple())))) expired = int(control.get_setting('telewizjada.tokenExpireIn')) control.log('Telewizjadanet Exp:%s Now:%s' % (expired, mynow)) if mynow > expired: ua = control.get_setting('telewizjada.ua') refreshcookie = control.get_setting('telewizjada.refreshcookie') referer = control.get_setting('telewizjada.referer') myheaders = { 'User-Agent': ua, 'Content-Type': 'application/json', 'cookie': refreshcookie, 'referer': referer } url = 'http://www.telewizjada.net/net/service/verifydevice.php' params = json.dumps({"action": "old", "key": ""}) result = client.request(url, post=params, headers=myheaders) control.log('Telewizjada verifydevice result: %s' % (result)) expirewhen = datetime.datetime.now() + datetime.timedelta( seconds=refreshtime) control.set_setting('telewizjada.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple())))) except Exception as e: control.log('Error telewizjada.refresh %s' % e) raise Exception()
def login(): #f getVideostarCredentialsInfo() == False: # raise Exception() params = {} #control.set_setting('videostar.sess', '') params['login'] = control.get_setting('videostar.user') params['password'] = control.get_setting('videostar.pass') params['permanent'] = 1 url = 'https://api-pilot.wp.pl/user/login' result = client.request(url, post=params, headers=headers, output='cookie') control.log('ResultC videostar.get %s' % result) if result == '': control.infoDialog('Unauthorized') return None control.set_setting('videostar.sess', result) control.sleep(500) url = 'https://api-pilot.wp.pl/invitations/limit' headers['cookie'] = result result2 = client.request(url, headers=headers) if 'error' in result2: result2 = json.loads(result2) control.log('EEEEEEEEEEEE Result videostar.get %s' % result2['errors'][0]['msg']) control.infoDialog(result2['errors'][0]['msg'].encode('utf-8')) control.sleep(500) return result
def ipla_system_id(): systemid = control.setting('ipla.systemid').strip() if (systemid == ''): myrand = gen_hex_code(10) + '-' + gen_hex_code(4) + '-' + gen_hex_code( 4) + '-' + gen_hex_code(4) + '-' + gen_hex_code(12) control.set_setting('ipla.systemid', myrand) return True
def yoylogin(): if getYoyCredentialsInfo() == False: raise ValueError('Brak ustawienia logiun lub hasła ') try: params = {} url = 'http://yoy.tv/signin' result, headers, content, cookie = client.request(url, output='extended') params['remember_me'] = '1' params['email'] = control.get_setting('yoytv.user') params['password'] = control.get_setting('yoytv.pass') params['_token'] = client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0] result1, headers, content, cookie = client.request(url, post=params, cookie=cookie, output='extended', redirect=False) mycookies = re.findall('Set-Cookie: (.*?);', '%s' % content) cookie = ";".join(mycookies) control.set_setting('yoytv.sess', cookie) control.log('##### cookie1: %s' % cookie) url = 'http://yoy.tv/' result = client.request(url, cookie=cookie) if not 'http://yoy.tv/signout' in result: control.log('BBBBB LOGIN %s' % 'yoy.tv') control.infoDialog(control.lang(30484).encode('utf-8')) control.dialog.ok( control.addonInfo('name') + ' - YOY TV', control.lang(30484).encode('utf-8'), '') control.openSettings('1.12') return False else: url = 'http://yoy.tv/user/settings' result = client.request(url, cookie=cookie) premium = re.findall('Aktywne do: ([0-9 :-]+)', result) if len(premium) > 0: control.log('CCCCC LOGIN %s' % premium) control.infoDialog( control.lang(30496) + premium[0].encode('utf-8')) return True except Exception as e: control.log('Yoylogin ERROR %s' % e) return False
def getstream(id): try: if login() == False: control.log('Błędny login') raise ValueError('Błędny login') ua = control.get_setting('telewizjada.ua') myheaders = {'User-Agent':ua} token = control.get_setting('telewizjada.token') mainurl = 'http://www.telewizjada.net/live.php?cid=%s' % id myheaders['referer']=mainurl sidcookie = client.request(mainurl, headers=myheaders, output='cookie') #control.log('SidCookie: %s' % (sidcookie)) url='http://www.statsgather.com/activatehls/getstats.php' hlsresult = client.request(url, post='', headers=myheaders, cookie='hls_stats=%s' % token) control.log('GetSTAT Result: %s' % hlsresult) mastercookie = '%s;%s;%s;%s ' % (sidcookie, 'hlsplugin=%s' % token, 'cb-enabled=accepted', 'cookieView=all' ) #control.log('MASTERCOOKIE ' + mastercookie) url = 'http://www.telewizjada.net/net/service/verifydevice.php' params = json.dumps({'action':'new', 'key':hlsresult}) jsonmyheaders = myheaders jsonmyheaders['Content-Type'] = 'application/json' jsonmyheaders['cookie'] = mastercookie #result = client.request(url, post=params, headers=jsonmyheaders) result, h1, content, cookie10 = client.request(url, post=params, headers=jsonmyheaders,output='extended') refreshcookie = '%s;%s;%s;%s ' % (sidcookie, '%s' % content['Set-Cookie'].split(';')[0], 'cb-enabled=accepted', 'cookieView=all' ) #control.log('AccessCookie: %s|%s' % (result,content['Set-Cookie'])) control.set_setting('telewizjada.refreshcookie', refreshcookie) control.set_setting('telewizjada.referer',mainurl) result = json.loads(result) if result['status'] == 'Active': #time.sleep(1) control.set_setting('telewizjada.expire', result['expire']) expirewhen = datetime.datetime.now() + datetime.timedelta(seconds=refreshtime) control.set_setting('telewizjada.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple())))) url = 'http://www.telewizjada.net/get_channel_data.php' myheaders1 = {'cookie': mastercookie, 'User-Agent':ua, 'referer': mainurl} params = {'cid':str(id)} result = client.request(url, post=params, headers=myheaders1) result = json.loads(result) vidlink = '%s|Cookie=%s' % (result['channelurl'], sidcookie) control.log('TELEWIZJADA VID %s' % vidlink) return vidlink return None except Exception as e: control.log('Error telewizjada.net .getstream %s' % e )
def streamrefresh(): try: mynow = int(str(int(time.mktime(datetime.datetime.now().timetuple())))) expired = int(control.get_setting('telewizjada.tokenExpireIn')) control.log('Telewizjadanet Exp:%s Now:%s' % (expired, mynow)) if mynow>expired: ua = control.get_setting('telewizjada.ua') refreshcookie = control.get_setting('telewizjada.refreshcookie') referer = control.get_setting('telewizjada.referer') myheaders = {'User-Agent': ua, 'Content-Type':'application/json','cookie': refreshcookie,'referer':referer} url = 'http://www.telewizjada.net/net/service/verifydevice.php' params = json.dumps({"action":"old","key":""}) result = client.request(url, post=params, headers=myheaders) control.log('Telewizjada verifydevice result: %s' % (result)) expirewhen = datetime.datetime.now() + datetime.timedelta(seconds=refreshtime) control.set_setting('telewizjada.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple())))) except Exception as e: control.log('Error telewizjada.refresh %s' % e ) raise Exception()
def yoylogin(): if getYoyCredentialsInfo() == False: raise ValueError('Brak ustawienia logiun lub hasła ') try: params = {} url = 'http://yoy.tv/signin' result, headers, content, cookie = client.request(url, output='extended') params['remember_me']='1' params['email'] = control.get_setting('yoytv.user') params['password'] = control.get_setting('yoytv.pass') params['_token']=client.parseDOM(result, 'input', ret='value', attrs={'name': '_token'})[0] result1, headers, content, cookie = client.request(url, post=params, cookie=cookie, output='extended', redirect=False) mycookies = re.findall('Set-Cookie: (.*?);', '%s' % content) cookie = ";".join(mycookies) control.set_setting('yoytv.sess', cookie) control.log('##### cookie1: %s' % cookie) url = 'http://yoy.tv/' result = client.request(url, cookie=cookie) if not 'http://yoy.tv/signout' in result: control.log('BBBBB LOGIN %s' % 'yoy.tv') control.infoDialog(control.lang(30484).encode('utf-8')) control.dialog.ok(control.addonInfo('name') + ' - YOY TV', control.lang(30484).encode('utf-8'), '') control.openSettings('1.12') return False else: url = 'http://yoy.tv/user/settings' result = client.request(url, cookie=cookie) premium = re.findall('Aktywne do: ([0-9 :-]+)',result) if len(premium)>0: control.log('CCCCC LOGIN %s' % premium) control.infoDialog(control.lang(30496) + premium[0].encode('utf-8') ) return True except Exception as e: control.log('Yoylogin ERROR %s' % e) return False
def streamrefresh(): try: #mynow = int(datetime.datetime.now().strftime('%s')) mynow = int(str(int(time.mktime(datetime.datetime.now().timetuple())))) expired = int(control.get_setting('pierwszatv.tokenExpireIn')) #control.log('XXXX Exp:%s Now:%s' % (expired, mynow)) if mynow>expired: control.log('Pierwsza refresh') url = '/api/stream/refresh' params = {} params['serverId'] =control.get_setting('pierwszatv.serverId') params['streamId'] =control.get_setting('pierwszatv.streamId') params['token'] = control.get_setting('pierwszatv.token') result = get(url, params) result = json.loads(result) expirein = int(int(result['tokenExpireIn'])*0.75) expirewhen = datetime.datetime.now() + datetime.timedelta(seconds=expirein) control.set_setting('pierwszatv.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple())))) except Exception as e: control.log('Error pierwsza.refresh %s' % e ) raise Exception()
def login(): #f getVideostarCredentialsInfo() == False: # raise Exception() params = {} #control.set_setting('videostar.sess', '') params['login'] = control.get_setting('videostar.user') params['password'] = control.get_setting('videostar.pass') params['permanent']=1 url = 'https://api.videostar.pl/user/login' result = client.request(url, post=params, headers=headers, output='cookie') control.log('ResultC videostar.get %s' % result) control.set_setting('videostar.sess', result) url='https://api.videostar.pl/invitations/limit' headers['cookie']=result result2 = client.request(url, headers=headers) if 'error' in result2: result2 = json.loads(result2) control.log('EEEEEEEEEEEE Result videostar.get %s' % result2['errors'][0]['msg']) control.infoDialog(result2['errors'][0]['msg'].encode('utf-8')) control.sleep(500) return result
def clear(table=None): try: control.idle() if table == None: table = ["rel_list", "rel_lib"] elif not type(table) == list: table = [table] yes = control.yesnoDialog(control.lang(30401).encode("utf-8"), "", "") if not yes: return control.set_setting("telewizjada.token", "") control.set_setting("telewizjada.os", "") control.set_setting("telewizjada.ua", "") control.set_setting("telewizjada.browser", "") control.set_setting("telewizjada.device", "") control.set_setting("telewizjada.expire", "") control.set_setting("telewizjada.referer", "") control.set_setting("telewizjada.refreshcookie", "") control.set_setting("telewizjada.tokenExpireIn", "") control.set_setting("yoytv.sess", "") dbcon = database.connect(control.cacheFile) dbcur = dbcon.cursor() for t in table: try: dbcur.execute("DROP TABLE IF EXISTS %s" % t) dbcur.execute("VACUUM") dbcon.commit() except: pass control.infoDialog(control.lang(30402).encode("utf-8")) except: pass
def getstream(id): try: control.set_setting('pierwszatv.tokenExpireIn', '') control.set_setting('pierwszatv.serverId', '') control.set_setting('pierwszatv.streamId', '') control.set_setting('pierwszatv.token', '') if getPierwszaCredentialsInfo() == False: if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('pierwszatv.user', '') control.set_setting('pierwszatv.password', '') control.openSettings('2.1') raise Exception() url = '/api/stream/create' params = {} params['id'] =id params['user'] =control.setting('pierwszatv.user').strip() params['password'] = urllib.quote_plus(control.setting('pierwszatv.password')) result = get(url, params) result = json.loads(result) if result['status'] == 'ok': #time.sleep(1) #control.log('x1x1x1: %s' % result['status']) expirein = int(int(result['tokenExpireIn'])*0.75) expirewhen = datetime.datetime.now() + datetime.timedelta(seconds=expirein) control.set_setting('pierwszatv.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple())))) control.set_setting('pierwszatv.serverId', result['serverId']) control.set_setting('pierwszatv.streamId', result['streamId']) control.set_setting('pierwszatv.token', result['token']) for i in range(0, 5): try: r = get('/api/stream/status', {'serverId': result['serverId'] , 'streamId': result['streamId'], 'token': result['token']}) r = json.loads(r) if r['status'] == 'ok': #control.infoDialog(control.lang(30489).encode('utf-8'), time=6000) for j in range(0, 20): time.sleep(1) control.infoDialog(control.lang(30489).encode('utf-8'), time=500) try: result2 = client.request(r['source']+'?token='+result['token'],safe=True, timeout='2') control.log('Pierwsza link check nr: %s: result:%s' % (j,result2)) if result2 == None: raise Exception() else: return r['source']+'?token='+result['token'] except: pass return r['source']+'?token='+result['token'] time.sleep(3) except: pass if result['status'] == 'error': control.infoDialog('%s' % result['message'].encode('utf-8')) return None except Exception as e: control.log('Error pierwsza.getstream %s' % e )
def wizjalogin(): try: params = {} url = 'http://wizja.tv/users/index.php' #result, headers, content, cookie = client.request(url, output='extended') params['login'] = '******' params['user_name'] = control.get_setting('wizja.user') params['user_password'] = control.get_setting('wizja.pass') #login to site result, headers, content, cookie = client.request(url, post=params, headers=HOST, output='extended') control.set_setting('wizja.token', cookie) #wrong login if '<font color="#FF0000">Błędne hasło..</font>' in result: #zly login control.log('WIZJA.TV ZLY LOGIN: %s' % result) control.infoDialog(control.lang(30497).encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - WIZJA TV', control.lang(30497).encode('utf-8'), '') raise Exception() elif 'lub hasło.</font>' in result: #zly login control.log('WIZJA.TV ZLY LOGIN: %s' % result) control.infoDialog(control.lang(30486).encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - WIZJA TV', control.lang(30486).encode('utf-8'), '') raise Exception() elif 'Zalogowany jako :' in result: #no premium if '<font color=ff0000>Brak premium' in result: control.log('WIZJA.TV BRAK PREMIUM: %s' % result) control.infoDialog(control.lang(30490).encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - WIZJA TV', control.lang(30490).encode('utf-8'), '') raise Exception('NO premium') else: try: premium = re.findall( 'Premium aktywne do (\d{4}.*?)</font>', result)[0] control.set_setting('wizja.expire', premium) control.infoDialog('Premium Wizja.tv do: ' + premium.encode('utf-8'), time=2000) except: pass return True, cookie #account locked - wait 60 minutes elif '<font color="#FF0000">Wpisa' in result: control.log( 'WIZJA.TV zbyt wiele razy pobowales - poczekaj 60 minut: %s' % result) control.infoDialog(control.lang(30487).encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - WIZJA TV', control.lang(30487).encode('utf-8'), '') raise Exception('zbyt wiele razy pobowales - poczekaj 60 minut') #Other error else: control.log('WIZJA.TV inny blad: %s' % result) control.infoDialog(control.lang(30488).encode('utf-8'), time=6000) raise Exception('Inny bład: ' + result) return False except Exception as e: control.log('Error wizja.login %s' % e) return False
def getstream(id): try: control.set_setting('pierwszatv.tokenExpireIn', '') control.set_setting('pierwszatv.serverId', '') control.set_setting('pierwszatv.streamId', '') control.set_setting('pierwszatv.token', '') if getPierwszaCredentialsInfo() == False: if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('pierwszatv.user', '') control.set_setting('pierwszatv.password', '') control.openSettings('1.4') raise Exception() url = '/api/stream/create' params = {} params['id'] =id params['user'] =control.setting('pierwszatv.user').strip() params['password'] = urllib.quote_plus(control.setting('pierwszatv.password')) result = get(url, params) control.log('x1x1x1: %s' % result) result = json.loads(result) if result['status'] == 'ok': #time.sleep(1) expirein = int(int(result['tokenExpireIn'])*0.75) expirewhen = datetime.datetime.now() + datetime.timedelta(seconds=expirein) control.set_setting('pierwszatv.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple())))) control.set_setting('pierwszatv.serverId', result['serverId']) control.set_setting('pierwszatv.streamId', result['streamId']) control.set_setting('pierwszatv.token', result['token']) for i in range(0, 5): try: r = get('/api/stream/status', {'serverId': result['serverId'] , 'streamId': result['streamId'], 'token': result['token']}) r = json.loads(r) if r['status'] == 'ok': #control.infoDialog(control.lang(30489).encode('utf-8'), time=6000) for j in range(0, 20): time.sleep(1) control.infoDialog(control.lang(30489).encode('utf-8'), time=500) try: result2 = client.request(r['source']+'?token='+result['token'],safe=True, timeout='2') control.log('Pierwsza link check nr: %s: result:%s' % (j,result2)) if result2 == None: raise Exception() else: return r['source']+'?token='+result['token'] except: pass return r['source']+'?token='+result['token'] time.sleep(3) except: pass if result['status'] == 'error': control.infoDialog('%s' % result['message'].encode('utf-8')) control.dialog.ok(control.addonInfo('name'), result['message'].encode('utf-8'), '') return None except Exception as e: control.log('Error pierwsza.getstream %s' % e )
def getstream(id): try: if login() == False: control.log('Błędny login') raise ValueError('Błędny login') ua = control.get_setting('telewizjada.ua') myheaders = {'User-Agent': ua} token = control.get_setting('telewizjada.token') mainurl = 'http://www.telewizjada.net/live.php?cid=%s' % id myheaders['referer'] = mainurl sidcookie = client.request(mainurl, headers=myheaders, output='cookie') #control.log('SidCookie: %s' % (sidcookie)) url = 'http://www.statsgather.com/activatehls/getstats.php' hlsresult = client.request(url, post='', headers=myheaders, cookie='hls_stats=%s' % token) control.log('GetSTAT Result: %s' % hlsresult) mastercookie = '%s;%s;%s;%s ' % (sidcookie, 'hlsplugin=%s' % token, 'cb-enabled=accepted', 'cookieView=all') #control.log('MASTERCOOKIE ' + mastercookie) url = 'http://www.telewizjada.net/net/service/verifydevice.php' params = json.dumps({'action': 'new', 'key': hlsresult}) jsonmyheaders = myheaders jsonmyheaders['Content-Type'] = 'application/json' jsonmyheaders['cookie'] = mastercookie #result = client.request(url, post=params, headers=jsonmyheaders) result, h1, content, cookie10 = client.request(url, post=params, headers=jsonmyheaders, output='extended') refreshcookie = '%s;%s;%s;%s ' % ( sidcookie, '%s' % content['Set-Cookie'].split(';')[0], 'cb-enabled=accepted', 'cookieView=all') #control.log('AccessCookie: %s|%s' % (result,content['Set-Cookie'])) control.set_setting('telewizjada.refreshcookie', refreshcookie) control.set_setting('telewizjada.referer', mainurl) result = json.loads(result) if result['status'] == 'Active': #time.sleep(1) control.set_setting('telewizjada.expire', result['expire']) expirewhen = datetime.datetime.now() + datetime.timedelta( seconds=refreshtime) control.set_setting('telewizjada.tokenExpireIn', str(int(time.mktime(expirewhen.timetuple())))) url = 'http://www.telewizjada.net/get_channel_data.php' myheaders1 = { 'cookie': mastercookie, 'User-Agent': ua, 'referer': mainurl } params = {'cid': str(id)} result = client.request(url, post=params, headers=myheaders1) result = json.loads(result) vidlink = '%s|Cookie=%s' % (result['channelurl'], sidcookie) control.log('TELEWIZJADA VID %s' % vidlink) return vidlink return None except Exception as e: control.log('Error telewizjada.net .getstream %s' % e)
def clear(table=None): try: control.idle() if table == None: table = ['rel_list', 'rel_lib'] elif not type(table) == list: table = [table] yes = control.yesnoDialog(control.lang(30401).encode('utf-8'), '', '') if not yes: return control.set_setting('telewizjada.token', '') control.set_setting('telewizjada.os', '') control.set_setting('telewizjada.ua', '') control.set_setting('telewizjada.browser', '') control.set_setting('telewizjada.device', '') control.set_setting('telewizjada.expire', '') control.set_setting('telewizjada.referer', '') control.set_setting('telewizjada.refreshcookie', '') control.set_setting('telewizjada.tokenExpireIn', '') control.set_setting('yoytv.sess', '') dbcon = database.connect(control.cacheFile) dbcur = dbcon.cursor() for t in table: try: dbcur.execute("DROP TABLE IF EXISTS %s" % t) dbcur.execute("VACUUM") dbcon.commit() except: pass control.infoDialog(control.lang(30402).encode('utf-8')) except: pass
def login(): try: if getTelewizjadaCredentialsInfo() == False: if control.yesnoDialog( control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('telewizjada.user', '') control.set_setting('telewizjada.password', '') control.openSettings('1.20') control.log('>>>> LOGIN()') expire = control.get_setting('telewizjada.expire') control.log('Expire1: %s' % expire) if expire != '': try: from datetime import datetime #d = datetime.strptime(expire, '%Y-%m-%d %H:%M:%S') d = datetime( *(time.strptime(expire, '%Y-%m-%d %H:%M:%S')[0:6])) control.log('Expire2: %s' % d) d2 = datetime.now() if d > d2: control.log('Expire OK: %s %s' % (d, d2)) return True except: pass url = 'http://www.deltamediaplayer.com/index.php?option=com_users&view=login&Itemid=116' result, h1, content, cookie1 = client.request(url, output='extended') headers = {'referer': url} result = client.parseDOM(result, 'div', attrs={'class': 'login'})[0] result = re.findall( '<input type="hidden" name="([^"]+)" value="([^"]+)"', result) params = { 'username': control.get_setting('telewizjada.user'), 'password': control.get_setting('telewizjada.pass'), 'remember': 'yes', str(result[0][0]): urllib.quote(str(result[0][1])), str(result[1][0]): urllib.quote(str(result[1][1])) } paramslog = { 'username': control.get_setting('telewizjada.user'), 'password': '', 'remember': 'yes', str(result[0][0]): urllib.quote(str(result[0][1])), str(result[1][0]): urllib.quote(str(result[1][1])) } control.log('>>>> PARAMS %s' % (paramslog)) url = 'http://www.deltamediaplayer.com/index.php?option=com_users&task=user.login' result, h2, content, cookie2 = client.request(url, redirect=False, post=params, headers=headers, cookie=cookie1, output='extended') if content[ 'Location'] != 'https://www.deltamediaplayer.com/index.php?option=com_users&view=profile': control.infoDialog(control.lang(30600).encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - Telewizzjada.net', control.lang(30600).encode('utf-8'), '') raise ValueError('Bledny login lub haslo.') url = 'http://www.deltamediaplayer.com/playercode/authorised/gethlsusers.php' headers[ 'referer'] = 'http://www.deltamediaplayer.com/index.php?option=com_acctexp&view=user&layout=subscriptiondetails&Itemid=119' headers['X-Requested-With'] = 'XMLHttpRequest' headers['Content-Type'] = 'application/json' headers['cookie'] = '%s; %s' % (cookie1, content['Set-Cookie'].split(';')[0]) params2 = json.dumps({'browser': 'Desktop;Windows;Chrome 54'}) result = client.request(url, post=params2, headers=headers) control.log('>>>> RES r:%s ' % (result)) r = json.loads(result) result = [i for i in r if i['registered'] != 0] if len(result) > 0: for i in result: control.log('I %s' % i) control.log('QQQQQQQQQQQQQQ %s' % r[0]['hash'], ) control.set_setting('telewizjada.token', r[0]['hash']) control.set_setting('telewizjada.os', r[0]['os']) control.set_setting('telewizjada.browser', r[0]['browser']) control.set_setting('telewizjada.device', r[0]['device']) control.log("Brovser: %s" % r[0]['browser'].split(' ')[0]) ua = 'Mozilla/5.0 (%s; %s; rv:%s) Gecko/20100101 %s/%s' % ( r[0]['os'], r[0]['device'], r[0]['browser'].split(' ')[-1], r[0]['browser'].split(' ')[0], r[0]['browser'].split(' ')[-1]) control.log('UA %s' % ua) control.set_setting('telewizjada.ua', ua) return True else: control.infoDialog(control.lang(30601).encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - Telewizzjada.net', control.lang(30601).encode('utf-8'), '') raise ValueError('Brak zarejestrowanych przeglądarek.') return False except Exception as e: control.log('Exception telewizjada.net login %s' % e) return False
def ipla_chanels(): control.log('Python version %s' % (sys.version)) #url10 = 'https://gm2.redefine.pl/rpc/system/' #headers10 = {'User-Agent': 'mipla_ios/122', 'Content-Type': 'application/x-www-form-urlencoded', # 'Accept-Language': 'pl-pl'} #post_init10 = {"jsonrpc": "2.0", "method": "getConfiguration", "id": 2, "params": { # "message": {"id": "CC3DFE81-1C70-403A-9C52-FC10EC51125A", "timestamp": "2016-10-16T00:08:57Z"}}} #data = requests.post(url10, data=post_init, headers=headers10) #print data.status_code, data.text #control.log('request %s|%s' % (data.status_code, data.text)) try: ipla_system_id() if getIplaCredentialsInfo() == False: if control.yesnoDialog(control.lang(40009).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Ipla', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('ipla.user', '') control.set_setting('ipla.pass', '') control.openSettings('1.1') raise ValueError('No login orr password') user = control.setting('ipla.user').strip() password = hashlib.md5(control.setting('ipla.pass').strip()).hexdigest() systemid = control.setting('ipla.systemid').strip() items = [] post_getTVChannels = json.loads( '{"jsonrpc":"2.0","method":"getTvChannels","id":5,"params":{"authData":{"login":"******"},"message":{"id":"4B737B56-A11D-4E65-BC86-47EA1E40EC4D","timestamp":"2016-10-15T17:03:21Z"}}}') url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5='+password+'&api_client=mipla_ios&login='******'&machine_id=iOS%'+systemid+'&outformat=2&api_build=122' result = _call_ipla(url_system, post_init, headers) control.log('request %s' % (result)) result = _call_ipla(url_preauth, post_preauth, headers) result = _call_ipla(url_auth, headers=headers1) moje = json.loads(result) loginstatus = ipla_check_login(moje) if loginstatus <> 'OK': control.log('Ipla Login Error %s ' % loginstatus) control.infoDialog(loginstatus.encode('utf-8'),time=6000) control.dialog.ok(control.addonInfo('name') + ' - IPLA',loginstatus.encode('utf-8'), '') return myperms = [] for i in moje['config']['access_groups']: #control.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %s' % i) if 'sc:' in i['code']: myperms.append(str(i['code'])) if 'oth:' in i['code']: myperms.append(str(i['code'])) #if 'loc:' in i['code']: # myperms.append(str(i['code'])) #control.log('###################################' % moje['config']) control.set_setting('ipla.passwdmd5', moje['config']['user']['passwdmd5']) my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view' result = _call_ipla(my_action1, headers=headers2) control.log('Python version %s' % (result)) result = _call_ipla(my_action2, headers=headers2) result = _call_ipla(my_action3, headers=headers2) post_getCat = json.loads( '{"jsonrpc":"2.0","method":"getCategoryWithFlatNavigation","id":4,"params":{"catid":0,"authData":{"login":"******"},"message":{"id":"47B80EF0-19D0-4BD0-82FF-80BC50EDF2A9","timestamp":"2016-10-15T23:02:22Z"}}}') #result = _call_ipla(url_navigation, post_getCat, headers) result = _call_ipla(url_navigation, post_getTVChannels, headers) moje = json.loads(result) print "GETCAT", result for i in moje['result']['results']: item = {} channelperms = i['grantExpression'].split('*') channelperms = [w.replace('+plat:all', '') for w in channelperms] for j in myperms: #control.log('BB: %s AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %s' % (i['title'].upper(), i['grantExpression'])) if j in channelperms: #print("OK", i['id'], i['title'], i['published'], i['grantExpression']) # control.log('Dalina %s' % result2) item['img'] = i['thumbnails'][-1]['src'].encode('utf-8') item['id'] = i['id'] item['title'] = i['title'].upper().encode('utf-8') item['plot'] = i['description'].encode('utf-8') #control.log('RESULT I %s' % dump(item)) # control.log('Calina %s' % item) item = {'title': item['title'], 'originaltitle': item['title'], 'genre': '0', 'plot': item['plot'], 'name':item['title'], 'tagline': '0', 'poster': item['img'], 'fanart': '0', 'id':item['id'], 'service':'ipla', 'next': ''} items.append(item) #Dupes dupes = [] filter = [] for entry in items: if not entry['id'] in dupes: filter.append(entry) dupes.append(entry['id']) items = filter return items except Exception as e: control.log('Ipla Error %s ' % e) return
def getstream(id): try: control.infoDialog(control.lang(30495).encode('utf-8'), time=200) if getIplaCredentialsInfo() == False: if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('ipla.user', '') control.set_setting('ipla.pass', '') control.openSettings('1.1') raise Exception() user = control.setting('ipla.user').strip() password = hashlib.md5(control.setting('ipla.pass').strip()).hexdigest() systemid = control.setting('ipla.systemid').strip() passwdmd5 = control.setting('ipla.passwdmd5').strip() url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5='+password+'&api_client=mipla_ios&login='******'&machine_id=iOS%'+systemid+'&outformat=2&api_build=122' post_getMedia = json.loads( '{"jsonrpc":"2.0","method":"getMedia","id":10,"params":{"cpid":0,"message":{"id":"F26642A8-8000-4C7A-B1CB-C2EADFD82E23","timestamp":"2016-10-16T00:53:25Z"},"authData":{"login":"******"},"mediaId":"'+str(id)+'"}}') post_perPlayData = json.loads( '{"jsonrpc":"2.0","method":"prePlayData","id":"-1864568404","params":{"mediaId":"'+str(id)+'","cpid":0,"authData":{"login":"******"}}}') #control.log('ipla1 %s' % id) result = _call_ipla(url_auth, headers=headers1) moje = json.loads(result) loginstatus = ipla_check_login(moje) if loginstatus <> 'OK': control.log('Ipla Login Error %s ' % loginstatus) control.infoDialog(loginstatus.encode('utf-8'),time=6000) control.dialog.ok(control.addonInfo('name') + ' - IPLA',loginstatus.encode('utf-8'), '') return my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view' result = _call_ipla(my_action1, headers=headers2) result = _call_ipla(my_action2, headers=headers2) result = _call_ipla(my_action3, headers=headers2) result = _call_ipla(url_navigation, post_getMedia, headers) result = _call_ipla(url_navigation, post_perPlayData, headers) moje = json.loads(result) url = moje['result']['mediaItem']['playback']['mediaSources'][-1]['authorizationServices']['pseudo']['url'] myid = moje['result']['mediaItem']['playback']['mediaId']['id'] url = url + '?cltype=mobile&cpid=0&id=' + myid + '&login='******'&passwdmd5='+passwdmd5+'&client_id=iOS%'+systemid+'&outformat=2' result = _call_ipla(url, headers=headers1) result = json.loads(result) url = result['resp']['license']['url'] + '|User-Agent='+urllib.quote_plus('IPLA/4.2.2.5 CFNetwork/808.0.2 Darwin/16.0.0') url = result['resp']['license']['url'] result = _call_ipla(url, headers=headers3) result = result.decode('utf-8') link = re.findall("BANDWIDTH=\d+\n(.*?m3u8)", result, re.MULTILINE)[0] if url_hls in link: url = link + '?userid=iOS%' + systemid + '&initial|User-Agent=' + urllib.quote_plus(headers2['User-Agent']) else: url = url_hls +link + '?userid=iOS%'+systemid+'&initial|User-Agent='+ urllib.quote_plus(headers2['User-Agent']) return url return None except Exception as e: control.log('Error ipla.getstream %s' % e ) return None
def login(): try: if getTelewizjadaCredentialsInfo() == False: if control.yesnoDialog(control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('telewizjada.user', '') control.set_setting('telewizjada.password', '') control.openSettings('1.20') control.log('>>>> LOGIN()' ) expire = control.get_setting('telewizjada.expire') control.log('Expire1: %s' % expire) if expire != '': try: from datetime import datetime #d = datetime.strptime(expire, '%Y-%m-%d %H:%M:%S') d = datetime(*(time.strptime(expire, '%Y-%m-%d %H:%M:%S')[0:6])) control.log('Expire2: %s' % d) d2 = datetime.now() if d>d2: control.log('Expire OK: %s %s' % (d,d2)) return True except: pass url = 'http://www.deltamediaplayer.com/index.php?option=com_users&view=login&Itemid=116' result, h1, content, cookie1 = client.request(url,output='extended') headers= {'referer':url} result = client.parseDOM(result, 'div', attrs={'class':'login'})[0] result = re.findall('<input type="hidden" name="([^"]+)" value="([^"]+)"',result) params = { 'username':control.get_setting('telewizjada.user'), 'password':control.get_setting('telewizjada.pass'), 'remember':'yes', str(result[0][0]): urllib.quote(str(result[0][1])), str(result[1][0]): urllib.quote(str(result[1][1])) } paramslog = { 'username':control.get_setting('telewizjada.user'), 'password':'', 'remember':'yes', str(result[0][0]): urllib.quote(str(result[0][1])), str(result[1][0]): urllib.quote(str(result[1][1])) } control.log('>>>> PARAMS %s' % (paramslog)) url='http://www.deltamediaplayer.com/index.php?option=com_users&task=user.login' result, h2, content, cookie2 = client.request(url, redirect=False, post=params, headers=headers, cookie=cookie1, output='extended') if content['Location'] != 'https://www.deltamediaplayer.com/index.php?option=com_users&view=profile': control.infoDialog(control.lang(30600).encode('utf-8'),time=6000) control.dialog.ok(control.addonInfo('name') + ' - Telewizzjada.net',control.lang(30600).encode('utf-8'), '') raise ValueError('Bledny login lub haslo.') url = 'http://www.deltamediaplayer.com/playercode/authorised/gethlsusers.php' headers['referer']='http://www.deltamediaplayer.com/index.php?option=com_acctexp&view=user&layout=subscriptiondetails&Itemid=119' headers['X-Requested-With']='XMLHttpRequest' headers['Content-Type'] = 'application/json' headers['cookie'] = '%s; %s' % (cookie1,content['Set-Cookie'].split(';')[0]) params2=json.dumps({'browser':'Desktop;Windows;Chrome 54'}) result = client.request(url, post=params2, headers=headers) control.log('>>>> RES r:%s ' % (result)) r = json.loads(result) result = [i for i in r if i['registered'] != 0] if len(result)>0: for i in result: control.log('I %s' %i) control.log('QQQQQQQQQQQQQQ %s' % r[0]['hash'], ) control.set_setting('telewizjada.token', r[0]['hash']) control.set_setting('telewizjada.os', r[0]['os']) control.set_setting('telewizjada.browser', r[0]['browser']) control.set_setting('telewizjada.device', r[0]['device']) control.log("Brovser: %s" % r[0]['browser'].split(' ')[0]) ua = 'Mozilla/5.0 (%s; %s; rv:%s) Gecko/20100101 %s/%s' % (r[0]['os'], r[0]['device'], r[0]['browser'].split(' ')[-1], r[0]['browser'].split(' ')[0], r[0]['browser'].split(' ')[-1]) control.log('UA %s' %ua) control.set_setting('telewizjada.ua', ua) return True else: control.infoDialog(control.lang(30601).encode('utf-8'), time=6000) control.dialog.ok(control.addonInfo('name') + ' - Telewizzjada.net',control.lang(30601).encode('utf-8'), '') raise ValueError('Brak zarejestrowanych przeglądarek.') return False except Exception as e: control.log('Exception telewizjada.net login %s' % e) return False
def getstream(id): try: control.infoDialog(control.lang(30495).encode('utf-8'), time=200) if getIplaCredentialsInfo() == False: if control.yesnoDialog( control.lang(40003).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Trakt', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('ipla.user', '') control.set_setting('ipla.pass', '') control.openSettings('1.1') raise Exception() user = control.setting('ipla.user').strip() password = hashlib.md5( control.setting('ipla.pass').strip()).hexdigest() systemid = control.setting('ipla.systemid').strip() passwdmd5 = control.setting('ipla.passwdmd5').strip() url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5=' + password + '&api_client=mipla_ios&login='******'&machine_id=iOS%' + systemid + '&outformat=2&api_build=122' post_getMedia = json.loads( '{"jsonrpc":"2.0","method":"getMedia","id":10,"params":{"cpid":0,"message":{"id":"F26642A8-8000-4C7A-B1CB-C2EADFD82E23","timestamp":"2016-10-16T00:53:25Z"},"authData":{"login":"******"},"mediaId":"' + str(id) + '"}}') post_perPlayData = json.loads( '{"jsonrpc":"2.0","method":"prePlayData","id":"-1864568404","params":{"mediaId":"' + str(id) + '","cpid":0,"authData":{"login":"******"}}}') #control.log('ipla1 %s' % id) result = _call_ipla(url_auth, headers=headers1) moje = json.loads(result) loginstatus = ipla_check_login(moje) if loginstatus <> 'OK': control.log('Ipla Login Error %s ' % loginstatus) control.infoDialog(loginstatus.encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - IPLA', loginstatus.encode('utf-8'), '') return my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view' result = _call_ipla(my_action1, headers=headers2) result = _call_ipla(my_action2, headers=headers2) result = _call_ipla(my_action3, headers=headers2) result = _call_ipla(url_navigation, post_getMedia, headers) result = _call_ipla(url_navigation, post_perPlayData, headers) moje = json.loads(result) url = moje['result']['mediaItem']['playback']['mediaSources'][-1][ 'authorizationServices']['pseudo']['url'] myid = moje['result']['mediaItem']['playback']['mediaId']['id'] url = url + '?cltype=mobile&cpid=0&id=' + myid + '&login='******'&passwdmd5=' + passwdmd5 + '&client_id=iOS%' + systemid + '&outformat=2' result = _call_ipla(url, headers=headers1) result = json.loads(result) url = result['resp']['license'][ 'url'] + '|User-Agent=' + urllib.quote_plus( 'IPLA/4.2.2.5 CFNetwork/808.0.2 Darwin/16.0.0') url = result['resp']['license']['url'] result = _call_ipla(url, headers=headers3) result = result.decode('utf-8') link = re.findall("BANDWIDTH=\d+\n(.*?m3u8)", result, re.MULTILINE)[0] if url_hls in link: url = link + '?userid=iOS%' + systemid + '&initial|User-Agent=' + urllib.quote_plus( headers2['User-Agent']) else: url = url_hls + link + '?userid=iOS%' + systemid + '&initial|User-Agent=' + urllib.quote_plus( headers2['User-Agent']) return url return None except Exception as e: control.log('Error ipla.getstream %s' % e) return None
def ipla_chanels(): control.log('Python version %s' % (sys.version)) #url10 = 'https://gm2.redefine.pl/rpc/system/' #headers10 = {'User-Agent': 'mipla_ios/122', 'Content-Type': 'application/x-www-form-urlencoded', # 'Accept-Language': 'pl-pl'} #post_init10 = {"jsonrpc": "2.0", "method": "getConfiguration", "id": 2, "params": { # "message": {"id": "CC3DFE81-1C70-403A-9C52-FC10EC51125A", "timestamp": "2016-10-16T00:08:57Z"}}} #data = requests.post(url10, data=post_init, headers=headers10) #print data.status_code, data.text #control.log('request %s|%s' % (data.status_code, data.text)) try: ipla_system_id() if getIplaCredentialsInfo() == False: if control.yesnoDialog( control.lang(40009).encode('utf-8'), control.lang(30481).encode('utf-8'), '', 'Ipla', control.lang(30483).encode('utf-8'), control.lang(30482).encode('utf-8')): control.set_setting('ipla.user', '') control.set_setting('ipla.pass', '') control.openSettings('1.1') raise ValueError('No login orr password') user = control.setting('ipla.user').strip() password = hashlib.md5( control.setting('ipla.pass').strip()).hexdigest() systemid = control.setting('ipla.systemid').strip() items = [] post_getTVChannels = json.loads( '{"jsonrpc":"2.0","method":"getTvChannels","id":5,"params":{"authData":{"login":"******"},"message":{"id":"4B737B56-A11D-4E65-BC86-47EA1E40EC4D","timestamp":"2016-10-15T17:03:21Z"}}}' ) url_auth = 'https://getmedia.redefine.pl/tv/menu.json?passwdmd5=' + password + '&api_client=mipla_ios&login='******'&machine_id=iOS%' + systemid + '&outformat=2&api_build=122' result = _call_ipla(url_system, post_init, headers) control.log('request %s' % (result)) result = _call_ipla(url_preauth, post_preauth, headers) result = _call_ipla(url_auth, headers=headers1) moje = json.loads(result) loginstatus = ipla_check_login(moje) if loginstatus <> 'OK': control.log('Ipla Login Error %s ' % loginstatus) control.infoDialog(loginstatus.encode('utf-8'), time=6000) control.dialog.ok( control.addonInfo('name') + ' - IPLA', loginstatus.encode('utf-8'), '') return myperms = [] for i in moje['config']['access_groups']: #control.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %s' % i) if 'sc:' in i['code']: myperms.append(str(i['code'])) if 'oth:' in i['code']: myperms.append(str(i['code'])) #if 'loc:' in i['code']: # myperms.append(str(i['code'])) #control.log('###################################' % moje['config']) control.set_setting('ipla.passwdmd5', moje['config']['user']['passwdmd5']) my_action1 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Login/Email%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action2 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DIInterfejs/Start_Aplikacji/Kolejny%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=action' my_action3 = moje['config']['traffic_url'] + 'id=' + moje['config']['traffic_id'] + \ '&extra=GoalName%3DInterfejs/Przegl%C4%85danie%7Cc%3Dipla-ios/122/10.0.2/Apple/iPhone&et=view' result = _call_ipla(my_action1, headers=headers2) control.log('Python version %s' % (result)) result = _call_ipla(my_action2, headers=headers2) result = _call_ipla(my_action3, headers=headers2) post_getCat = json.loads( '{"jsonrpc":"2.0","method":"getCategoryWithFlatNavigation","id":4,"params":{"catid":0,"authData":{"login":"******"},"message":{"id":"47B80EF0-19D0-4BD0-82FF-80BC50EDF2A9","timestamp":"2016-10-15T23:02:22Z"}}}' ) #result = _call_ipla(url_navigation, post_getCat, headers) result = _call_ipla(url_navigation, post_getTVChannels, headers) moje = json.loads(result) print "GETCAT", result for i in moje['result']['results']: item = {} channelperms = i['grantExpression'].split('*') channelperms = [w.replace('+plat:all', '') for w in channelperms] for j in myperms: #control.log('BB: %s AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %s' % (i['title'].upper(), i['grantExpression'])) if j in channelperms: #print("OK", i['id'], i['title'], i['published'], i['grantExpression']) # control.log('Dalina %s' % result2) item['img'] = i['thumbnails'][-1]['src'].encode('utf-8') item['id'] = i['id'] item['title'] = i['title'].upper().encode('utf-8') item['plot'] = i['description'].encode('utf-8') #control.log('RESULT I %s' % dump(item)) # control.log('Calina %s' % item) item = { 'title': item['title'], 'originaltitle': item['title'], 'genre': '0', 'plot': item['plot'], 'name': item['title'], 'tagline': '0', 'poster': item['img'], 'fanart': '0', 'id': item['id'], 'service': 'ipla', 'next': '' } items.append(item) #Dupes dupes = [] filter = [] for entry in items: if not entry['id'] in dupes: filter.append(entry) dupes.append(entry['id']) items = filter return items except Exception as e: control.log('Ipla Error %s ' % e) return