merge #6331: [twitter] add 'followers' extractor

This commit is contained in:
Mike Fährmann
2025-04-19 18:29:11 +02:00
3 changed files with 27 additions and 1 deletions

View File

@@ -798,6 +798,17 @@ class TwitterFollowingExtractor(TwitterExtractor):
return self._users_result(TwitterAPI(self).user_following(self.user))
class TwitterFollowersExtractor(TwitterExtractor):
"""Extractor for a user's followers"""
subcategory = "followers"
pattern = BASE_PATTERN + r"/(?!search)([^/?#]+)/followers(?!\w)"
example = "https://x.com/USER/followers"
def items(self):
self.login()
return self._users_result(TwitterAPI(self).user_followers(self.user))
class TwitterSearchExtractor(TwitterExtractor):
"""Extractor for Twitter search results"""
subcategory = "search"
@@ -1411,6 +1422,15 @@ class TwitterAPI():
}
return self._pagination_users(endpoint, variables)
def user_followers_verified(self, screen_name):
endpoint = "/graphql/GHg0X_FjrJoISwwLPWi1LQ/BlueVerifiedFollowers"
variables = {
"userId": self._user_id_by_screen_name(screen_name),
"count": 100,
"includePromotedContent": False,
}
return self._pagination_users(endpoint, variables)
def user_following(self, screen_name):
endpoint = "/graphql/4QHbs4wmzgtU91f-t96_Eg/Following"
variables = {