开发者

Getting Google results in Java? Need help!

Right now, I'm trying to get the results from Google in Java, by searching for a term. I'm using a desktop program, not an applet. That in itself isn't complicated. but then Google gave me a 403 error. Anyways, I added referrer and User Agent and then it worked.

Now, my problem is that I don't get the results page from Google. Instead, I get their script which gets the results page.

My code right now simply uses a GET request on "http://www.google.com/search?q=" + Dork; Then it outputs each line. Here is what I get when I run my program:

<.!doctype html><.head><.title>dork - Google Search<./title><.script>window.google={kEI:"9myaS-Date).getTime()}}};try{}catch(u){}window.google.jsrt_kill=1; align:center}#logo{display:block;overflow:hidden;position:relative;width:103px;height:37px; <./ script><./div>

Lots of stuff like that. I shortened it (A LOT) and put in dots to fit it here.

So my big 开发者_运维问答question is: How do I turn this whole mess into the nice results page I get when searching Google with a browser?

Any help would be seriously appreciated, and I really need the answer fast. Also, please keep in mind that I do NOT want to use Google's API for this.

Thanks in advance!


Jack is right, take a look at the Google AJAX APIs. If you want nicely formatted results, brush up on your html and css.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜