Exemplo n.º 1
0
def grepToken():
	response = libMediathek.getUrl('https://www.zdf.de/live-tv')
	tokenMenu = re.compile("apiToken: '(.+?)'", re.DOTALL).findall(response)[0]
	tokenPlayer = re.compile('"apiToken": "(.+?)"', re.DOTALL).findall(response)[0]
	
	libMediathek.f_mkdir(libMediathek.pathUserdata(''))
	libMediathek.f_write(libMediathek.pathUserdata('tokenMenu'), tokenMenu)
	libMediathek.f_write(libMediathek.pathUserdata('tokenPlayer'), tokenPlayer)
	return (tokenMenu, tokenPlayer)
Exemplo n.º 2
0
def getHeader(Menu, tokenMenu=None, tokenPlayer=None):
    if Menu:
        header = {
            'Api-Auth':
            'Bearer ' + (tokenMenu if tokenMenu else libMediathek.f_open(
                libMediathek.pathUserdata('tokenMenu')))
        }
    else:
        header = {
            'Api-Auth':
            'Bearer ' + (tokenPlayer if tokenPlayer else libMediathek.f_open(
                libMediathek.pathUserdata('tokenPlayer')))
        }
    return header