Q:

Facebook scraper. Can I reply with different content for it?

I'm developing an url shortener and the current specification requires to avoid Facebook from scraping those links and instead an integrated scraper will do that and hand over the og meta tags to Facebook.
Is there anything in Facebook terms that doesn't allow me to reply to its scraper with different content (e.g. an empty page with opengraph meta tags only) from what a regular user would see?
Thanks in advance.

A:

I just did this on my site.
I am redirecing non-mobile devices to another page but want the facebook scraper to get the content a mobile device would get.
This is the User Agent I get:
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)

so matching against a regular pattern like this should detect the facebook scraper.
/^(facebookexternalhit.*)/

As mentioned above, this user agent can be spoofed easily which, in my case, doesn't matter.
Only problem could occur if facebook changes the user agent of their crawling script.

