strip google redirects

This commit is contained in:
Gordon Shumway 2019-04-11 00:08:04 -04:00 committed by GitHub
parent 860ef01776
commit 6aea07cdc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -37,6 +37,8 @@ class WikiLeaf(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.sub("&rct=.*", "", url)
except Exception:
return
else: