[4tube] Style and make more robust
authorSergey M․ <dstftw@gmail.com>
Thu, 8 Oct 2015 14:21:07 +0000 (20:21 +0600)
committerSergey M․ <dstftw@gmail.com>
Thu, 8 Oct 2015 15:05:27 +0000 (21:05 +0600)
youtube_dl/extractor/fourtube.py

index 226ee67f072e3f783015e3fbc737ff08955d3b5a..406387e574512fe49001eafe240ebc616ad0565f 100644 (file)
@@ -66,8 +66,11 @@ class FourTubeIE(InfoExtractor):
             webpage, 'like count', fatal=False))
         duration = parse_duration(self._html_search_meta('duration', webpage))
 
-        player_url = self._search_regex(r'<script id="playerembed" src="([^"]+)">',webpage,'player javascript')
-        player_js = self._download_webpage(player_url,video_id,'Downloading player Javascript')
+        player_js = self._download_webpage(
+            self._search_regex(
+                r'<script[^>]id=(["\'])playerembed\1[^>]+src=(["\'])(?P<url>.+?)\2',
+                webpage, 'player JS', group='url'),
+            video_id, 'Downloading player JS')
 
         params_js = self._search_regex(
             r'\$\.ajax\(url,\ opts\);\s*\}\s*\}\)\(([0-9,\[\] ]+)\)',