Browse Source

[svtplay] Fix svt id extraction (closes #26425, closes #26428, closes #26438)

Sergey M․ 5 years ago
parent
commit
5ed05f26ad
1 changed files with 9 additions and 3 deletions
  1. 9 3
      youtube_dl/extractor/svt.py

+ 9 - 3
youtube_dl/extractor/svt.py

@@ -224,9 +224,15 @@ class SVTPlayIE(SVTPlayBaseIE):
                 self._adjust_title(info_dict)
                 return info_dict
 
-        svt_id = self._search_regex(
-            r'<video[^>]+data-video-id=["\']([\da-zA-Z-]+)',
-            webpage, 'video id')
+            svt_id = try_get(
+                data, lambda x: x['statistics']['dataLake']['content']['id'],
+                compat_str)
+
+        if not svt_id:
+            svt_id = self._search_regex(
+                (r'<video[^>]+data-video-id=["\']([\da-zA-Z-]+)',
+                 r'"content"\s*:\s*{.*?"id"\s*:\s*"([\da-zA-Z-]+)"'),
+                webpage, 'video id')
 
         return self._extract_by_video_id(svt_id, webpage)