1

Basically, I am looking to do the inverse of this question: Getting the "real" Facebook profile picture URL from graph API

So, if this is my image URL:

https://scontent.xx.fbcdn.net/hprofile-xat1/v/t1.0-1/p200x200/1538635_10152313443182867_788243216_n.jpg?oh=72d672bc10ab01386ad5e490c097e059&oe=56A4392D

the design of Facebook's CDN will cause that URL to expire and 404 in the near future. So I am wondering, is it possible to get a URL that will not expire? For the above example, the permanent URL is this:

http://graph.facebook.com/517267866/picture?type=large

which will always 302 to an image URL. I am not sure if this is possible, but any insight would be appreciated.

I also tried looking for a solution in Facebook's Graph API documentation but I couldn't find any reference to this issue. Although I am unfamiliar with the Facebook Graph API, I think posting this question can help others in a similar position.


Update

Here is a slightly different example: How do I find a reliable image URL for the following photo:

https://www.facebook.com/DuwamishTreeCanopy/photos/pb.350520565135304.-2207520000.1444201132./401682256685801/?type=3&theater

?

Community
  • 1
  • 1
modulitos
  • 14,737
  • 16
  • 67
  • 110

1 Answers1

-1

You cannot "extract" something out of the CDN link... Why don't you just stick with the

https://graph.facebook.com/{user_id}/picture?type=large 

link? It should also work without an access token and with app-scoped user ids AFAIK.

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • I don't have the Facebook graph link; I only have the CDN link. Let's say that I have a spreadsheet with a column `ImageUrl`, but the url's are all CDN links. What can I do besides downloading and hosting all of the images myself? Is it possible to keep a reference to these links, yet still hosted by Facebook? Somehow I suspect that this is the exact situation that Facebook wants to avoid. – modulitos Oct 07 '15 at 06:58
  • That's a bad design IMHO. You should save the `user_id`, from which you can construct the correct URL at any time. AS you already stated, the CDN url will get invalid, and there's no way to my knowledge with what you can reconstruct the profile from – Tobi Oct 07 '15 at 07:00
  • But what if the image is not a profile photo? (I made an update to my question above) – modulitos Oct 07 '15 at 07:02
  • The same applies to that... It's not clear to me how you retrieve the URLs at first place. `401682256685801` would be the photo id in this case, but I wouldn't recommend to use extraction to get those. FB can change the link structure at any time. If you want reliable results, you should use the Graph API – Tobi Oct 07 '15 at 07:03
  • I have used Graph-API and some of the CDN link of my Facebook page images are no longer loading. Can you please take have a look to my question? Thanks! https://stackoverflow.com/questions/63876241/does-facebook-delete-original-version-of-uploaded-image-after-a-while?noredirect=1#comment112954335_63876241 – Avow Studio Sep 14 '20 at 00:05