0

谁能告诉我这个 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 时,它工作正常。我相信我正在适当地转义所有保留字符:(

提前致谢!

4

1 回答 1

2

在发出 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
于 2012-04-12T21:02:30.533 回答