[youtube] Unescape HTML for series (closes #18641)
[youtube-dl] / youtube_dl / extractor / rutube.py
index 828c03b483e15f69bca13821dd6fbe6b61b54e05..10ac8ed1f22ad943dc210430d0363d9a4aa0b483 100644 (file)
@@ -16,6 +16,7 @@ from ..utils import (
     int_or_none,
     try_get,
     unified_timestamp,
+    url_or_none,
 )
 
 
@@ -102,7 +103,8 @@ class RutubeIE(RutubeBaseIE):
 
         options = self._download_json(
             'http://rutube.ru/api/play/options/%s/?format=json' % video_id,
-            video_id, 'Downloading options JSON')
+            video_id, 'Downloading options JSON',
+            headers=self.geo_verification_headers())
 
         formats = []
         for format_id, format_url in options['video_balancer'].items():
@@ -176,8 +178,8 @@ class RutubePlaylistBaseIE(RutubeBaseIE):
                 break
 
             for result in results:
-                video_url = result.get('video_url')
-                if not video_url or not isinstance(video_url, compat_str):
+                video_url = url_or_none(result.get('video_url'))
+                if not video_url:
                     continue
                 entry = self._extract_video(result, require_title=False)
                 entry.update({
@@ -265,8 +267,10 @@ class RutubePlaylistIE(RutubePlaylistBaseIE):
 
     _PAGE_TEMPLATE = 'http://rutube.ru/api/playlist/%s/%s/?page=%s&format=json'
 
-    @staticmethod
-    def suitable(url):
+    @classmethod
+    def suitable(cls, url):
+        if not super(RutubePlaylistIE, cls).suitable(url):
+            return False
         params = compat_parse_qs(compat_urllib_parse_urlparse(url).query)
         return params.get('pl_type', [None])[0] and int_or_none(params.get('pl_id', [None])[0])