[instagram] add 'stories-tray' extractor (#6582)
https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3230919124
This commit is contained in:
@@ -460,7 +460,7 @@ Consider all listed sites to potentially be NSFW.
|
||||
<tr id="instagram" title="instagram">
|
||||
<td>Instagram</td>
|
||||
<td>https://www.instagram.com/</td>
|
||||
<td>Avatars, Collections, Followers, Followed Users, Guides, Highlights, User Profile Information, Posts, Reels, Saved Posts, Stories, Tag Searches, Tagged Posts, User Profiles</td>
|
||||
<td>Avatars, Collections, Followers, Followed Users, Guides, Highlights, User Profile Information, Posts, Reels, Saved Posts, Stories, Stories Home Tray, Tag Searches, Tagged Posts, User Profiles</td>
|
||||
<td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td>
|
||||
</tr>
|
||||
<tr id="issuu" title="issuu">
|
||||
|
||||
@@ -568,6 +568,20 @@ class InstagramCollectionExtractor(InstagramExtractor):
|
||||
return self.api.user_collection(self.collection_id)
|
||||
|
||||
|
||||
class InstagramStoriesTrayExtractor(InstagramExtractor):
|
||||
"""Extractor for your Instagram account's stories tray"""
|
||||
subcategory = "stories-tray"
|
||||
pattern = rf"{BASE_PATTERN}/stories/me/?$()"
|
||||
example = "https://www.instagram.com/stories/me/"
|
||||
|
||||
def items(self):
|
||||
base = f"{self.root}/stories/id:"
|
||||
for story in self.api.reels_tray():
|
||||
story["date"] = text.parse_timestamp(story["latest_reel_media"])
|
||||
story["_extractor"] = InstagramStoriesExtractor
|
||||
yield Message.Queue, f"{base}{story['id']}/", story
|
||||
|
||||
|
||||
class InstagramStoriesExtractor(InstagramExtractor):
|
||||
"""Extractor for Instagram stories"""
|
||||
subcategory = "stories"
|
||||
@@ -793,7 +807,11 @@ class InstagramRestAPI():
|
||||
try:
|
||||
return self._call(endpoint, params=params)["reels_media"]
|
||||
except KeyError:
|
||||
raise exception.AuthorizationError("Login required")
|
||||
raise exception.AuthRequired("authenticated cookies")
|
||||
|
||||
def reels_tray(self):
|
||||
endpoint = "/v1/feed/reels_tray/"
|
||||
return self._call(endpoint)["tray"]
|
||||
|
||||
def tags_media(self, tag):
|
||||
for section in self.tags_sections(tag):
|
||||
|
||||
@@ -310,6 +310,7 @@ SUBCATEGORY_MAP = {
|
||||
"posts": "",
|
||||
"saved": "Saved Posts",
|
||||
"tagged": "Tagged Posts",
|
||||
"stories-tray": "Stories Home Tray",
|
||||
},
|
||||
"itaku": {
|
||||
"posts": "",
|
||||
|
||||
@@ -109,6 +109,11 @@ __tests__ = (
|
||||
"#class" : instagram.InstagramStoriesExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.instagram.com/stories/me/",
|
||||
"#class" : instagram.InstagramStoriesTrayExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.instagram.com/s/aGlnaGxpZ2h0OjE4MDQyNTA5NDg4MTcwMDk1",
|
||||
"#category": ("", "instagram", "highlights"),
|
||||
|
||||
Reference in New Issue
Block a user