aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Udvare <audvare@gmail.com>2019-10-28 03:54:03 -0400
committerSergey M․ <dstftw@gmail.com>2020-12-26 22:31:55 +0700
commit58e55198c1b13949b20f6912feed9ec9d9214950 (patch)
tree5319cd91dfc4bb27d35aaab35d298b290135f1df
parentd61ed9f2f15b1962646547f582c6637e7fa70df7 (diff)
[instagram] Fix extraction when authenticated (closes #27422)
-rw-r--r--youtube_dl/extractor/instagram.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/extractor/instagram.py b/youtube_dl/extractor/instagram.py
index b061850a1..0755896de 100644
--- a/youtube_dl/extractor/instagram.py
+++ b/youtube_dl/extractor/instagram.py
@@ -137,6 +137,16 @@ class InstagramIE(InfoExtractor):
(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'))