Facebook共享错误:“网站”类型的URL处的对象无效,因为未提供“string”类型的必需属性“og:title”

时间:2017-09-20 07:47:23

标签: facebook facebook-graph-api

当我在Facebook调试器中粘贴我的博客的URL时,它不会选择标题和图像。在我的页面的视图源中,og:title和og:image正在渲染,但facebook scrapper没有读取任何内容。

“网站”类型的网址“http://blog.la-pigiste.com/2017/09/20/diy-faire-son-terrazzo-granito-do-it-yourself-inspiration-tendance-tutoriel/”上的对象无效,因为未提供“string”类型的必需属性“og:title”。

Facebook调试器也说“{   “错误”:{     “message”:“请求此资源需要访问令牌。”,     “type”:“OAuthException”,     “代码”:104,     “fbtrace_id”:“BMdGG7oTu6k”   } }“

但我不知道这意味着什么......

非常感谢任何帮助

1 个答案:

答案 0 :(得分:1)

尝试通过Open Graph Debugger为您的网址抓取新的抓取信息时,您会收到错误消息:

Curl Error : OPERATION_TIMEOUTED Operation timed out after 10000 milliseconds with 0 bytes received

换句话说,您的网络服务器在10秒内没有回复,抓取工具超时。

看起来您将Web服务器配置为在请求来自Facebook Crawler时表现不同。

您可以使用curl验证这一点。

使用curl的默认用户代理获取您的URL工作正常:

$ curl -v 'http://blog.la-pigiste.com/2017/09/20/diy-faire-son-terrazzo-granito-do-it-yourself-inspiration-tendance-tutoriel/' > /dev/null

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 149.56.140.68...
* TCP_NODELAY set
* Connected to blog.la-pigiste.com (149.56.140.68) port 80 (#0)
> GET /2017/09/20/diy-faire-son-terrazzo-granito-do-it-yourself-inspiration-tendance-tutoriel/ HTTP/1.1
> Host: blog.la-pigiste.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Wed, 20 Sep 2017 10:34:37 GMT
< Content-Type: text/html; charset=UTF-8
< Content-Length: 117446
< Connection: keep-alive
< Vary: Accept-Encoding
< Last-Modified: Wed, 20 Sep 2017 07:25:20 GMT
< Accept-Ranges: bytes
< Vary: Accept-Encoding
< X-Powered-By: PleskLin
< Cache-Control: max-age=0, no-cache, no-store, must-revalidate
< Pragma: no-cache
< Expires: Mon, 29 Oct 1923 20:30:00 GMT
<
{ [956 bytes data]
100  114k  100  114k    0     0   159k      0 --:--:-- --:--:-- --:--:--  159k
* Connection #0 to host blog.la-pigiste.com left intact

无论如何,当使用Facebook抓取工具用户代理(facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php))时,网络服务器会以不同的方式回复并且仅在大约14秒后回复:

$ curl -v -A "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)" 'http://blog.la-pigiste.com/2017/09/20/diy-faire-son-terrazzo-granito-do-it-yourself-inspiration-tendance-tutoriel/' > /dev/null

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 149.56.140.68...
* TCP_NODELAY set
* Connected to blog.la-pigiste.com (149.56.140.68) port 80 (#0)
> GET /2017/09/20/diy-faire-son-terrazzo-granito-do-it-yourself-inspiration-tendance-tutoriel/ HTTP/1.1
> Host: blog.la-pigiste.com
> User-Agent: facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
> Accept: */*
>
  0     0    0     0    0     0      0      0 --:--:--  0:00:14 --:--:--     0< HTTP/1.1 200 OK
< Server: nginx
< Date: Wed, 20 Sep 2017 10:37:15 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< X-Powered-By: PHP/5.6.30
< X-Pingback: http://blog.la-pigiste.com/xmlrpc.php
< Link: <http://blog.la-pigiste.com/wp-json/>; rel="https://api.w.org/", <...>; rel=shortlink
< Set-Cookie: wfvt_983661238=59c244cfe4c12; expires=Wed, 20-Sep-2017 11:07:03 GMT; Max-Age=1800; path=/; httponly
< Vary: Accept-Encoding
< X-Powered-By: PleskLin
<
{ [838 bytes data]
100  124k    0  124k    0     0   8507      0 --:--:--  0:00:15 --:--:-- 36126
* Connection #0 to host blog.la-pigiste.com left intact

确保您的网络服务器及时回复并使用正确的HTML,并且抓取工具将能够获取您的OG标记。