Fetch Twitter User's Profile Picture

Hi all,

Does anyone know if/how to fetch a specific Twitter user’s profile picture? I thought the LinkPreview plugin would work but it just fetches the standard Twitter logo, not the user’s profile pic. Anyone know how to achieve this, where I would provide the user’s URL and the plugin would fetch the profile pic?

Thanks! :smiley:

1 Like

Short answer. Get a Twitter Developer Account and use the V2 of the API to get https://api.twitter.com/2/users/by/username/:username to return profile_image_url (specify you want this in the user.fields param.

Longer answer : You can’t make unauthorsised calls to twitter API now, so you need to set up a developer account at developer.twitter.com - it is fairly simple.

Twitter are moving over the V2 of the API, so I suggest you use that, as it is likely to be simpler. You will need to generate a token to use the API.

Shout if you need more.

3 Likes

Nigel,

You, sir, are a scholar and a gentleman! That’s perfect - thanks so much!!

1 Like

This works great! Very handy, thank you.
Any idea how to get a larger image, I can only return the _normal which is pixelated