问题
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