[instagram] Fix extraction when authenticated (closes #27422)

This commit is contained in:
Andrew Udvare 2019-10-28 03:54:03 -04:00 committed by Sergey M․
parent d61ed9f2f1
commit 58e55198c1
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -137,6 +137,16 @@ class InstagramIE(InfoExtractor):
(lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'], (lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
lambda x: x['entry_data']['PostPage'][0]['media']), lambda x: x['entry_data']['PostPage'][0]['media']),
dict) dict)
if not media:
additional_data = self._parse_json(
self._search_regex(r'window\.__additionalDataLoaded\(\'[^\']+\',\s*({.+?})\);',
webpage, 'additional data', default='{}'),
video_id, fatal=False)
if additional_data:
media = try_get(
additional_data,
lambda x: x['graphql']['shortcode_media'],
dict)
if media: if media:
video_url = media.get('video_url') video_url = media.get('video_url')
height = int_or_none(media.get('dimensions', {}).get('height')) height = int_or_none(media.get('dimensions', {}).get('height'))