[twitter] add 'profile' extractor (#3623)
This commit is contained in:
@@ -898,7 +898,7 @@ Consider all listed sites to potentially be NSFW.
|
||||
<tr>
|
||||
<td>Twitter</td>
|
||||
<td>https://x.com/</td>
|
||||
<td>Avatars, Backgrounds, Bookmarks, Communities, Events, Followed Users, Hashtags, individual Images, Likes, Lists, List Members, Media Timelines, Quotes, Search Results, Timelines, Tweets, User Profiles</td>
|
||||
<td>Avatars, Backgrounds, Bookmarks, Communities, Events, Followed Users, Hashtags, individual Images, Likes, Lists, List Members, Media Timelines, User Profile Data, Quotes, Search Results, Timelines, Tweets, User Profiles</td>
|
||||
<td>Supported</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -854,6 +854,24 @@ class TwitterQuotesExtractor(TwitterExtractor):
|
||||
yield Message.Queue, url, data
|
||||
|
||||
|
||||
class TwitterProfileExtractor(TwitterExtractor):
|
||||
"""Extractor a user's profile data"""
|
||||
subcategory = "profile"
|
||||
pattern = BASE_PATTERN + r"/(?!search)([^/?#]+)/profile"
|
||||
example = "https://x.com/USER/profile"
|
||||
|
||||
def items(self):
|
||||
api = TwitterAPI(self)
|
||||
|
||||
screen_name = self.user
|
||||
if screen_name.startswith("id:"):
|
||||
user = api.user_by_rest_id(screen_name[3:])
|
||||
else:
|
||||
user = api.user_by_screen_name(screen_name)
|
||||
|
||||
return iter(((Message.Directory, self._transform_user(user)),))
|
||||
|
||||
|
||||
class TwitterAvatarExtractor(TwitterExtractor):
|
||||
subcategory = "avatar"
|
||||
filename_fmt = "avatar {date}.{extension}"
|
||||
|
||||
Reference in New Issue
Block a user