mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-08-19 00:39:42 +02:00
[instagram] Fix extractor
This commit is contained in:
parent
adb118da26
commit
987d2e079a
@ -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,
|
||||||
self._search_regex(
|
(lambda x: self._parse_json(
|
||||||
r'window\._sharedData\s*=\s*({.+?});',
|
self._search_regex(
|
||||||
webpage, 'shared data', default='{}'),
|
r'window\.__additionalDataLoaded\(\'/(?:p|tv)/(?:[^/?#&]+)/\',({.+?})\);',
|
||||||
video_id, fatal=False)
|
x, 'additional data', default='{}'),
|
||||||
|
video_id, fatal=False),
|
||||||
|
lambda x: self._parse_json(
|
||||||
|
self._search_regex(
|
||||||
|
r'window\._sharedData\s*=\s*({.+?});',
|
||||||
|
x, 'shared data', default='{}'),
|
||||||
|
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user