#NEWLINE# def find_video_id( self ) : #NEWLINE# #INDENT# match = re . search ( 'data-video-id="([^"]+)"' , self . get_urldata ( ) ) #NEWLINE# if match : #NEWLINE# #INDENT# return match . group ( 1 ) #NEWLINE# #UNINDENT# parse = urlparse ( self . url ) #NEWLINE# query = parse_qs ( parse . query ) #NEWLINE# match = re . search ( '/video/([0-9]+)/' , parse . path ) #NEWLINE# if match : #NEWLINE# #INDENT# return match . group ( 1 ) #NEWLINE# #UNINDENT# match = re . search ( '/klipp/([0-9]+)/' , parse . path ) #NEWLINE# if match : #NEWLINE# #INDENT# return match . group ( 1 ) #NEWLINE# #UNINDENT# match = re . search ( "data-video-id='([^']+)'" , self . get_urldata ( ) ) #NEWLINE# if match : #NEWLINE# #INDENT# return match . group ( 1 ) #NEWLINE# #UNINDENT# match = re . search ( '/videoEpisod-([^/]+)/' , parse . path ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# match = re . search ( 'data-id="(\\d+)-' , self . get_urldata ( ) ) #NEWLINE# #UNINDENT# vid = None #NEWLINE# if match : #NEWLINE# #INDENT# vid = match . group ( 1 ) #NEWLINE# #UNINDENT# if ( not vid ) : #NEWLINE# #INDENT# for i in query . keys ( ) : #NEWLINE# #INDENT# if ( vid == 'articleId' ) : #NEWLINE# #INDENT# vid = query [ 'articleId' ] [ 0 ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if vid : #NEWLINE# #INDENT# vtype = None #NEWLINE# for i in [ 'video' , 'klipp' ] : #NEWLINE# #INDENT# url = ( 'http://www.svtplay.se/%s/%s/' % ( i , vid ) ) #NEWLINE# data = self . http . request ( 'get' , url ) #NEWLINE# if ( data . status_code == 200 ) : #NEWLINE# #INDENT# vtype = i #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if vtype : #NEWLINE# #INDENT# self . _url = ( 'http://www.svtplay.se/%s/%s/' % ( vtype , vid ) ) #NEWLINE# self . _urldata = None #NEWLINE# self . get_urldata ( ) #NEWLINE# return self . find_video_id ( ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not match ) : #NEWLINE# #INDENT# match = re . search ( 'src="(//www.svt.se/wd?[^"]+)"' , self . get_urldata ( ) ) #NEWLINE# if match : #NEWLINE# #INDENT# self . _urldata = None #NEWLINE# self . _url = ( 'http:%s' % decode_html_entities ( match . group ( 1 ) ) ) #NEWLINE# self . get_urldata ( ) #NEWLINE# return self . find_video_id ( ) #NEWLINE# #UNINDENT# #UNINDENT# return None