Share Cache Timeout - facebook

How long is the timeout for facebook share cache. I edited all of my pages and changes must be reflected.
If timeout is unlimited, i have to debug all pages via curl etc.
Thanks.

You can manually "clear" the facebook cache by using the Debugger.
Just go there, enter the url you changed and click "debug", that will cause the facebook bot to request the data from your servers even if it was already fetched and cached, and the new data will replace the old.
Edit
800k of pages is a lot, no doubt.
According to the Like Button doc:
Facebook scrapes your page every 24 hours to ensure the properties are
up to date. The page is also scraped when an admin for the Open Graph
page clicks the Like button and when the URL is entered into the
Facebook URL Linter. Facebook observes cache headers on your URLs - it
will look at "Expires" and "Cache-Control" in order of preference.
However, even if you specify a longer time, Facebook will scrape your
page every 24 hours.
(The URL Linter is the Debugger)
But from my experience it's not always the case, I haven't found any pattern to it, but I came across data that was months old and the cache was not clear until i manually used the debugger to extract the new data.
If you still want to manually refresh the data fb has, you can probably write a script that posts the url to the same form action in the Debugger page, I don't think they are using a csrf protection.
In that way you can automate this action for all your pages, it might take a while, but nothing too serious.

I was using window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(url_to_share)) to make a share popup and no matter what I did, the cached share was not clearing until I did the following:
Put the URL you're trying to share into the Facebook URL Linter.
Scroll down to the "Share Preview"
Click "See this in the share dialog"
Copy the URL from that page
Put that URL in your window.open([put the url here]) popup and voila!

Related

Reset facebook like url for pages

We've had few pages on our site which were open only for signed-in users. However, the urls of these pages were shared on facebook and whenever facebook visited these pages it got redirected to common page which is shown for non signed-in users.
Now, we have opened these pages for all and implemented like button on these pages. And whenever someone likes one page it gets reflected on other pages as well, I am assuming this is because facebook internally still thinks all point to same url.
However, I am setting the href attribute to these pages, still it doesn't work.
Is there a way where I can reset the counter for these pages and make facebook treat these as new pages? I did try passing few GET params, still it shows old counter
Enter the URLs into this Facebook Lint form (or make requests to this page with the proper parameters from an application) and it will clear Facebook's cache of those pages.
https://developers.facebook.com/tools/debug
I figured it out. I just had to make facebook re-crawl these pages again. I could have waited for 24hrs, which is the frequency with which facebook crawls pages. I chose to use facebook linter, which makes facebook query the url immediately
http://developers.facebook.com/tools/debug

"URL is unreachable" error for Facebook comments box being cached?

Our website uses the Facebook Comments Box plugin. We include the comments box on our staging site that is behind our firewall, which means Facebook can't access it and generates the "URL is unreachable" error. This I understand.
However, once a page is published, and is reachable by Facebook, the error is still displayed. This can be easily fixed by clicking on the debug link provided along with the error, but my content editors don't want to have to do this every time, and they sometimes forget.
It seems like the reachable status is cached and reset once you use the debugger. Can anyone think of another explanation?
I suppose I could omit the Facebook comments box from the staging site, but would prefer not to. Any other ideas?
In the documentation of the Like Button they explain when the page is being scraped :
When does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around
the site.
Facebook scrapes your page every 24 hours to ensure the properties are
up to date. The page is also scraped when an admin for the Open Graph
page clicks the Like button and when the URL is entered into the
Facebook URL Linter. Facebook observes cache headers on your URLs - it
will look at "Expires" and "Cache-Control" in order of preference.
However, even if you specify a longer time, Facebook will scrape your
page every 24 hours.
The user agent of the scraper is: "facebookexternalhit/1.1
(+http://www.facebook.com/externalhit_uatext.php)"
Here are three options:
You can call the debugger by issuing a simple http request, you can do that from the server when you publish your article (or what ever you're publishing), you don't have to use the debugger tool.
You can check the user agent string for requests and if it's the facebook scraper allow it so that it can cache the page.
You can use different urls for production and staging, that way the cache of the staging pages won't matter in production.

How to make the facebook share spider not to cache the page

I like the share button more than the like button, thats why i'm using it. The problem is that if the title of the page change and when someone paste it into facebook is still with the old title
Sample code
I put span with a tag in the bottom of the page
http://www.facebook.com/share.php?u=http://stackoverflow.com
Using the share functionality is not a good decision since it has been deprecated and is no longer supported, as it clearly states here:
The Share button has been deprecated in favor of the Like button, and
will no longer be supported. Please use the Like button whenever
possible to drive maximum traffic to your apps.
And here:
What happened to the old Share button?
We deprecated the Share Button when we launched the Like button,
because the Like button improves clickthrough rates by allowing users
to connect with one click, and by allowing them to see which of their
friends have already connected.
With that said, to answer your question, it also written in the Like Button guide:
When does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around
the site.
Facebook scrapes your page every 24 hours to ensure the properties are
up to date. The page is also scraped when an admin for the Open Graph
page clicks the Like button and when the URL is entered into the
Facebook URL Linter. Facebook observes cache headers on your URLs - it
will look at "Expires" and "Cache-Control" in order of preference.
However, even if you specify a longer time, Facebook will scrape your
page every 24 hours.
The user agent of the scraper is: "facebookexternalhit/1.1
(+http://www.facebook.com/externalhit_uatext.php)"
To clear the cache the easiest thing is to just use the Debug Tool.

How to force facebookexternalhit to reaccess?

I'm playing with facebook links via posting them. On the frist time a access from a user agent containing "facebookexternalhit" will visit your site and look for some meta tags.
So far so good that works. But if I try to repost the link no furure calls happens. How can I trigger to let facebook read the page again?
Are there some API calls I can use to trigger an update?
in the documentation for the Like Button it says:
When does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around
the site.
Facebook scrapes your page every 24 hours to ensure the properties are
up to date. The page is also scraped when an admin for the Open Graph
page clicks the Like button and when the URL is entered into the
Facebook URL Linter. Facebook observes cache headers on your URLs - it
will look at "Expires" and "Cache-Control" in order of preference.
However, even if you specify a longer time, Facebook will scrape your
page every 24 hours.
The user agent of the scraper is: "facebookexternalhit/1.1
(+http://www.facebook.com/externalhit_uatext.php)"
The Linter is now known as the Facebook Debugger and when you use it for a url, it will clear the facebook cache for the same url and will then cache the new result.
One trick you can use is to simply append a "random" GET parameter to the URL that you're sharing. It won't have any effect on the page's content, but will cause Facebook's scraper bot to reaccess your site.
Original URLs:
http://example.com
http://example.com?param=1
New URLs that will force a "reaccess":
http://example.com?cache_buster=784932789532
http://example.com?param=1&cache_buster=784932789532

Choosing which image shows when you use Facebook's Send button

I'm trying to add a Like and Send button to me site, but when I click 'send' it randomly picks an image. I've even deleted that image as well as changed that image to the image I want, but it's still displaying the wrong image.
Is there anyway I can choose which image is shown there? I've tried adding the Open Graph Tags to the tag, but again it's still showing the wrong image.
Thanks
You can change it with the open graph tags, but unless you reset the cache on FB's side, it will continue to use the same image as it did.
Facebook scrapes your page every 24 hours to ensure the properties are
up to date. The page is also scraped when an admin for the Open Graph
page clicks the Like button and when the URL is entered into the
Facebook URL Linter. Facebook observes cache headers on your URLs - it
will look at "Expires" and "Cache-Control" in order of preference.
However, even if you specify a longer time, Facebook will scrape your
page every 24 hours.
Facebook URL Linter