changed to use .get to get field from json object
authorsprhawk <465558+sprhawk@users.noreply.github.com>
Mon, 1 Jan 2018 10:33:14 +0000 (18:33 +0800)
committersprhawk <465558+sprhawk@users.noreply.github.com>
Mon, 1 Jan 2018 10:33:14 +0000 (18:33 +0800)
youtube_dl/extractor/weibo.py

index 34809bdb291cc4255f8e39dccd1aab0a11d48fb9..cbe0c3228babefda67619dc48605fefa4ce864dc 100644 (file)
@@ -121,7 +121,7 @@ class WeiboMobileIE(InfoExtractor):
         webpage = self._download_webpage(url, video_id, note="visit the page")
         js_code = self._search_regex(r'var\s+\$render_data\s*=\s*\[({.*})\]\[0\] \|\| {};', webpage, 'js_code', flags=re.DOTALL)
         weibo_info = self._parse_json(js_code, video_id, transform_source=js_to_json)
-        page_info = weibo_info['status']['page_info']
+        page_info = weibo_info.get('status').get('page_info')
         title = weibo_info.get('status').get('status_title')
         uploader = weibo_info.get('status').get('user').get('screen_name')