Only perform <meta> redirects on html pages
parent
3176c2a8e8
commit
c25aec7107
1
morss.py
1
morss.py
|
@ -196,6 +196,7 @@ class HTMLDownloader(urllib2.HTTPCookieProcessor):
|
||||||
data = GzipFile(fileobj=StringIO(data), mode='r').read()
|
data = GzipFile(fileobj=StringIO(data), mode='r').read()
|
||||||
|
|
||||||
# <meta> redirect
|
# <meta> redirect
|
||||||
|
if resp.info().type in ['text/html', 'application/xhtml+xml']:
|
||||||
match = re.search(r'(?i)<meta http-equiv=.refresh[^>]*?url=(http.*?)["\']', data)
|
match = re.search(r'(?i)<meta http-equiv=.refresh[^>]*?url=(http.*?)["\']', data)
|
||||||
if match:
|
if match:
|
||||||
newurl = match.groups()[0]
|
newurl = match.groups()[0]
|
||||||
|
|
Loading…
Reference in New Issue