1
0
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-12-23 18:07:09 +00:00

changed to use .get to get field from json object

This commit is contained in:
sprhawk 2018-01-01 18:33:14 +08:00
parent 48058d82dc
commit 6648fd8ad6

View File

@ -121,7 +121,7 @@ class WeiboMobileIE(InfoExtractor):
webpage = self._download_webpage(url, video_id, note="visit the page") 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) 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) 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') title = weibo_info.get('status').get('status_title')
uploader = weibo_info.get('status').get('user').get('screen_name') uploader = weibo_info.get('status').get('user').get('screen_name')