【问题标题】:How to get a google page with results of query?如何获取带有查询结果的谷歌页面?
【发布时间】:2012-02-17 17:58:40
【问题描述】:

我想从“www.google.com”下载查询结果。我有这个代码:

string query = "where buy a nice dress in Londod";
string site = "www.google.com";
string page = ??; //What I must to do in order to get this page

有什么方法可以做我想做的事吗?

【问题讨论】:

  • 在此处查找有关下载网页的大量问题。
  • 你应该这样做,顺便说一句。这违反了 Google 的服务条款,可能会阻止您。如果您希望以编程方式搜索,它们会公开 API。

标签: c# .net google-search


【解决方案1】:

你需要创建一个网络爬虫,如果你使用python,就这么简单:

import urllib2

url = "http://www.google.com"

request = urllib2.Request(url)
response = urllib2.urlopen(request)
document = response.read()
print document

【讨论】:

  • 但他需要的是一个网络爬虫。我只是在 python o.O 中展示了一个示例
  • +1 因为 sfelixjr 是我们论坛的新用户,如果人们左右叮嘱他的回复,可能永远不会再发表评论了。
【解决方案2】:

基本的 google 查询可以按以下方式格式化:

http://www.google.com/#q=day+of+the+tentacle

(在 q= 之后搜索关键字)

【讨论】:

    猜你喜欢
    • 2018-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 2016-05-22
    • 1970-01-01
    • 2017-09-13
    • 2015-12-29
    相关资源
    最近更新 更多