[twitter] add 'profile' extractor (#3623)

pull/5824/head
Mike Fährmann 3 months ago
parent 44896b0296
commit c2bf4ff99c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -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}"

Loading…
Cancel
Save