url cleanup

This commit is contained in:
Gordon Shumway 2019-04-15 19:31:42 -04:00 committed by GitHub
parent 5f3d820888
commit 8bcd1de9ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -39,8 +39,9 @@ class IMDB(callbacks.Plugin):
soup = BeautifulSoup(data.text)
elements = soup.select('.r a')
url = elements[0]['href']
url = re.sub("http://www.google.com/url?url=", "", url)
url = re.split('https?://', url)[-1]
url = re.sub("&rct=.*", "", url)
url = "https://{0}".format(url)
except Exception:
return
else: