Add support for facebook, google links

master
pictuga 2013-10-01 19:49:53 +02:00
parent cf5040020e
commit ae5e947417
1 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import os
import os.path import os.path
import time import time
from fnmatch import fnmatch
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
import re import re
import string import string
@ -264,6 +265,16 @@ def Fill(item, cache, feedurl='/', fast=False):
# check relative urls # check relative urls
item.link = urlparse.urljoin(feedurl, item.link) 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 # feedburner
feeds.NSMAP['feedburner'] = 'http://rssnamespace.org/feedburner/ext/1.0' feeds.NSMAP['feedburner'] = 'http://rssnamespace.org/feedburner/ext/1.0'
match = item.xval('feedburner:origLink') match = item.xval('feedburner:origLink')