merge #6331: [twitter] add 'followers' extractor
This commit is contained in:
@@ -998,7 +998,7 @@ Consider all listed sites to potentially be NSFW.
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Twitter</td>
|
<td>Twitter</td>
|
||||||
<td>https://x.com/</td>
|
<td>https://x.com/</td>
|
||||||
<td>Avatars, Backgrounds, Bookmarks, Communities, Events, Followed Users, Hashtags, individual Images, User Profile Information, Likes, Lists, List Members, Media Timelines, Quotes, Search Results, Timelines, Tweets, User Profiles</td>
|
<td>Avatars, Backgrounds, Bookmarks, Communities, Events, Followers, Followed Users, Hashtags, individual Images, User Profile Information, Likes, Lists, List Members, Media Timelines, Quotes, Search Results, Timelines, Tweets, User Profiles</td>
|
||||||
<td>Supported</td>
|
<td>Supported</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -798,6 +798,17 @@ class TwitterFollowingExtractor(TwitterExtractor):
|
|||||||
return self._users_result(TwitterAPI(self).user_following(self.user))
|
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):
|
class TwitterSearchExtractor(TwitterExtractor):
|
||||||
"""Extractor for Twitter search results"""
|
"""Extractor for Twitter search results"""
|
||||||
subcategory = "search"
|
subcategory = "search"
|
||||||
@@ -1411,6 +1422,15 @@ class TwitterAPI():
|
|||||||
}
|
}
|
||||||
return self._pagination_users(endpoint, variables)
|
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):
|
def user_following(self, screen_name):
|
||||||
endpoint = "/graphql/4QHbs4wmzgtU91f-t96_Eg/Following"
|
endpoint = "/graphql/4QHbs4wmzgtU91f-t96_Eg/Following"
|
||||||
variables = {
|
variables = {
|
||||||
|
|||||||
@@ -271,6 +271,12 @@ __tests__ = (
|
|||||||
"#class" : twitter.TwitterFollowingExtractor,
|
"#class" : twitter.TwitterFollowingExtractor,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://twitter.com/supernaturepics/followers",
|
||||||
|
"#category": ("", "twitter", "followers"),
|
||||||
|
"#class" : twitter.TwitterFollowersExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://twitter.com/search?q=nature",
|
"#url" : "https://twitter.com/search?q=nature",
|
||||||
"#category": ("", "twitter", "search"),
|
"#category": ("", "twitter", "search"),
|
||||||
|
|||||||
Reference in New Issue
Block a user