[instagram:stories] add 'split' option (#7521)
This commit is contained in:
@@ -3085,6 +3085,16 @@ Description
|
|||||||
Do not download videos
|
Do not download videos
|
||||||
|
|
||||||
|
|
||||||
|
extractor.instagram.stories.split
|
||||||
|
---------------------------------
|
||||||
|
Type
|
||||||
|
* ``bool``
|
||||||
|
Default
|
||||||
|
``false``
|
||||||
|
Description
|
||||||
|
Split ``stories`` elements into separate posts.
|
||||||
|
|
||||||
|
|
||||||
extractor.itaku.videos
|
extractor.itaku.videos
|
||||||
----------------------
|
----------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -365,7 +365,11 @@
|
|||||||
"order-files": "asc",
|
"order-files": "asc",
|
||||||
"order-posts": "asc",
|
"order-posts": "asc",
|
||||||
"previews" : false,
|
"previews" : false,
|
||||||
"videos" : true
|
"videos" : true,
|
||||||
|
|
||||||
|
"stories": {
|
||||||
|
"split": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"itaku":
|
"itaku":
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -583,7 +583,10 @@ class InstagramStoriesExtractor(InstagramExtractor):
|
|||||||
reel_id = self.highlight_id or self.api.user_id(self.user)
|
reel_id = self.highlight_id or self.api.user_id(self.user)
|
||||||
reels = self.api.reels_media(reel_id)
|
reels = self.api.reels_media(reel_id)
|
||||||
|
|
||||||
if self.media_id and reels:
|
if not reels:
|
||||||
|
return ()
|
||||||
|
|
||||||
|
if self.media_id:
|
||||||
reel = reels[0]
|
reel = reels[0]
|
||||||
for item in reel["items"]:
|
for item in reel["items"]:
|
||||||
if item["pk"] == self.media_id:
|
if item["pk"] == self.media_id:
|
||||||
@@ -592,6 +595,16 @@ class InstagramStoriesExtractor(InstagramExtractor):
|
|||||||
else:
|
else:
|
||||||
raise exception.NotFoundError("story")
|
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
|
return reels
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user