Google的ampUrls:batchGet返回404吗?

时间:2019-02-21 11:06:46

标签: google-api amp-html

我们已经在2017年左右建立了一个计划脚本,该脚本针对Google的AMP验证API测试了许多URI。

尚未对脚本进行年龄检查,但是最近我们的一位用户抱怨说,没有URI列出AMP等效项(我们使用API​​来查找页面AMP版本的原因)。

现在,看一下Google的documentation并使用嵌入式测试面板测试我们的JSON有效负载,一切正常。

但是,当针对列表中列出的API端点从我们的服务器执行相同的数据时,我们会收到404错误。实际上,仅将API端点URI复制/粘贴到浏览器也将返回404,这有点意外。

我们是否缺少某些东西,或者Google只是在不通知其文档页面的情况下就关闭了该服务,还是?。

我只是发布带有URI的基本JSON负载,我想检查它们是否具有可用的AMP版本,例如:

{
"urls": [
"https://www.dailymail.co.uk/sport/football/article-6729017/Is-VAR-working-change-Reporters-analyse-video-technology-football.html?ns_mchannel=rss&ns_campaign=1490&ito=1490",
"https://www.talouselama.fi/uutiset/te/2223797c-6be5-3be1-b1aa-f774ff23d63e","https://www.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line"
],
"lookupStrategy": "FETCH_LIVE_DOC"
}

{ "urls": [ "https://www.dailymail.co.uk/sport/football/article-6729017/Is-VAR-working-change-Reporters-analyse-video-technology-football.html?ns_mchannel=rss&ns_campaign=1490&ito=1490", "https://www.talouselama.fi/uutiset/te/2223797c-6be5-3be1-b1aa-f774ff23d63e","https://www.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line" ], "lookupStrategy": "FETCH_LIVE_DOC" } 到:

https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet

使用POST,以服务密钥作为查询参数(?key = xxx)。

我们得到的回报是404。没有错误,没有JSON数据,只是普通的旧HTML格式的404。

1 个答案:

答案 0 :(得分:0)

该服务很好,您的查询应返回:

{
  "ampUrls": [
    {
      "originalUrl": "https://www.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line",
      "ampUrl": "https://amp.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line",
      "cdnAmpUrl": "https://amp-theguardian-com.cdn.ampproject.org/c/s/amp.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line"
    },
    {
      "originalUrl": "https://www.dailymail.co.uk/sport/football/article-6729017/Is-VAR-working-change-Reporters-analyse-video-technology-football.html?ns_mchannel=rss&ns_campaign=1490&ito=1490",
      "ampUrl": "https://www.dailymail.co.uk/sport/football/article-6729017/amp/Is-VAR-working-change-Reporters-analyse-video-technology-football.html",
      "cdnAmpUrl": "https://www-dailymail-co-uk.cdn.ampproject.org/c/s/www.dailymail.co.uk/sport/football/article-6729017/amp/Is-VAR-working-change-Reporters-analyse-video-technology-football.html"
    }
  ],
  "urlErrors": [
    {
      "errorCode": "NO_AMP_URL",
      "errorMessage": "No AMP URL for the request URL.",
      "originalUrl": "https://www.talouselama.fi/uutiset/te/2223797c-6be5-3be1-b1aa-f774ff23d63e"
    }
  ]
}