Python 如何避免在执行Google SERP解析时成为黑帽子

Python 如何避免在执行Google SERP解析时成为黑帽子,python,parsing,Python,Parsing,所以我在最后一个问题上被评了三次,我希望我不会在这个问题上。我正在尝试编写一个解析器来解析Google的页面,如下所示:urllib2.urlopen(“http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=“+infoget) 允许这样做吗?我似乎找不到谷歌的规则。每天/小时允许多少请求?我赚了大约40英镑,然后我就被拒绝了 这是黑色的帽子吗?我真的,绝对不是想成为这里的黑帽子——我只是想写一些可以接受的好代码。 我们有一个Py

所以我在最后一个问题上被评了三次,我希望我不会在这个问题上。我正在尝试编写一个解析器来解析Google的页面,如下所示:
urllib2.urlopen(“http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=“+infoget)

允许这样做吗?我似乎找不到谷歌的规则。每天/小时允许多少请求?我赚了大约40英镑,然后我就被拒绝了

这是黑色的帽子吗?我真的,绝对不是想成为这里的黑帽子——我只是想写一些可以接受的好代码。


我们有一个Python库来获取和解析谷歌搜索结果,可在此处访问:

现在它只支持SerpApi.com后端,但可以随意扩展它以支持更多后端

更全面的选择:

query_params = {
  "q": "query",
  "google_domain": "Google Domain",
  "location": "Location Requested",
  "device": device,
  "hl": "Google UI Language",
  "gl": "Google Country",
  "safe": "Safe Search Flag",
  "num": "Number of Results",
  "start": "Pagination Offset",
  "serp_api_key": "Your SERP API Key"
}

query = GoogleSearchResults(query_params)
query.params_dict["location"] = "Portland"

html_results = query.get_html()
dictionary_results = query.get_dictionary()
dictionary_results_with_images = query.get_dictionary_with_images()
json_results = query.get_json()
json_results_with_images = query.get_json_with_images()

谷歌不喜欢人们反复使用它的网络搜索api。如果你不打算点击广告(而且你可能正在窃取谷歌的搜索结果),他们就不会支持你的请求。web搜索api是用来从其他网站进行单一的、用户定义的搜索的。这是我的想法,但我在40次请求后被拒绝了。“我只想提出74个请求,不要再多了。明天再试一次,在每个请求之间留出一个睡眠时间(超过2秒……如果时间不重要的话,把它设置为20秒)@AndrewAlexander,伙计,你可以用scrapy和代理列表谢谢你,尽管我在很多年前就离开了公司,我一直在这么做
from lib.google_search_results import GoogleSearchResults
query = GoogleSearchResults({"q": "coffee"})
html_results = query.get_html()
query_params = {
  "q": "query",
  "google_domain": "Google Domain",
  "location": "Location Requested",
  "device": device,
  "hl": "Google UI Language",
  "gl": "Google Country",
  "safe": "Safe Search Flag",
  "num": "Number of Results",
  "start": "Pagination Offset",
  "serp_api_key": "Your SERP API Key"
}

query = GoogleSearchResults(query_params)
query.params_dict["location"] = "Portland"

html_results = query.get_html()
dictionary_results = query.get_dictionary()
dictionary_results_with_images = query.get_dictionary_with_images()
json_results = query.get_json()
json_results_with_images = query.get_json_with_images()