[9gag] Modernize
authorSergey M․ <dstftw@gmail.com>
Tue, 22 Sep 2015 19:48:13 +0000 (01:48 +0600)
committerSergey M․ <dstftw@gmail.com>
Tue, 22 Sep 2015 19:48:13 +0000 (01:48 +0600)
youtube_dl/extractor/ninegag.py

index 6daae73188b3aa57ab18fc340c551de406f2f220..d8e103189156c457ffd671fd43468f59bf1b6577 100644 (file)
@@ -58,9 +58,11 @@ class NineGagIE(InfoExtractor):
 
         webpage = self._download_webpage(url, display_id)
 
-        post_view = json.loads(self._html_search_regex(
-            r'var\s+postView\s*=\s*new\s+app\.PostView\({\s*post:\s*({.+?})\s*,\s*posts:\s*prefetchedCurrentPost',
-            webpage, 'post view'))
+        post_view = self._parse_json(
+            self._search_regex(
+                r'var\s+postView\s*=\s*new\s+app\.PostView\({\s*post:\s*({.+?})\s*,\s*posts:\s*prefetchedCurrentPost',
+                webpage, 'post view'),
+            display_id)
 
         ie_key = None
         source_url = post_view.get('sourceUrl')