Google自定义搜索“热门查询"错误请求错误 [英] Google Custom Search "Popular Queries" BAD REQUEST ERROR

查看:46
本文介绍了Google自定义搜索“热门查询"错误请求错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google CSE中,当我尝试获取Popular Queries时,我在FireBug Console中收到此错误:

In Google CSE, when I attempt to get Popular Queries, I'm getting this error in the FireBug Console:

NetworkError:400错误请求-

NetworkError: 400 Bad Request - http://www.google.com/cse/api/xxxxxxxxx:xxxxxxx/cse/xxxxxxx/queries/js?callback=(new+PopularQueryRenderer(document.getElementById(%27queries%27))).render .... .. ..

为什么会这样?我只是简单地从Google复制/粘贴代码:

Why is it happening? I just simply copy/paste the code from Google:

<html>
<head>
</head>
<body>
    <!-- CODE COPIED FROM GOOGLE : START -->
    <div id="queries"></div>
    <script src="http://www.google.com/cse/query_renderer.js"></script>
    <script src="http://www.google.com/cse/api/XXXX184908680XXXX:xxxxywrndxx/cse/xxxtywrnxxx/queries/js?callback=(new+PopularQueryRenderer(document.getElementById('queries'))).render"></script>
    <!-- CODE COPIED FROM GOOGLE : END -->
</bodY>
</html>

推荐答案

我至少(至少对我)知道了这一点. Google给您的代码是错误的.他们给您URL:

I just figured this out, at least for me. The code Google gives you is wrong. They give you the URL:

http://www.google.com/cse/api/USERID:CSEID/cse/CSEID/queries/js?…

这会将CSEID放入两次.我可以通过删除冒号的第一个实例和CSEID使其工作:

This puts the CSEID in twice. I was able to get it working by removing the first instance of the colon and the CSEID:

http://www.google.com/cse/api/USERID/cse/CSEID/queries/js

我不感到困惑,他们感到困惑:他们使用术语用户ID来引用用户字符串,但是使用术语CSE Id来引用冒号之后的部分以及组合的用户ID +冒号+ CSE ID.

I'm not surprised they got confused: they use the term User Id to refer to the User string, but they use the term CSE Id to refer to both the portion after the colon and the combined User Id + colon + CSE Id.

这篇关于Google自定义搜索“热门查询"错误请求错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆