[generic] Do not follow redirects to the same URL

This commit is contained in:
Sergey M․ 2017-03-24 00:45:24 +07:00
parent a3ccd6bd11
commit 54b960f340
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -2635,11 +2635,14 @@ def filter_video(urls):
found = re.search(REDIRECT_REGEX, refresh_header) found = re.search(REDIRECT_REGEX, refresh_header)
if found: if found:
new_url = compat_urlparse.urljoin(url, unescapeHTML(found.group(1))) new_url = compat_urlparse.urljoin(url, unescapeHTML(found.group(1)))
if new_url != url:
self.report_following_redirect(new_url) self.report_following_redirect(new_url)
return { return {
'_type': 'url', '_type': 'url',
'url': new_url, 'url': new_url,
} }
else:
found = None
if not found: if not found:
# twitter:player is a https URL to iframe player that may or may not # twitter:player is a https URL to iframe player that may or may not