1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-11-04 09:22:29 +01:00

Minor fixes of download_stories()

Concerning pull request #28.
This commit is contained in:
André Koch-Kramer 2017-07-28 19:49:48 +02:00
parent b85e8fd793
commit 13d288ef36

View File

@ -627,15 +627,16 @@ class Instaloader:
return downloaded return downloaded
def download_stories(self, def download_stories(self,
userids: List[int] = [], userids: Optional[List[int]] = None,
download_videos: bool = True, download_videos: bool = True,
fast_update: bool = False) -> None: fast_update: bool = False) -> None:
""" """
Download 'unseen' stories from user followees. Or all stories of users whose ID are give. Download 'unseen' stories from user followees or all stories of users whose ID are given.
Does not mark stories as seen. Does not mark stories as seen.
:param fast_update: If true, abort when first already-downloaded picture is encountered :param userids: List of user IDs to be processed in terms of downloading their stories
:param download_videos: True, if videos should be downloaded :param download_videos: True, if videos should be downloaded
:param fast_update: If true, abort when first already-downloaded picture is encountered
""" """
if self.username is None: if self.username is None:
@ -656,11 +657,10 @@ class Instaloader:
resp = tempsession.get(url) resp = tempsession.get(url)
if resp.status_code != 200: if resp.status_code != 200:
raise ConnectionException('Failed to fetch stories.') raise ConnectionException('Failed to fetch stories.')
print(resp.text)
return json.loads(resp.text) return json.loads(resp.text)
if userids: if userids is not None:
for id in userids: for userid in userids:
url = 'https://i.instagram.com/api/v1/feed/user/{0}/reel_media/'.format(id) url = 'https://i.instagram.com/api/v1/feed/user/{0}/reel_media/'.format(userid)
yield _get(url) yield _get(url)
else: else:
url = 'https://i.instagram.com/api/v1/feed/reels_tray/' url = 'https://i.instagram.com/api/v1/feed/reels_tray/'