From b7136f2056c30c090a1e6a756648c933676e8c10 Mon Sep 17 00:00:00 2001 From: pictuga Date: Mon, 12 May 2014 23:15:51 +0200 Subject: [PATCH] Pull iTunes raw feed out of iTunes url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This iTunes thinggy somehow qualifies as yet-another-apple-tech-rape: just some old tech behind iron curtains… --- morss/feedify.py | 7 +++++++ morss/morss.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/morss/feedify.py b/morss/feedify.py index 35d34f2..c82cbd6 100644 --- a/morss/feedify.py +++ b/morss/feedify.py @@ -96,6 +96,13 @@ def PreWorker(url, cache): cache.set('redirect', nurl) cache.set('cache', ncache) + if urlparse.urlparse(url).netloc == 'itunes.apple.com': + match = re.search('/id([0-9]+)(\?.*)?$', url) + if match: + iid = match.groups()[0] + redirect = 'https://itunes.apple.com/lookup?id={id}'.format(id=iid) + cache.set('redirect', redirect) + class Builder(object): def __init__(self, link, data=None, cache=False): self.link = link diff --git a/morss/morss.py b/morss/morss.py index 2a341b1..44d3709 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -543,7 +543,9 @@ def Fetch(url, cache, options): cache.set('etag', con.headers.getheader('etag')) cache.set('lastmodified', con.headers.getheader('last-modified')) - if xml.startswith('