【问题标题】:Facebook share error: Object at URL of type 'website' is invalid because a required property 'og:title' of type 'string' was not providedFacebook 共享错误:“网站”类型的 URL 上的对象无效,因为未提供“字符串”类型的必需属性“og:title”
【发布时间】:2018-03-01 04:03:22
【问题描述】:

✋????

当我将博客的 URL 粘贴到 Facebook 调试器中时,它没有选择标题和图像。在我页面的查看源代码中,og:title 和 og:image 正在呈现,但 facebook scraper 没有读取任何内容。

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

Facebook 调试器还显示“{ “错误”: { "message": "请求此资源需要访问令牌。", “类型”:“OAuthException”, “代码”:104, “fbtrace_id”:“BMdGG7oTu6k” } }"

但我不知道这是什么意思.... ????

非常感谢任何帮助????????

【问题讨论】:

标签: facebook facebook-graph-api


【解决方案1】:

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

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

换句话说,您的网络服务器在 10 秒内没有回复,爬虫超时。

当请求来自 Facebook Crawler 时,您似乎将 Web 服务器配置为不同的行为。

您可以使用 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 标签。

【讨论】:

  • 非常感谢!你只是提醒我使用 curl 进行调试。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-08
  • 2019-09-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多