This commit is contained in:
Adam Tauber 2014-03-18 10:06:14 +01:00
parent c14e8fe0a5
commit faed14b2c6
1 changed files with 8 additions and 1 deletions

View File

@ -17,8 +17,15 @@ paging = True
def parse_url(url_string): def parse_url(url_string):
endings = ['/RS', '/RK']
endpositions = []
start = url_string.find('http', url_string.find('/RU=')+1) start = url_string.find('http', url_string.find('/RU=')+1)
end = min(url_string.rfind('/RS'), url_string.rfind('/RK')) for ending in endings:
endpos = url_string.rfind(ending)
if endpos > -1:
endpositions.append(endpos)
end = min(endpositions)
return unquote(url_string[start:end]) return unquote(url_string[start:end])