Instagram / feed API media URL shows "URL Signature Expired"

I use the Instagram feed API to display my Instagram posts on my website. But in some URLs, the URL signature is displayed.

Any solution for me?

+16
php instagram-api instagram
source share
4 answers

Instagram has added URL signatures to its media URLs.

You can easily remove the URL signature with this regular expression: "vp. * /. {32} /. {8} /"

For example in PHP:

preg_replace('/vp.*\/.{32}\/.{8}\//', '', $mediaUrl) 

On the other hand, I don’t think that removing the URL signature is the best solution (this is just a quick fix). Good to call the Instagram API again to get a new URL.


UPDATE

It seems like Instagram is currently checking the signature of the URL and returns a 403 "Access denied" error if the signature is missing, so now the only solution is to call the Instagram API again to get the new multimedia URL.

UPDATE April 2018

Instagram has closed its endpoint β€œapi.instagram.com/v1/media/”, so it’s currently not possible to update the post URLs.

A possible solution is to upload media files and store them on your own servers (I do not recommend this solution because it violates the terms of the Instagram API, so do it at your own peril and risk).

Another solution is to call the origin endpoint again where you found the funds again (but it is currently difficult to manage calls with a new API speed limit).

You can also find some unofficial Instagram APIs on github that may help you.

+18
source share

At the time of writing, your only alternative is to somehow store or cache images.

For example, you can store images in your database. Instagram platform policies require that you delete images when your application no longer needs them.

Alternatively, if you use CDNs, you can transfer these images through an image proxy and then set long expiration dates on the CDN. This way you do not save the images in the database, but your users can see them after the expiration of the URL signature.

+4
source share

You can use the media URL with some additional parameters as a solution to get the desired image, instead of using a direct link to the image.

for example

 https://www.instagram.com/p/Bo7OXJ3hYM8/media/?size=m 

Pay attention to the addon / media /? Size = m

Letters can be t , m or l for different image sizes

This should return your desired image.

Link: https://www.instagram.com/developer/embedding/

+3
source share

just press CTRL + S to save the page and you will have a photo in the folder where you save it

0
source share

All Articles