From ae5e9474177cc03b97d390839e6a68a7dfc2b9eb Mon Sep 17 00:00:00 2001 From: pictuga Date: Tue, 1 Oct 2013 19:49:53 +0200 Subject: [PATCH] Add support for facebook, google links --- morss.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/morss.py b/morss.py index 7bc5265..e00c8a2 100644 --- a/morss.py +++ b/morss.py @@ -4,6 +4,7 @@ import os import os.path import time +from fnmatch import fnmatch from base64 import b64encode, b64decode import re import string @@ -264,6 +265,16 @@ def Fill(item, cache, feedurl='/', fast=False): # check relative urls item.link = urlparse.urljoin(feedurl, item.link) + # google + if fnmatch(item.link, 'http://www.google.com/url?q=*'): + item.link = urlparse.parse_qs(urlparse.urlparse(item.link).query)['q'][0] + log(item.link) + + # facebook + if fnmatch(item.link, 'https://www.facebook.com/l.php?u=*'): + item.link = urlparse.parse_qs(urlparse.urlparse(item.link).query)['u'][0] + log(item.link) + # feedburner feeds.NSMAP['feedburner'] = 'http://rssnamespace.org/feedburner/ext/1.0' match = item.xval('feedburner:origLink')