[instagram] add extractor for /tagged posts (#1439)
This commit is contained in:
@@ -328,7 +328,7 @@ class InstagramExtractor(Extractor):
|
|||||||
|
|
||||||
def _get_edge_data(self, user, key):
|
def _get_edge_data(self, user, key):
|
||||||
cursor = self.config("cursor")
|
cursor = self.config("cursor")
|
||||||
if cursor:
|
if cursor or not key:
|
||||||
return {
|
return {
|
||||||
"edges" : (),
|
"edges" : (),
|
||||||
"page_info": {
|
"page_info": {
|
||||||
@@ -386,6 +386,7 @@ class InstagramUserExtractor(InstagramExtractor):
|
|||||||
(InstagramPostsExtractor , base + "posts/"),
|
(InstagramPostsExtractor , base + "posts/"),
|
||||||
(InstagramReelsExtractor , base + "reels/"),
|
(InstagramReelsExtractor , base + "reels/"),
|
||||||
(InstagramChannelExtractor , base + "channel/"),
|
(InstagramChannelExtractor , base + "channel/"),
|
||||||
|
(InstagramTaggedExtractor , base + "tagged/"),
|
||||||
), ("posts",))
|
), ("posts",))
|
||||||
|
|
||||||
|
|
||||||
@@ -408,6 +409,25 @@ class InstagramPostsExtractor(InstagramExtractor):
|
|||||||
return self._pagination_graphql(query_hash, variables, edge)
|
return self._pagination_graphql(query_hash, variables, edge)
|
||||||
|
|
||||||
|
|
||||||
|
class InstagramTaggedExtractor(InstagramExtractor):
|
||||||
|
"""Extractor for ProfilePage tagged posts"""
|
||||||
|
subcategory = "tagged"
|
||||||
|
pattern = USER_PATTERN + r"/tagged"
|
||||||
|
test = ("https://www.instagram.com/instagram/tagged/", {
|
||||||
|
"range": "1-16",
|
||||||
|
"count": ">= 16",
|
||||||
|
})
|
||||||
|
|
||||||
|
def posts(self):
|
||||||
|
url = "{}/{}/".format(self.root, self.item)
|
||||||
|
user = self._extract_profile_page(url)
|
||||||
|
|
||||||
|
query_hash = "31fe64d9463cbbe58319dced405c6206"
|
||||||
|
variables = {"id": user["id"], "first": 50}
|
||||||
|
edge = self._get_edge_data(user, None)
|
||||||
|
return self._pagination_graphql(query_hash, variables, edge)
|
||||||
|
|
||||||
|
|
||||||
class InstagramChannelExtractor(InstagramExtractor):
|
class InstagramChannelExtractor(InstagramExtractor):
|
||||||
"""Extractor for ProfilePage channel"""
|
"""Extractor for ProfilePage channel"""
|
||||||
subcategory = "channel"
|
subcategory = "channel"
|
||||||
|
|||||||
Reference in New Issue
Block a user