trevorhobenshield/twitter-api-client

Question: How to get the user id from username?

Closed this issue · 3 comments

Hi, thanks for all your hard work on this project folks.

I'm trying to block a list of users, but I need the userid (https://github.com/trevorhobenshield/twitter-api-client/blob/main/twitter/account.py#L367), but I only have Twitter usernames.

The official docs, can take screen_name as a param (https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create).

So question is, how to get the user id from username please?

did u find any way to do it?

Thanks for the question.

The user ID will need to be parsed from the JSON response returned by scraper.users(["user1", "user2", ...])