diff --git a/docs/configuration.rst b/docs/configuration.rst index a995c139..fdae3a99 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3085,6 +3085,16 @@ Description Do not download videos +extractor.instagram.stories.split +--------------------------------- +Type + * ``bool`` +Default + ``false`` +Description + Split ``stories`` elements into separate posts. + + extractor.itaku.videos ---------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 0fbf834b..f6e80345 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -365,7 +365,11 @@ "order-files": "asc", "order-posts": "asc", "previews" : false, - "videos" : true + "videos" : true, + + "stories": { + "split": false + } }, "itaku": { diff --git a/gallery_dl/extractor/instagram.py b/gallery_dl/extractor/instagram.py index 0f88cac3..0da44f92 100644 --- a/gallery_dl/extractor/instagram.py +++ b/gallery_dl/extractor/instagram.py @@ -583,7 +583,10 @@ class InstagramStoriesExtractor(InstagramExtractor): reel_id = self.highlight_id or self.api.user_id(self.user) reels = self.api.reels_media(reel_id) - if self.media_id and reels: + if not reels: + return () + + if self.media_id: reel = reels[0] for item in reel["items"]: if item["pk"] == self.media_id: @@ -592,6 +595,16 @@ class InstagramStoriesExtractor(InstagramExtractor): else: raise exception.NotFoundError("story") + elif self.config("split"): + reel = reels[0] + reels = [] + for item in reel["items"]: + item.pop("user", None) + copy = reel.copy() + copy.update(item) + copy["items"] = (item,) + reels.append(copy) + return reels