1

我正在使用 Facebook Open Graph 来讲述我的用户关注其他用户的故事。我创建了一个名为“trusts”的自定义操作。

我希望附加到关注用户的 URL 是该用户在站点中的 URL,即:myapp/users/64

但是,当我实现 Open Graph 时,它会在抓取 URL 时返回错误。

原因当然是用户页面在登录协议后面,当爬虫试图点击它时,它会重定向到登录页面。

我构建了一个不重定向的自定义页面,但你猜怎么着?url 行(见下文)导致 Facebook 无论如何都尝试使用该 URL,因此我面临同样的问题。

任何人都可以帮忙吗?

这是代码:

物体:

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# kweekwegg: http://ogp.me/ns/fb/kweekwegg#"
>  <meta property="fb:app_id" content="<%= Facebook::APP_ID %>" /> 
  <meta property="og:type"   content="kweekwegg:user" /> 
  <meta property="og:url"    content="<%= Facebook::SITE_URL%>users/<%= params[:facebook_user] %>" /> 
  <meta property="og:title"  content="Ange" /> 
  <meta property="og:image"  content="https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"/>

那个行动:

function postTrust(user_id){
    alert("<%= Facebook::SITE_URL %>user_scrape?facebook_user="+user_id);
    FB.api(
  'me/kweekwegg:trust',
  'post',
  {
    user: "<%= Facebook::SITE_URL %>user_scrape?facebook_user="+user_id
    //user: "http://samples.ogp.me/371640646273751"
  },
  function(response) {
    alert(response.id);
  }
);
}

最后请记住,我创建了一个不需要标识的自定义页面,只需将用户 ID 作为 postTrust 函数的参数 - 然而 FB 似乎仍在 ping 该 URL,因此出现错误。

4

0 回答 0