BorangeOrange1337
BorangeOrange1337

Reputation: 303

How to get user profile image URL with Tweepy / Twitter API V2

I've been trying to figure out the Twitter API v2 so I can pull the Profile Image URL of a specific username/ID, but I am not having any luck.

Here's my code. Anyone know where I'm going wrong?!

import tweepy

client = tweepy.Client(bearer_token='bearer')

tweets = client.get_user(username = 'jack', user_fields=['profile_image_url'])
print(tweets)

Response:

Response(data=<User id=12 name=jack username=jack>, includes={}, errors=[], meta={})

Upvotes: 1

Views: 1180

Answers (1)

matrix_wrangler
matrix_wrangler

Reputation: 11

try with user id's instead

user_ids = [2244994945, 6253282] #TwitterDev&API profile images

tweets = client.get_user(ids = user_ids, user_fields=['profile_image_url'])

Tweepy.org Examples for APIv2

Upvotes: 1

Related Questions