download_profile: Request story only if has_highlight_reel

This is a simple modification to save GraphQL queries, hence to more likely
stay within rate limits without having to wait between profiles.

Fixes #112.
This commit is contained in:
Alexander Graf 2018-05-08 18:10:28 +02:00
parent b3df5a5f07
commit 211b2269ff
2 changed files with 10 additions and 3 deletions

View File

@ -699,9 +699,12 @@ class Instaloader:
# Download stories, if requested
if download_stories or download_stories_only:
with self.context.error_catcher("Download stories of {}".format(profile_name)):
self.download_stories(userids=[profile.userid], filename_target=profile_name, fast_update=fast_update,
storyitem_filter=storyitem_filter)
if profile.has_highlight_reel:
with self.context.error_catcher("Download stories of {}".format(profile_name)):
self.download_stories(userids=[profile.userid], filename_target=profile_name,
fast_update=fast_update, storyitem_filter=storyitem_filter)
else:
self.context.log("{} does not have any stories.".format(profile_name))
if download_stories_only:
return

View File

@ -481,6 +481,10 @@ class Profile:
def has_blocked_viewer(self) -> bool:
return self._metadata('has_blocked_viewer')
@property
def has_highlight_reel(self) -> bool:
return self._metadata('has_highlight_reel')
@property
def has_requested_viewer(self) -> bool:
return self._metadata('has_requested_viewer')