#NEWLINE# def get_movie( self , imdb , title , year ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# query = ( self . search_link % urllib . quote_plus ( title ) ) #NEWLINE# result = client . source ( query ) #NEWLINE# result = json . loads ( result ) #NEWLINE# result = result [ 'results' ] #NEWLINE# title = cleantitle . movie ( title ) #NEWLINE# years = [ ( '%s' % str ( year ) ) , ( '%s' % str ( ( int ( year ) + 1 ) ) ) , ( '%s' % str ( ( int ( year ) - 1 ) ) ) ] #NEWLINE# result = [ ( i [ 'url' ] , i [ 'titleNoFormatting' ] ) for i in result ] #NEWLINE# result = [ years for i in result if ( any ( ( ( x in i [ 0 ] ) for x in years ) ) or any ( ( ( x in i [ 1 ] ) for x in years ) ) ) ] #NEWLINE# result = [ ( i [ 0 ] , re . compile ( '(^Watch Full "|^Watch |)(.+? [(]\\d{4}[)])' ) . findall ( i [ 1 ] ) ) for i in result ] #NEWLINE# result = [ ( i [ 0 ] , i [ 1 ] [ 0 ] [ ( - 1 ) ] ) for i in result if ( len ( i [ 1 ] ) > 0 ) ] #NEWLINE# result = [ i [ 0 ] for i in result if ( title == cleantitle . movie ( i [ 1 ] ) ) ] [ 0 ] #NEWLINE# try : #NEWLINE# #INDENT# url = re . compile ( '//.+?(/.+)' ) . findall ( result ) [ 0 ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# url = result #NEWLINE# #UNINDENT# url = client . replaceHTMLCodes ( url ) #NEWLINE# url = url . encode ( 'utf-8' ) #NEWLINE# return url #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return