mirror of
https://github.com/bellingcat/snscrape.git
synced 2026-06-08 02:28:29 +03:00
Extract user ID
This commit is contained in:
@@ -44,6 +44,7 @@ class User(typing.NamedTuple, snscrape.base.Item, snscrape.base.Entity):
|
||||
# Most fields can be None if they're not known.
|
||||
|
||||
username: str
|
||||
id: str # Seems to always be numeric, but the API returns it as a string, so it might also contain other things in the future
|
||||
description: typing.Optional[str] = None # Description as it's displayed on the web interface with URLs replaced
|
||||
rawDescription: typing.Optional[str] = None # Raw description with the URL(s) intact
|
||||
descriptionUrls: typing.Optional[typing.List[DescriptionURL]] = None
|
||||
@@ -322,6 +323,7 @@ class TwitterUserScraper(TwitterSearchScraper):
|
||||
description = rawDescription
|
||||
return User(
|
||||
username = user['legacy']['screen_name'],
|
||||
id = user['rest_id'],
|
||||
description = description,
|
||||
rawDescription = rawDescription,
|
||||
descriptionUrls = [{'text': x['display_url'], 'url': x['expanded_url'], 'tcourl': x['url'], 'indices': tuple(x['indices'])} for x in user['legacy']['entities']['description']['urls']],
|
||||
|
||||
Reference in New Issue
Block a user