Facebook Open Graph Image - facebook

I had to restore a php page from an old version and now facebook debugging is not finding the og:image tag any more.
A share url is: https://maltishlanguage.com/dictionary/0603/
If I share debug the link on the LinkedIn post inspector, the og:image is shown correctly.
in the tag, I have an og:image (http jpg URL) and a og:image:secure (https jpeg URL)
The Graph API Explorer gives a good image:
{
"url": "https://maltishlanguage.com/dictionary/0523/rude/1?s=s",
"type": "website",
"title": "Maltish - I am turning round in the nothing",
"image": [
{
"url": "http://maltishlanguage.com/images/fbMaltishLanguageDictionary.jpg"
}
],
"description": "Maltish Dictionary entry from the Expression 'Qed indur fix-xejn '",
"updated_time": "2022-07-21T05:24:04+0000"
}

#Cbroe solved the issue for me, many thanks and sorry i did not understand you initially, but I just checked by setting Google into cookieless mode which showed the error where I had a session check, but in the else I was still tryiong toe read the session if not set and it was thoring the error #CBroe mentioned!
Solved and it's working now :)
So issue was that a PHP error was being written to the outpu HTML in the HEAD tag.

Related

Get scraped data from facebook graph api using url reliably

My app needs to get data facebook scrapes from URLs. Up until now we were getting it using
POST /?id={object-instance-id or object-url}&scrape=true
Which is detailed in updating object section in https://developers.facebook.com/docs/sharing/opengraph/using-objects
For example
POST /?id=http://google.com
{
"url": "http://www.google.com/",
"type": "website",
"title": "Google",
"image": [
{
"url": "http://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png"
}
],
"description": "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.",
"updated_time": "2015-10-06T11:34:58+0000",
"id": "381702034999"
}
Notice image section.
Unfortunately if og tags are configured wrongly on the server
POST /?id=http://some.page.with.bad.tags.com
{
"error": {
"message": "Invalid parameter",
"type": "FacebookApiException",
"code": 100,
"error_subcode": 1611016,
"is_transient": false,
"error_user_title": "Object Invalid Value",
"error_user_msg": "Object at URL 'http://some.page.with.bad.tags' of type '' is invalid because the given value '/some-bad-value' for property 'og:url' could not be parsed as type 'url'.",
"fbtrace_id": "abcabcabc"
}
}
Which returns nothing interesting.
Attempt to GET the url returns this:
{
"og_object": {
"id": "381702034999",
"description": "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.",
"title": "Google",
"type": "website",
"updated_time": "2015-10-06T11:40:04+0000",
"url": "http://www.google.com/"
},
"share": {
"comment_count": 2,
"share_count": 13494003
},
"id": "http://www.google.com"
}
Which misses image section. I cannot find in the documentation any way to retrieve result with images without using POST /?id={url}, but that fails on any errors in og tags.
GET /{ObjectId}
returns only type and created_time
Entering the same broken link in https://developers.facebook.com/tools/debug/ results in page which contains image, description, title and captions for the page. Which I need. So it means facebook stores them, even though page has wrong tags, but I need a way to fetch them. Unfortunatelly I cannot provide link for broken url due to NDA, and I couldn't find other page with broken tags.
If the page contains invalid Open Graph markup this seems expected, also do not confuse the Graph API with some sort of datasource or a scraping service you can utilize to generate the preview for web content.
If Facebook , for whatever reason, can't parse the Open Graph tags of a URL it will try to make a good guess based on the content of the page (large junks of text, images it finds, title tags etc.) to build the preview so you might get some sort of data back from GET /{object-id} which can just be a guess instead of actual og:.. data.
In case you really need a more or less failsafe solution, you could build your own scraper that looks for Open Graph tags.

Facebook returning a 206 response only from a determined server

I'm trying to post a feed using Facebook javascript API (FB.ui). When I post the feed, the image field appears empty.
Of course I've tried the URL from the example provided by facebook http://www.fbrell.com/f8.jpg and it works fine. Then I downloaded this image and uploaded to my server and tried again and got nothing.
Using the facebook debugger, the facebook example image returns a 200 message, and the same image from my server returns a 206 message, which I believe is the reason why it's not showing in the feed dialog.
This is the Graph API output from debugger:
{
"id": "530885910309390",
"url": "http://www.zx-works.com/img/f8.jpg",
"type": "website",
"title": "http://www.zx-works.com/img/f8.jpg",
"updated_time": "2013-06-01T18:48:22+0000",
"created_time": "2013-06-01T18:23:58+0000",
"is_scraped": true
}
Question is: what can possibly change from one server to another to facebook not get the image correctly? Is something I can do to fix it from my server side? It's running Apache 2.2.24. Someone runned into this problem before?
Facebook uses ipv6 to scrap your website. Is your DNS set to ipv6? Did your server controlpanel (like directadmin) allow ipv6 access?
Otherwise, contact your hosting company to answer these questions and you'll be fine!

Is it possible to get default Facebook Group profile pictures?

According to the officlal Facebook document, it seems that Facebook Graph API can treat Facebook Group profile pictures. However, the picture link provided at Connections section on the document doesn't return the proper image. The URL redirects to /images/icons/group-types/large/default.png, which is apparently a path for default profile picture, but it actually returns JSON that has data like this:
{
"error": {
"message": "Unknown path components: /icons/group-types/large/default.png",
"type": "OAuthException",
"code": 2500
}
}
Is this a bug of Facebook? Are there any ideas to avoid this?
Thanks in advance!
Looks like a bug, to workaround it, get the image as a String instead of a HTTP redirect:
https://graph.facebook.com/195466193802264?fields=picture
The Response is:
"picture": "/images/icons/group-types/large/default.png"
parse that, and if you get back a relative URL, prepend it with http://www.facebok.com
In this specific case, it works: Link here
In the meantime, you should File a bug report and get this updated in the API

Set Size of SWF posted to Facebook with Feed Dialog

Is there a way to set the dimensions of a swf posted to Facebook using the feed dialog, either javascript or direct url method?
https://developers.facebook.com/docs/reference/dialogs/feed/
I'm not 100% certain that this works anymore as I've tried to add this with the Feed dialog as opposed to the sharer and it seemed to have no effect at all. It may have been replaced by the source parameter in the newer feed dialog API (which I don't think you can define a width/height for. Please correct me if I'm wrong) ..
but,
take a look at media attachments in the stream attachment guide:
https://developers.facebook.com/docs/guides/attachments/
you would pass in a JSON encoded object as the media URL param.
{"media": [{
"type": "flash",
"swfsrc": "http://www.mapsofwar.com/photos/EMPIRE17.swf",
"imgsrc": "http://icanhascheezburger.files.wordpress.com/2009/04/funny-pictures-hairless-cat-phones-home.jpg",
"width": "80",
"height": "60",
"expanded_width": "160",
"expanded_height": "120"
}]}

Facebook – Does a page exist for this URL?

I'm making a webpage/SEO checking page, where I can put in a URL and it will tell me various facts about the page.
I'd like to be able to tell if there is a Facebook page associated with the URL. Is this possible using the API, or by other means?
For instance, https://www.facebook.com/focalstrategy links to http://www.focalstrategy.com/ on the info tab – is there a way to go the other way and enter the URL and find the page(s)?
(Bonus points – anyone know of a way to do the same for Twitter accounts)
I don't think this is possible. Using the API, you can retrieve info about the url:
http://graph.facebook.com/?id=http://www.focalstrategy.com/
Would return:
{
"id": "http://www.focalstrategy.com/",
"shares": 38
}
Now I'm note sure if using the Open Graph Meta Tags would help return more data (still not what you need), but here is my website info without trailing slash:
http://graph.facebook.com/?id=http://www.masteringapi.com
Would return:
{
"id": "109784969102047",
"name": "MasteringAPI.com",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/276619_109784969102047_474156823_s.jpg",
"link": "http://www.masteringapi.com/",
"likes": 25,
"category": "Website",
"website": "http://www.masteringapi.com",
"description": "Master Facebook, Google and Twitter APIs! Learn Facebook Application Development Now!",
"can_post": true
}