Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL signature expired error when viewing Instagram images from Instagram API

I am getting the instagram images from instagram API. (endpoint : https://api.instagram.com/v1/users/self/media/recent?access_token= ). Then I am saving the image URLs that returning from the API call in the database and use them in the front-end. Exmple image url is below.

Example URL : https://scontent.cdninstagram.com/vp/xxx/xxx/xx/s150x150/xxx/x.x.x.x/xxxx_n.jpg

But sometimes the images doesn't show and when I go to the image particular link it shows 'URL signature expired'. What would be the reason for that?

I have referred the question about the same in a previous post in stack overflow and it didn't help. It said to save the image in a separate server. It won't work for me.

like image 579
i am batman Avatar asked Sep 05 '18 12:09

i am batman


Video Answer


2 Answers

Instagram CDN URLs contain timestamp components that allow them to expire after a while. If you need the image to persist, you'll have to save it somewhere and serve that instead.

like image 188
ceejayoz Avatar answered Sep 16 '22 13:09

ceejayoz


You can visit https://www.instagram.com/p/CQX8lKutaZU/media/?size=l

Use; "l" parameter for large,

"m" parameter for medium,

"t" parameter for small pictures.

But sadly it doesn't work on videos (it just shows thumbnails)

like image 25
Melikşah Bozkurt Avatar answered Sep 19 '22 13:09

Melikşah Bozkurt