[instagram] Add more formats when logged in (#1487)

Authored by: u-spec-png
This commit is contained in:
u-spec-png 2021-10-31 02:54:39 +00:00 committed by GitHub
parent 652fb0d446
commit cd9ea4104b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,8 +222,8 @@ def _real_extract(self, url):
dict) 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 = try_get(media, lambda x: x['dimensions']['height'])
width = int_or_none(media.get('dimensions', {}).get('width')) width = try_get(media, lambda x: x['dimensions']['width'])
description = try_get( description = try_get(
media, lambda x: x['edge_media_to_caption']['edges'][0]['node']['text'], media, lambda x: x['edge_media_to_caption']['edges'][0]['node']['text'],
compat_str) or media.get('caption') compat_str) or media.get('caption')
@ -231,8 +231,8 @@ def _real_extract(self, url):
thumbnail = media.get('display_src') or media.get('display_url') thumbnail = media.get('display_src') or media.get('display_url')
duration = float_or_none(media.get('video_duration')) duration = float_or_none(media.get('video_duration'))
timestamp = int_or_none(media.get('taken_at_timestamp') or media.get('date')) timestamp = int_or_none(media.get('taken_at_timestamp') or media.get('date'))
uploader = media.get('owner', {}).get('full_name') uploader = try_get(media, lambda x: x['owner']['full_name'])
uploader_id = media.get('owner', {}).get('username') uploader_id = try_get(media, lambda x: x['owner']['username'])
def get_count(keys, kind): def get_count(keys, kind):
for key in variadic(keys): for key in variadic(keys):
@ -294,6 +294,10 @@ def get_count(keys, kind):
'width': width, 'width': width,
'height': height, 'height': height,
}] }]
dash = try_get(media, lambda x: x['dash_info']['video_dash_manifest'])
if dash:
formats.extend(self._parse_mpd_formats(self._parse_xml(dash, video_id), mpd_id='dash'))
self._sort_formats(formats)
if not uploader_id: if not uploader_id:
uploader_id = self._search_regex( uploader_id = self._search_regex(