diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-11-26 10:44:39 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-11-26 10:44:39 +0100 |
commit | 4e262a8838d487362a85eb8b8693d2fa84899f17 (patch) | |
tree | 685999dc308ceee0c233e4dcfdbe56a013651406 /youtube_dl/extractor/common.py | |
parent | 63c9b2c1d916ec3e3d2ab5e5247ac8a372c7957e (diff) |
[generic] Detect direct video links (Fixes #4149, #4313)
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r-- | youtube_dl/extractor/common.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 3c2d46dd5..3e84d0e62 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -296,9 +296,11 @@ class InfoExtractor(object): content = self._webpage_read_content(urlh, url_or_request, video_id, note, errnote, fatal) return (content, urlh) - def _webpage_read_content(self, urlh, url_or_request, video_id, note=None, errnote=None, fatal=True): + def _webpage_read_content(self, urlh, url_or_request, video_id, note=None, errnote=None, fatal=True, prefix=None): content_type = urlh.headers.get('Content-Type', '') webpage_bytes = urlh.read() + if prefix is not None: + webpage_bytes = prefix + webpage_bytes m = re.match(r'[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+\s*;\s*charset=(.+)', content_type) if m: encoding = m.group(1) |