mirror of
https://github.com/instaloader/instaloader.git
synced 2024-09-11 16:22:24 +02:00
parent
9e04ef3436
commit
a0b7804fd2
@ -198,6 +198,8 @@ Exceptions
|
|||||||
|
|
||||||
.. autoexception:: BadCredentialsException
|
.. autoexception:: BadCredentialsException
|
||||||
|
|
||||||
|
.. autoexception:: PostChangedException
|
||||||
|
|
||||||
.. autoexception:: TooManyRequestsException
|
.. autoexception:: TooManyRequestsException
|
||||||
|
|
||||||
``InstaloaderContext`` (Low-level functions)
|
``InstaloaderContext`` (Low-level functions)
|
||||||
|
@ -57,5 +57,10 @@ class ConnectionException(InstaloaderException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class PostChangedException(InstaloaderException):
|
||||||
|
""".. versionadded:: 4.2.2"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TooManyRequestsException(ConnectionException):
|
class TooManyRequestsException(ConnectionException):
|
||||||
pass
|
pass
|
||||||
|
@ -939,8 +939,22 @@ class Instaloader:
|
|||||||
self.context.log('<skipped>')
|
self.context.log('<skipped>')
|
||||||
continue
|
continue
|
||||||
with self.context.error_catcher("Download {} of {}".format(post, profile_name)):
|
with self.context.error_catcher("Download {} of {}".format(post, profile_name)):
|
||||||
downloaded = self.download_post(post, target=profile_name)
|
# The PostChangedException gets raised if the Post's id/shortcode changed while obtaining
|
||||||
if fast_update and not downloaded:
|
# additional metadata. This is most likely the case if a HTTP redirect takes place while
|
||||||
|
# resolving the shortcode URL.
|
||||||
|
# The `post_changed` variable keeps the fast-update functionality alive: A Post which is
|
||||||
|
# obained after a redirect has probably already been downloaded as a previous Post of the
|
||||||
|
# same Profile.
|
||||||
|
# Observed in issue #225: https://github.com/instaloader/instaloader/issues/225
|
||||||
|
post_changed = False
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
downloaded = self.download_post(post, target=profile_name)
|
||||||
|
break
|
||||||
|
except PostChangedException:
|
||||||
|
post_changed = True
|
||||||
|
continue
|
||||||
|
if fast_update and not downloaded and not post_changed:
|
||||||
break
|
break
|
||||||
|
|
||||||
if stories and profiles:
|
if stories and profiles:
|
||||||
|
@ -128,6 +128,9 @@ class Post:
|
|||||||
pic_json = self._context.get_json("p/{0}/".format(self.shortcode), params={})
|
pic_json = self._context.get_json("p/{0}/".format(self.shortcode), params={})
|
||||||
self._full_metadata_dict = pic_json['entry_data']['PostPage'][0]['graphql']['shortcode_media']
|
self._full_metadata_dict = pic_json['entry_data']['PostPage'][0]['graphql']['shortcode_media']
|
||||||
self._rhx_gis_str = pic_json['rhx_gis']
|
self._rhx_gis_str = pic_json['rhx_gis']
|
||||||
|
if self.mediaid != self._full_metadata_dict['id']:
|
||||||
|
self._node.update(self._full_metadata_dict)
|
||||||
|
raise PostChangedException
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _full_metadata(self) -> Dict[str, Any]:
|
def _full_metadata(self) -> Dict[str, Any]:
|
||||||
|
Loading…
Reference in New Issue
Block a user