aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/generic.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-03-17 23:51:40 +0600
committerSergey M․ <dstftw@gmail.com>2015-03-17 23:51:40 +0600
commit84f810160667f9129e6a8d841fae2d0e2e1fec86 (patch)
treed0b4ee9a62ef3a5b09d432ab79391e4aa2945ecf /youtube_dl/extractor/generic.py
parentb1337948ebeeacfcf104d513fac5913d3a5818a7 (diff)
[generic] Follow redirects specified by `Refresh` HTTP header
Diffstat (limited to 'youtube_dl/extractor/generic.py')
-rw-r--r--youtube_dl/extractor/generic.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index 4e6927b08..0b8d96c27 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -1270,8 +1270,14 @@ class GenericIE(InfoExtractor):
if not found:
found = re.search(
r'(?i)<meta\s+(?=(?:[a-z-]+="[^"]+"\s+)*http-equiv="refresh")'
- r'(?:[a-z-]+="[^"]+"\s+)*?content="[0-9]{,2};url=\'?([^\'"]+)',
+ r'(?:[a-z-]+="[^"]+"\s+)*?content="[0-9]{,2};\s*(?:URL|url)=\'?([^\'"]+)',
webpage)
+ if not found:
+ # Look also in Refresh HTTP header
+ refresh_header = head_response.headers.get('Refresh')
+ if refresh_header:
+ found = re.search(
+ r'[0-9]{,2};\s*(?:URL|url)=(.+)', refresh_header)
if found:
new_url = found.group(1)
self.report_following_redirect(new_url)