浏览代码

[youtube] Send the list of patterns directly to _search_regex

Lukáš Lalinský 9 年之前
父节点
当前提交
b41631c4e6
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      youtube_dl/extractor/youtube.py

+ 3 - 4
youtube_dl/extractor/youtube.py

@@ -879,10 +879,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
             r';ytplayer\.config\s*=\s*({.*?});ytplayer',
             r';ytplayer\.config\s*=\s*({.*?});',
         ]
-        for pattern in patterns:
-            config = self._search_regex(pattern, webpage, 'ytconfig.player', default=None)
-            if config is not None:
-                return json.loads(uppercase_escape(config))
+        config = self._search_regex(patterns, webpage, 'ytconfig.player', default=None)
+        if config is not None:
+            return json.loads(uppercase_escape(config))
 
     def _get_automatic_captions(self, video_id, webpage):
         """We need the webpage for getting the captions url, pass it as an