Skip to content

Commit

Permalink
[instagram] Fix extraction when authenticated (closes #27422)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsh authored and dstftw committed Dec 26, 2020
1 parent d61ed9f commit 58e5519
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions youtube_dl/extractor/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ def _real_extract(self, url):
(lambda x: x['entry_data']['PostPage'][0]['graphql']['shortcode_media'],
lambda x: x['entry_data']['PostPage'][0]['media']),
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:
video_url = media.get('video_url')
height = int_or_none(media.get('dimensions', {}).get('height'))
Expand Down

0 comments on commit 58e5519

Please sign in to comment.