更新 URL 到 Facebook 用户的个人资料图片

Get updated URL to facebook user's profile pic

我正在使用 facebook 的图表 api 来获取有关用户的基本信息。 在向 /me?fields=id,name,picture 发送请求时,我收到以下响应

{
  "id": "645636655991071",
  "name": "Rahul Dahal",
  "picture": {
    "data": {
      "height": 50,
      "is_silhouette": false,
      "url": "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=645636655991071&height=50&width=50&ext=1619960875&hash=AeSav5aZhqO_ExOLOPc",
      "width": 50
    }
  }
}

picture对象的url属性图片有URL,但过一段时间就过期了

这意味着我无法将 URL 存储在数据库中。

如何获取更新后的 URL 图片?

试试这个代码片段:

.fit-picture {
    width: 50px;
}
<img class="fit-picture"
     src="https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=645636655991071&height=50&width=50&ext=1619960875&hash=AeSav5aZhqO_ExOLOPc"
     alt="Grapefruit slice atop a pile of other slices">