Redirect google translate links to original link

Cause anyway Google Translate isn't scrappable. So it's better to have at least some content.
master
pictuga 2014-03-22 20:53:33 +01:00
parent a4cf5e0daa
commit d8074d6b6d
1 changed files with 5 additions and 0 deletions

View File

@ -360,6 +360,11 @@ def Fix(item, feedurl='/'):
# check relative urls # check relative urls
item.link = urlparse.urljoin(feedurl, item.link) item.link = urlparse.urljoin(feedurl, item.link)
# google translate
if fnmatch(item.link, 'http://translate.google.*/translate*u=*'):
item.link = urlparse.parse_qs(urlparse.urlparse(item.link).query)['u'][0]
log(item.link)
# google # google
if fnmatch(item.link, 'http://www.google.*/url?q=*'): if fnmatch(item.link, 'http://www.google.*/url?q=*'):
item.link = urlparse.parse_qs(urlparse.urlparse(item.link).query)['q'][0] item.link = urlparse.parse_qs(urlparse.urlparse(item.link).query)['q'][0]