altadefizione: fix url redirection
This commit is contained in:
@@ -9,8 +9,11 @@ from platformcode import config, logger
|
|||||||
|
|
||||||
def findhost(url):
|
def findhost(url):
|
||||||
host = support.match(url, patron=r'<h2[^>]+><a href="([^"]+)').match.rstrip('/')
|
host = support.match(url, patron=r'<h2[^>]+><a href="([^"]+)').match.rstrip('/')
|
||||||
permUrl = httptools.downloadpage(host, follow_redirects=False).headers
|
permUrl = httptools.downloadpage(host, follow_redirects=False, only_headers=True).headers
|
||||||
|
|
||||||
|
if 'location' in permUrl.keys(): # handle redirection
|
||||||
return permUrl['location']
|
return permUrl['location']
|
||||||
|
return host
|
||||||
|
|
||||||
host = config.get_channel_url(findhost)
|
host = config.get_channel_url(findhost)
|
||||||
headers = [['Referer', host]]
|
headers = [['Referer', host]]
|
||||||
|
|||||||
Reference in New Issue
Block a user