diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-12-08 21:15:45 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-12-08 21:15:45 +0600 |
commit | 18e4088fad97de0d79e29e0a49a0df3ce719a441 (patch) | |
tree | de09f8657143a746b4dc5d8185fdd8a9ef2c002d | |
parent | 3d24bbfbe433e3a2b2257096264bf4e846f6d889 (diff) |
[theplatform] Add support for referer protected videos wuth explicit SMIL
-rw-r--r-- | youtube_dl/extractor/theplatform.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/youtube_dl/extractor/theplatform.py b/youtube_dl/extractor/theplatform.py index 1555aa77c..0bf6726b5 100644 --- a/youtube_dl/extractor/theplatform.py +++ b/youtube_dl/extractor/theplatform.py @@ -16,11 +16,12 @@ from ..compat import ( from ..utils import ( determine_ext, ExtractorError, - xpath_with_ns, - unsmuggle_url, + float_or_none, int_or_none, + sanitized_Request, + unsmuggle_url, url_basename, - float_or_none, + xpath_with_ns, ) default_ns = 'http://www.w3.org/2005/SMIL21/Language' @@ -204,7 +205,12 @@ class ThePlatformIE(ThePlatformBaseIE): smil_url = url # Explicitly specified SMIL (see https://github.com/rg3/youtube-dl/issues/7385) elif '/guid/' in url: - webpage = self._download_webpage(url, video_id) + headers = {} + source_url = smuggled_data.get('source_url') + if source_url: + headers['Referer'] = source_url + request = sanitized_Request(url, headers=headers) + webpage = self._download_webpage(request, video_id) smil_url = self._search_regex( r'<link[^>]+href=(["\'])(?P<url>.+?)\1[^>]+type=["\']application/smil\+xml', webpage, 'smil url', group='url') |