Satya
Satya

Reputation: 11

How to get twitter original profile picture through API call

right now we are getting 84*84 profile picture, but we need original twitter profile picture into http n https. Please lemme know how to get dat?

Upvotes: 0

Views: 2174

Answers (1)

anon
anon

Reputation:

You'll find the URL to the user's profile image in the profile_image_url_https field in the User object.

Note that, in the next version of the Twitter API (Twitter Developer Labs), the field is simply called profile_image_url and it will always return an https URL value. Do not use the legacy profile_image_url if you are using the v1.1 API.

Once you have the URL, you can add or modify the end of the path to request different sizes. Twitter supports a number of different values: normal, bigger, mini, and original. By default, you'll get back the "normal" variant which is probably 48x48px.

For example, my profile image is currently returned as https://pbs.twimg.com/profile_images/1230679874039427074/sMPPa2tz_normal.jpg

You can request "bigger" by changing the URL to include _bigger instead of _normal, or you can ask for the original size by dropping _normal completely. In the case of the example above, that currently returns a 400x400px image.

Upvotes: 1

Related Questions