[dailymotion] Fix extraction (closes #17699)
authorEnes <enessolak99@gmail.com>
Sat, 29 Sep 2018 10:28:56 +0000 (13:28 +0300)
committerSergey M․ <dstftw@gmail.com>
Thu, 4 Oct 2018 19:03:16 +0000 (02:03 +0700)
youtube_dl/extractor/dailymotion.py

index 040f0bd02e94992bb1e4248d425f564ce7c81c75..842d9a25994ef4c7ca4837d919cc66bd6d0a7d51 100644 (file)
@@ -24,6 +24,7 @@ from ..utils import (
     str_to_int,
     unescapeHTML,
     urlencode_postdata,
+    try_get,
 )
 
 
@@ -172,7 +173,12 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
             webpage, 'player v5', default=None)
         if player_v5:
             player = self._parse_json(player_v5, video_id)
-            metadata = player['metadata']
+            metadata = try_get(
+                player, lambda x: x['metadata'], dict) or self._download_json(
+                'http://www.dailymotion.com/player/metadata/video/%s' % video_id, video_id, query={
+                    'integration': 'inline',
+                    'GK_PV5_NEON': '1',
+                })
 
             if metadata.get('error', {}).get('type') == 'password_protected':
                 password = self._downloader.params.get('videopassword')