Merge branch 'master' into upcoming/v4.6
This commit is contained in:
commit
097bf7fecc
@ -1,7 +1,7 @@
|
|||||||
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
|
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
|
||||||
|
|
||||||
|
|
||||||
__version__ = '4.5.4'
|
__version__ = '4.5.5'
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -222,14 +222,13 @@ def _main(instaloader: Instaloader, targetlist: List[str],
|
|||||||
# Instaloader did at least save a session file
|
# Instaloader did at least save a session file
|
||||||
instaloader.context.log("No targets were specified, thus nothing has been downloaded.")
|
instaloader.context.log("No targets were specified, thus nothing has been downloaded.")
|
||||||
else:
|
else:
|
||||||
# Instloader did not do anything
|
# Instaloader did not do anything
|
||||||
instaloader.context.log("usage:" + usage_string())
|
instaloader.context.log("usage:" + usage_string())
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = ArgumentParser(description=__doc__, add_help=False, usage=usage_string(),
|
parser = ArgumentParser(description=__doc__, add_help=False, usage=usage_string(),
|
||||||
epilog="Report issues at https://github.com/instaloader/instaloader/issues. "
|
epilog="The complete documentation can be found at "
|
||||||
"The complete documentation can be found at "
|
|
||||||
"https://instaloader.github.io/.",
|
"https://instaloader.github.io/.",
|
||||||
fromfile_prefix_chars='+')
|
fromfile_prefix_chars='+')
|
||||||
|
|
||||||
|
@ -320,8 +320,10 @@ class InstaloaderContext:
|
|||||||
redirect_url = resp.headers['location']
|
redirect_url = resp.headers['location']
|
||||||
self.log('\nHTTP redirect from https://{0}/{1} to {2}'.format(host, path, redirect_url))
|
self.log('\nHTTP redirect from https://{0}/{1} to {2}'.format(host, path, redirect_url))
|
||||||
if redirect_url.startswith('https://www.instagram.com/accounts/login'):
|
if redirect_url.startswith('https://www.instagram.com/accounts/login'):
|
||||||
|
if not self.is_logged_in:
|
||||||
|
raise LoginRequiredException("Redirected to login page. Use --login.")
|
||||||
# alternate rate limit exceeded behavior
|
# alternate rate limit exceeded behavior
|
||||||
raise TooManyRequestsException("429 Too Many Requests: redirected to login")
|
raise TooManyRequestsException("Redirected to login")
|
||||||
if redirect_url.startswith('https://{}/'.format(host)):
|
if redirect_url.startswith('https://{}/'.format(host)):
|
||||||
resp = sess.get(redirect_url if redirect_url.endswith('/') else redirect_url + '/',
|
resp = sess.get(redirect_url if redirect_url.endswith('/') else redirect_url + '/',
|
||||||
params=params, allow_redirects=False)
|
params=params, allow_redirects=False)
|
||||||
|
@ -263,6 +263,7 @@ def resumable_iteration(context: InstaloaderContext,
|
|||||||
try:
|
try:
|
||||||
yield is_resuming, start_index
|
yield is_resuming, start_index
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
if os.path.dirname(resume_file_path):
|
||||||
os.makedirs(os.path.dirname(resume_file_path), exist_ok=True)
|
os.makedirs(os.path.dirname(resume_file_path), exist_ok=True)
|
||||||
save(iterator.freeze(), resume_file_path)
|
save(iterator.freeze(), resume_file_path)
|
||||||
context.log("\nSaved resume information to {}.".format(resume_file_path))
|
context.log("\nSaved resume information to {}.".format(resume_file_path))
|
||||||
|
@ -1114,14 +1114,14 @@ class Story:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def last_seen_local(self) -> Optional[datetime]:
|
def last_seen_local(self) -> Optional[datetime]:
|
||||||
"""Timestamp when the story has last been watched or None (local time zone)."""
|
"""Timestamp of the most recent StoryItem that has been watched or None (local time zone)."""
|
||||||
if self._node['seen']:
|
if self._node['seen']:
|
||||||
return datetime.fromtimestamp(self._node['seen'])
|
return datetime.fromtimestamp(self._node['seen'])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def last_seen_utc(self) -> Optional[datetime]:
|
def last_seen_utc(self) -> Optional[datetime]:
|
||||||
"""Timestamp when the story has last been watched or None (UTC)."""
|
"""Timestamp of the most recent StoryItem that has been watched or None (UTC)."""
|
||||||
if self._node['seen']:
|
if self._node['seen']:
|
||||||
return datetime.utcfromtimestamp(self._node['seen'])
|
return datetime.utcfromtimestamp(self._node['seen'])
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user