Google Custom Search “Popular Queries” BAD REQUEST ERROR

会有一股神秘感。 提交于 2020-01-04 05:24:15

问题


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

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

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>

回答1:


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?…

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

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.



来源:https://stackoverflow.com/questions/16453212/google-custom-search-popular-queries-bad-request-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!