如何从YQL响应中获取字符串

时间:2017-01-17 11:48:27

标签: yql yahoo-api

我想使用单个HTTP调用来使用Yahoo!获取数据。 API。我这样用YQL打电话

select * from html where url='http://time.org/zones/GMT.php' and xpath='//p[@class="head"]'

我得到了这个回复

{
 "query": {
  "count": 1,
  "created": "2017-01-17T11:42:05Z",
  "lang": "en-US",
  "diagnostics": {
   "publiclyCallable": "true",
   "url": [
    {
     "execution-start-time": "1",
     "execution-stop-time": "193",
     "execution-time": "192",
     "content": "http://time.org/zones/GMT.php"
    },
    {
     "execution-start-time": "1",
     "execution-stop-time": "193",
     "execution-time": "192",
     "content": "http://time.org/zones/GMT.php"
    }
   ],
   "user-time": "194",
   "service-time": "383",
   "build-version": "2.0.84"
  },
  "results": {
   "p": {
    "class": "head",
    "content": "GMT - 11:29 AM (GMT)"
   }
  }
 }
}

所以我被困在这一步。我不知道如何得到“内容”:“GMT - 上午11:29(GMT)”。是否有其他API,所以我可以嵌入这个以获取文本。说实话,我正在做一个松散的命令,所以我只能使用一行URL。

0 个答案:

没有答案
相关问题