Facebook Image URL gets expired

后端 未结 4 1425
予麋鹿
予麋鹿 2021-02-05 00:59

I am pulling Facebook posts using facebook-graph API, now the problem is Image gets expired after few days.

I have the following URL for a single Image<

相关标签:
4条回答
  • 2021-02-05 01:27

    http://prntscr.com/h2fe45 here's the part that stays the same and that's all you need to get it every time the link is changed. I saved images back in 2013 and I still can access them.Its almost 2018.

    0 讨论(0)
  • 2021-02-05 01:47

    you can not store facebook Images url for a long time, it expires for security purpose, so it would be a better solution to store images in your server.

    0 讨论(0)
  • 2021-02-05 01:51

    You should store the original image URL for sure, and use a 302 redirect parser to get the CDN URL, one example is https://scontent-ort2-1.xx.fbcdn.net/v/t45.1600-4/120202220_23846099766190042_1642096590788171162_n.jpg?_nc_cat=108&ccb=2&_nc_sid=2aac32&_nc_ohc=CE0J2Ao5cYkAX_JJ0Me&_nc_ht=scontent-ort2-1.xx&oh=f48cbb1bec21e685e0cbaaf6782a61a1&oe=5FE056E5 and we can just guess oe=5FE056E5 means the expiration, as 5FE056E5(hexadecimal) -> 1608537829(decimal, in UTC), if you interpret this timestamp you will find the time is about a month later, and maybe we can guess the expiration is about a month after getting the CDN URL? To another similar case, you can refer to: https://stackoverflow.com/a/27596727/4721007

    0 讨论(0)
  • 2021-02-05 01:53

    What i came to know from other community about this issue is

    "You should not store Facebook CDN URLs for long time use – they can change over time.

    Either request the actual image and copy that to your server – or request the current CDN URL regularly.

    (You might be tempted to try other workarounds, like extracting the actual image source URL from the CDN link, but I would advise against that – because the format of that might change at any time as well.)"

    0 讨论(0)
提交回复
热议问题