Search code examples
facebookfacebook-graph-apifacebook-sdk-4.x

Getting image and text from facebook post


Is there any possibility to extract/get the image and description from Facebook post in code?

Let say we have a public post https://www.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/10154095214621676/?type=3&theater

Do we able to extract/get the image and description(Get the new dance remixes ...) of that particular post by using Facebook sdk in code?

thanks in advance


Solution

  • Yes, it's possible. You can access the Graph API through a GET request and the photo ID (in your case it's 10154095214621676). As long as the photo originates from a public page you can call for different parameters like name (that's the description), picture (small image), etc.

    You can play around with the Graph API Explorer to figure out what exactly you need. For a more detailed information on the possible parameters you might want to have a look into the Facebook Developers Documentation. There you can also find some examples how to handle requests in different SDKs.