]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[mailru] Fix extraction (closes #24530) (#25239)
authorcomsomisha <shmelev1996@mail.ru>
Wed, 13 May 2020 22:51:40 +0000 (01:51 +0300)
committerGitHub <noreply@github.com>
Wed, 13 May 2020 22:51:40 +0000 (05:51 +0700)
youtube_dl/extractor/mailru.py

index 50234798bbe5176d881b5a42357b92ef36c16fe3..65cc474db0dbc84e323a1610ab7692f2aca075f0 100644 (file)
@@ -128,6 +128,12 @@ class MailRuIE(InfoExtractor):
                 'http://api.video.mail.ru/videos/%s.json?new=1' % video_id,
                 video_id, 'Downloading video JSON')
 
+        headers = {}
+
+        video_key = self._get_cookies('https://my.mail.ru').get('video_key')
+        if video_key:
+            headers['Cookie'] = 'video_key=%s' % video_key.value
+
         formats = []
         for f in video_data['videos']:
             video_url = f.get('url')
@@ -140,6 +146,7 @@ class MailRuIE(InfoExtractor):
                 'url': video_url,
                 'format_id': format_id,
                 'height': height,
+                'http_headers': headers,
             })
         self._sort_formats(formats)