#NEWLINE# def get_token( self ) : #NEWLINE# #INDENT# url = 'http://ida.omroep.nl/npoplayer/i.js?s={}' . format ( quote ( self . url ) ) #NEWLINE# token = http . get ( url , headers = HTTP_HEADERS ) . text #NEWLINE# token = re . compile ( 'token.*?"(.*?)"' , ( re . DOTALL + re . IGNORECASE ) ) . search ( token ) . group ( 1 ) #NEWLINE# secured = list ( token ) #NEWLINE# token = list ( token ) #NEWLINE# first = ( - 1 ) #NEWLINE# second = ( - 1 ) #NEWLINE# for ( i , c ) in enumerate ( token ) : #NEWLINE# #INDENT# if ( c . isdigit ( ) and ( 4 < i < len ( token ) ) ) : #NEWLINE# #INDENT# if ( first == ( - 1 ) ) : #NEWLINE# #INDENT# first = i #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# second = i #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( first == ( - 1 ) ) : #NEWLINE# #INDENT# first = 12 #NEWLINE# #UNINDENT# if ( second == ( - 1 ) ) : #NEWLINE# #INDENT# second = 13 #NEWLINE# #UNINDENT# secured [ first ] = token [ second ] #NEWLINE# secured [ second ] = token [ first ] #NEWLINE# return '' . join ( secured )