#NEWLINE# def findvid( url , data ) : #NEWLINE# #INDENT# parse = urlparse ( url ) #NEWLINE# if ( 'tv4play.se' in url ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# vid = parse_qs ( parse . query ) [ 'video_id' ] [ 0 ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# match = re . search ( '\\"vid\\":\\"(\\d+)\\",' , url ) #NEWLINE# if match : #NEWLINE# #INDENT# vid = match . group ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# match = re . search ( '-(\\d+)$' , url ) #NEWLINE# if match : #NEWLINE# #INDENT# vid = match . group ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# match = re . search ( "meta content='([^']+)' property='og:video'" , data ) #NEWLINE# if match : #NEWLINE# #INDENT# match = re . search ( 'vid=(\\d+)&' , match . group ( 1 ) ) #NEWLINE# if match : #NEWLINE# #INDENT# vid = match . group ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . error ( "Can't find video id for %s" , url ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return vid