aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-03-24 00:45:24 +0700
committerSergey M․ <dstftw@gmail.com>2017-03-24 00:45:24 +0700
commit54b960f340ed5398136ef0206d17cafba2575678 (patch)
treebdcafac700acb2d235697d396ade1c19918db8d5 /youtube_dl/extractor
parenta3ccd6bd11454b9760ef2c5f09f02f3afdb11af5 (diff)
[generic] Do not follow redirects to the same URL
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/generic.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index cb6308d29..da9d04efc 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -2635,11 +2635,14 @@ class GenericIE(InfoExtractor):
found = re.search(REDIRECT_REGEX, refresh_header)
if found:
new_url = compat_urlparse.urljoin(url, unescapeHTML(found.group(1)))
- self.report_following_redirect(new_url)
- return {
- '_type': 'url',
- 'url': new_url,
- }
+ if new_url != url:
+ self.report_following_redirect(new_url)
+ return {
+ '_type': 'url',
+ 'url': new_url,
+ }
+ else:
+ found = None
if not found:
# twitter:player is a https URL to iframe player that may or may not