Can I force a refresh of a Facebook Object's i

2020-07-23 09:06发布

问题:

I have several objects hosted by Facebook that are posted to users' activity logs. The URL for the image is pointed to our content delivery solution, which redirects to a versioned image. This means that the URL can stay constant, but the image might change.

As you can see in this image

when the image changes, Facebook can still load it correctly (see the og:image column), but the image created in the actual post (see the hover text, which comes from https://fbexternal-a.akamaihd.net/safe_image.php) seems to be cached. I have found that changing the URL by adding a dummy parameter works (and we can do that if necessary), but if there's a way to force Facebook to refresh its cached image, that would be better. Does such a call or method exist?

In similar questions, I have heard that POST calls to

https://graph.facebook.com/?id=[ID]&scrape=true

can rescrape the data, but I have been unsuccessful with that call (it appears to only scrape the data if the object is self-hosted, is that right?).

There was also something about adding fbrefresh=[ANYTHING] to the URL, but it sounds like that is equivalent to adding a dummy parameter.

Also, using the debugger does not seem to do anything either. I have entered tried:

- http://developers.facebook.com/tools/debug/og/object?q=[ID]
- http://developers.facebook.com/tools/debug/og/object?q=[ID]&refresh=[ANYTHING]
- http://developers.facebook.com/tools/debug/og/object?q=[Image URL]
- http://developers.facebook.com/tools/debug/og/object?q=[Image URL]&refresh=[ANYTHING]

Also

- http://graph.facebook.com/?id=[ID]&scrape=true

All to no avail.

Lastly, does anyone know if/when the cache might be refresh normally? Or would it be expected that the image persists forever?

回答1:

This document says:

Updating Objects

When an action is published, or a Like button pointing to the object clicked, Facebook will 'scrape' the HTML page of the object and read the meta tags. The object scrape also occurs when:

    The object URL is input in the Object Debugger
    Every 7 days after the first scrape
    When an app triggers a scrape using an API endpoint

This Graph API endpoint is simply a call to:

POST /?id={object-instance-id or object-url}&scrape=true

When you do this scrape=true thing, facebook will go to the og:url parameter and scrape all og parameters on this site. So make sure that this page (og:url) has the appropriate og:image meta tag with the new image url.

If you update the image, you've to rename it (update og:image url) otherwise facebook doesn't know that you've a new image.