【问题标题】:YQL request not working when using URL使用 URL 时 YQL 请求不起作用
【发布时间】:2012-04-12 14:23:34
【问题描述】:

谁能告诉我这个 YQL 请求有什么问题:

http://query.yahooapis.com/v1/public/yql?&format=json&q=select%20*%20from%20html%20where%20url=%22http%3A%2F%2Fsearch-movies-jc4u2tqsvf5jgd7xxmceezlu24.us-east- 1.cloudsearch.amazonaws.com%2F2011-02-01%2Fsearch%3Ffacet%3Dgenre%26return-fields%3Dactor%2Cdirector%2Ctitle%2Cyear%2Ctext_relevance%26q%3DLove%26bq%3D%28and%20%28field%20genre% 20'浪漫'%29%29%22%20and%20xpath=%22*%22

当我提交它直接抱怨的 URL 时,它工作正常。我相信我正在适当地转义所有保留字符:(

提前致谢!

【问题讨论】:

    标签: yql yahoo-api


    【解决方案1】:

    在发出 YQL 请求之前,您需要对 bq 参数中的空格进行 url 编码。 YQL 选择语句将是:

    select * from html where url="http://search-movies-jc4u2tqsvf5jgd7xxmceezlu24.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?facet=genre&return-fields=actor,director,title,year,text_relevance&q=Love&bq=(and%20(field%20genre%20'Romance'))" and xpath="*"
    

    注意 bq URL 参数中的空白编码。 YQL 请求将是:

    http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fsearch-movies-jc4u2tqsvf5jgd7xxmceezlu24.us-east-1.cloudsearch.amazonaws.com%2F2011-02-01%2Fsearch%3Ffacet%3Dgenre%26return-fields%3Dactor%2Cdirector%2Ctitle%2Cyear%2Ctext_relevance%26q%3DLove%26bq%3D(and%2520(field%2520genre%2520'Romance'))%22%20and%20xpath%3D%22*%22&diagnostics=true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多