1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

[instagram] Fix extractor

This commit is contained in:
The Hatsune Daishi 2020-10-23 12:34:05 +09:00 committed by GitHub
parent 48c5663c5f
commit f7960affb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,16 +126,23 @@ class InstagramIE(InfoExtractor):
uploader_id, like_count, comment_count, comments, height, uploader_id, like_count, comment_count, comments, height,
width) = [None] * 11 width) = [None] * 11
shared_data = self._parse_json( shared_data = try_get(webpage,
(lambda x: self._parse_json(
self._search_regex(
r'window\.__additionalDataLoaded\(\'/(?:p|tv)/(?:[^/?#&]+)/\',({.+?})\);',
x, 'additional data', default='{}'),
video_id, fatal=False),
lambda x: self._parse_json(
self._search_regex( self._search_regex(
r'window\._sharedData\s*=\s*({.+?});', r'window\._sharedData\s*=\s*({.+?});',
webpage, 'shared data', default='{}'), x, 'shared data', default='{}'),
video_id, fatal=False) video_id, fatal=False)['entry_data']['PostPage'][0]),
None)
if shared_data: if shared_data:
media = try_get( media = try_get(
shared_data, shared_data,
(lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'], (lambda x: x['graphql']['shortcode_media'],
lambda x: x['entry_data']['PostPage'][0]['media']), lambda x: x['media']),
dict) dict)
if media: if media:
video_url = media.get('video_url') video_url = media.get('video_url')