From d8074d6b6d975e8e66419011b7098ea2cf044901 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 22 Mar 2014 20:53:33 +0100 Subject: [PATCH] Redirect google translate links to original link Cause anyway Google Translate isn't scrappable. So it's better to have at least some content. --- morss/morss.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/morss/morss.py b/morss/morss.py index 51fd785..2a341b1 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -360,6 +360,11 @@ def Fix(item, feedurl='/'): # check relative urls 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 if fnmatch(item.link, 'http://www.google.*/url?q=*'): item.link = urlparse.parse_qs(urlparse.urlparse(item.link).query)['q'][0]