<s> '''<STR_LIT>''' <EOL> import re , urllib <EOL> from resources . lib . libraries import client <EOL> def resolve ( url ) : <EOL> try : <EOL> data = str ( url ) . replace ( '<STR_LIT:\r>' , '<STR_LIT>' ) . replace ( '<STR_LIT:\n>' , '<STR_LIT>' ) . replace ( '<STR_LIT:\t>' , '<STR_LIT>' ) <EOL> doregex = re . compile ( '<STR_LIT>' ) . findall ( data ) <EOL> for i in range ( <NUM_LIT:0> , <NUM_LIT:5> ) : <EOL> for x in doregex : <EOL> try : <EOL> if not '<STR_LIT>' % x in data : raise Exception ( ) <EOL> regex = re . compile ( '<STR_LIT>' ) . findall ( data ) <EOL> regex = [ r for r in regex if '<STR_LIT>' % x in r ] [ <NUM_LIT:0> ] <EOL> if '<STR_LIT>' in regex : raise Exception ( ) <EOL> expres = re . compile ( '<STR_LIT>' ) . findall ( regex ) [ <NUM_LIT:0> ] <EOL> try : referer = re . compile ( '<STR_LIT>' ) . findall ( regex ) [ <NUM_LIT:0> ] <EOL> except : referer = '<STR_LIT>' <EOL> referer = urllib . unquote_plus ( referer ) <EOL> referer = client . replaceHTMLCodes ( referer ) <EOL> referer = referer . encode ( '<STR_LIT:utf-8>' ) <EOL> page = re . compile ( '<STR_LIT>' ) . findall ( regex ) [ <NUM_LIT:0> ] <EOL> page = urllib . unquote_plus ( page ) <EOL> page = client . replaceHTMLCodes ( page ) <EOL> page = page . encode ( '<STR_LIT:utf-8>' ) <EOL> result = client . request ( page , referer = referer ) <EOL> result = str ( result ) . replace ( '<STR_LIT:\r>' , '<STR_LIT>' ) . replace ( '<STR_LIT:\n>' , '<STR_LIT>' ) . replace ( '<STR_LIT:\t>' , '<STR_LIT>' ) <EOL> result = str ( result ) . replace ( '<STR_LIT>' , '<STR_LIT:/>' ) <EOL> r = re . compile ( expres ) . findall ( result ) [ <NUM_LIT:0> ] <EOL> data = data . replace ( '<STR_LIT>' % x , r ) <EOL> except : <EOL> pass <EOL> url = re . compile ( '<STR_LIT>' ) . findall ( data ) [ <NUM_LIT:0> ] <EOL> url = client . replaceHTMLCodes ( url ) <EOL> url = url . encode ( '<STR_LIT:utf-8>' ) <EOL> if not '<STR_LIT>' in url : return url <EOL> except : <EOL> return </s>
