#NEWLINE# def resolve( url ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# url = url . replace ( '/embed-' , '/' ) #NEWLINE# url = re . compile ( '//.+?/([\\w]+)' ) . findall ( url ) [ 0 ] #NEWLINE# page = ( 'http://cloudyvideos.com/%s' % url ) #NEWLINE# result = client . request ( page , close = False ) #NEWLINE# if ( '>File Not Found<' in result ) : #NEWLINE# #INDENT# raise Exception ( ) #NEWLINE# #UNINDENT# post = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# f = client . parseDOM ( result , 'Form' , attrs = { #NEWLINE# #INDENT# 'action' : '' , #NEWLINE# #UNINDENT# } ) #NEWLINE# k = client . parseDOM ( f , 'input' , ret = 'name' , attrs = { #NEWLINE# #INDENT# 'type' : 'hidden' , #NEWLINE# #UNINDENT# } ) #NEWLINE# for i in k : #NEWLINE# #INDENT# post . update ( { #NEWLINE# #INDENT# i : client . parseDOM ( f , 'input' , ret = 'value' , attrs = { #NEWLINE# #INDENT# 'name' : i , #NEWLINE# #UNINDENT# } ) [ 0 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# post = post #NEWLINE# for i in range ( 0 , 5 ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# result = client . request ( page , post = post , close = False ) #NEWLINE# url = re . compile ( "file *: *'(.+?)'" ) . findall ( result ) #NEWLINE# if ( len ( url ) == 0 ) : #NEWLINE# #INDENT# result = re . compile ( '(eval.*?\\)\\)\\))' ) . findall ( result ) #NEWLINE# result = [ i for i in result if ( '|download|' in i ) ] [ 0 ] #NEWLINE# result = jsunpack . unpack ( result ) #NEWLINE# url = client . parseDOM ( result , 'embed' , ret = 'src' ) #NEWLINE# url += re . compile ( 'file *: *[\'|"](.+?)[\'|"]' ) . findall ( result ) #NEWLINE# #UNINDENT# url = [ i for i in url if ( not i . endswith ( '.srt' ) ) ] #NEWLINE# url = ( 'http://' + url [ 0 ] . split ( '://' , 1 ) [ ( - 1 ) ] ) #NEWLINE# return url #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# time . sleep ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# return