]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[comcarcoff] Improve json data regex and modernize
authorSergey M․ <dstftw@gmail.com>
Tue, 22 Dec 2015 19:10:31 +0000 (01:10 +0600)
committerSergey M․ <dstftw@gmail.com>
Tue, 22 Dec 2015 19:16:14 +0000 (01:16 +0600)
youtube_dl/extractor/comcarcoff.py

index 4391b7ce4ce50973b05ed1dcb255fc819e0e113d..edf5b29a08cc01cf8f88d3ec4952569beb8aa813 100644 (file)
@@ -31,9 +31,10 @@ class ComCarCoffIE(InfoExtractor):
             display_id = 'comediansincarsgettingcoffee.com'
         webpage = self._download_webpage(url, display_id)
 
-        full_data = json.loads(self._search_regex(
-            r'\nwindow.app = (?P<json>.+?);\n',
-            webpage, 'full data json'))['videoData']
+        full_data = self._parse_json(
+            self._search_regex(
+                r'window\.app\s*=\s*({.+?});\n', webpage, 'full data json'),
+            display_id)['videoData']
 
         video_id = full_data['activeVideo']['video']
         video_data = full_data.get('videos', {}).get(video_id) or full_data['singleshots'][video_id]