Pull twitter profile image

后端 未结 8 2027
有刺的猬
有刺的猬 2020-12-12 23:28

Is there a quick way to pull twitter profile image in PHP or Javascript? I need to get the url of the FULL image (not avatar size). Thanks. Any code sample is good.

8条回答
  •  粉色の甜心
    2020-12-13 00:13

    So, it's not in the docs (http://dev.twitter.com/doc/get/users/profile_image/:screen_name), but it looks like after retrieving the image by specifying any of the three sizes (bigger, normal, mini), you can just remove the suffix before the file extension to get the original image. Hmm... is this safe to use?

    For example, this query: api.twitter.com/1/users/profile_image/rrbrambley

    Results in: a2.twimg.com/profile_images/931772958/deformed_cropped_headonly_normal.jpg

    If I change this url by removing "_normal" then I get the original image: a2.twimg.com/profile_images/931772958/deformed_cropped_headonly.jpg

    I know there are apps that use the original image. This must be the way?

提交回复
热议问题