Compare commits

...
2 Commits
Author SHA1 Message Date
Alexander Graf 2c116683c2 Release of Version 4.8.1 2021-08-10 09:15:11 +02:00
Alexander Graf 054fa47245 Fix rare KeyError: 'video_versions' error
Closes #1251.
2021-08-10 09:13:42 +02:00
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
__version__ = '4.8'
__version__ = '4.8.1'
try:
+10 -2
View File
@@ -379,7 +379,11 @@ class Post:
if self.is_video:
version_urls = [self._field('video_url')]
if self._context.iphone_support and self._context.is_logged_in:
version_urls.extend(version['url'] for version in self._iphone_struct['video_versions'])
try:
version_urls.extend(version['url'] for version in self._iphone_struct['video_versions'])
except (InstaloaderException, KeyError, IndexError) as err:
self._context.error(f"Unable to fetch high-quality video version of {self}: {err}")
return version_urls[0]
else:
return version_urls[0]
url_candidates: List[Tuple[int, str]] = []
@@ -1127,7 +1131,11 @@ class StoryItem:
if self.is_video:
version_urls = [self._node['video_resources'][-1]['src']]
if self._context.iphone_support and self._context.is_logged_in:
version_urls.extend(version['url'] for version in self._iphone_struct['video_versions'])
try:
version_urls.extend(version['url'] for version in self._iphone_struct['video_versions'])
except (InstaloaderException, KeyError, IndexError) as err:
self._context.error(f"Unable to fetch high-quality video version of {self}: {err}")
return version_urls[0]
else:
return version_urls[0]
url_candidates: List[Tuple[int, str]] = []