aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2017-05-28 00:47:41 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2017-05-28 20:20:20 +0800
commita49eccdfa7e1ba4d834a6f65d15ef88a37bd78dd (patch)
treefb4e084b44b137823e277d27f380a3476749c186
parenta846173d9304c958bd7bedb89fe767490c885ae1 (diff)
[youtube] Parse player_url if format URLs are encrypted or DASH MPDs are requested
Fixes #13211
-rw-r--r--ChangeLog2
-rw-r--r--youtube_dl/extractor/youtube.py11
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 65a3ca468..c8dd70fe5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
version <unreleased>
Extractors
+* [youtube] Fix DASH MPD extraction for videos with non-encrypted format URLs
+ (#13211)
+ [youku] Extract more metadata (#10433)
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index d6c098706..40ac1a019 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1715,12 +1715,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
format_id = url_data['itag'][0]
url = url_data['url'][0]
- if 'sig' in url_data:
- url += '&signature=' + url_data['sig'][0]
- elif 's' in url_data:
- encrypted_sig = url_data['s'][0]
+ if 's' in url_data or self._downloader.params.get('youtube_include_dash_manifest', True):
ASSETS_RE = r'"assets":.+?"js":\s*("[^"]+")'
-
jsplayer_url_json = self._search_regex(
ASSETS_RE,
embed_webpage if age_gate else video_webpage,
@@ -1741,6 +1737,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
video_webpage, 'age gate player URL')
player_url = json.loads(player_url_json)
+ if 'sig' in url_data:
+ url += '&signature=' + url_data['sig'][0]
+ elif 's' in url_data:
+ encrypted_sig = url_data['s'][0]
+
if self._downloader.params.get('verbose'):
if player_url is None:
player_version = 'unknown'