如何在Google搜索中获取结果网址? [英] How could i get the result urls in a google search?

查看:117
本文介绍了如何在Google搜索中获取结果网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我以HTML格式的字符串形式获取了搜索结果页面.关键字是"google Earth",因此URL可能是这样的:
http://www.google.com/search?hl=zh_CN&newwindow=1&q=google+earth&aq=f&aqi=&aql=&oq=&gs_rfai=
在第一个搜索结果页面中,有十个结果,我要获取有关十个结果的信息,那么我该怎么办.
一句话,我有一个URL(搜索结果),如何获得结果(URL,标题,描述)?

Assume that i got the search result page as string in HTML format. The key word is "google earth", so the URL may be like this:
http://www.google.com/search?hl=en&newwindow=1&q=google+earth&aq=f&aqi=&aql=&oq=&gs_rfai=
In the first search result page, there are ten results, i want to get the information about the ten results, what should i do then.
In a word, i have an URL(the result of search) and how could i get the results(URL, title, description)?

推荐答案

您只是在寻找模式并根据预定义的规则解析(或更提取)链接.这是一个指向php示例的链接,您可以将其简单地转换为c/cpp.

http://www.roscripts.com/snippets/show/141 [
You simply look for the pattern and parse (or more extract) the links based on the predefined rules. Here a link to a php example that you could simply translate to c/cpp.

http://www.roscripts.com/snippets/show/141[^]

Good luck!


谢谢您的答复,我不使用PHP,但是您的链接给了我很好的提示,我决定解析我需要的信息,再次感谢. :-D
Thank you for your reply, i don''t do PHP, but your link give me a good tip, i decide to parse the informations i need myself, thank you again. :-D


这篇关于如何在Google搜索中获取结果网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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