谷歌搜索(批处理)问题 [英] Google search (batch) problem

查看:73
本文介绍了谷歌搜索(批处理)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我需要您的帮助。



我在C#.NET 4.0中创建了一个WinForms应用程序,以批量格式进行Google搜索。可能有数千个的请求。 (感谢BackgroundWorker,同时30-50。)



问题是,Google会在 X 请求后设置验证码请求,但这不能在我的程序中处理。



有没有办法避免这种情况(可能从外部服务器执行此程序)或者你有另一种方法来处理这种情况?



感谢您的帮助。



我的尝试:



我生成一个搜索字符串并通过HttpRequest发送它并生成此请求的HttpResponse对象,并将结果写入html文件以供进一步处理。这是我的代码:



Hello, I need your help.

I've created a WinForms application in C# .NET 4.0 to make a Google search in batch format. There could be many thousands of requests. (30-50 at the same time thanks to BackgroundWorker.)

The Problem is, Google will set an captcha request after X requests, but this cannot handled in my program.

Is there a way to avoid this (maybe execute this program from an external Server) or do you have another method for this situation?

Thank you for helping.

What I have tried:

I generete a search string and send it via HttpRequest and generate a HttpResponse object of this request and write the result into a html-file for further processing. here is my code for doing so:

string s = createSearchstring(); 
string URL = "http://www.google.de/search?q=" + s + "&ie=utf-8&oe=utf-8";

try
{
   // creates request
   HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL);

   // creates response of my request
   HttpWebResponse response = (HttpWebResponse)request.GetResponse();

   StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8);

   // read html script
   string html = sr.ReadToEnd();

   // Close Streamreader und Response
   sr.Close();
   response.Close();

   //save my html result in a file
   string saveTarget= "batchSearch\\search_" + s + ".html";
   StreamWriter sw = new StreamWriter(saveTarget, false, Encoding.UTF8);
   sw.Write(html);

   // Nächste Excel-Zeile
   sw.Close();

}
catch (WebException ex)
{
   Log("We have got an exception: (search: " + s + ")\n" + ex.Message.ToString());
}

推荐答案

除了获得Google的许可外,没有解决方案:

There is no solution besides getting permission from Google:

Google的条款未经Google事先明确许可,不得向我们的系统发送任何类型的自动查询。发送自动查询会消耗资源,并包括使用任何软件(例如WebPosition Gold)向Google发送自动查询,以确定网站或网页在Google搜索结果中如何排列各种查询。除了排名检查之外,未经许可对Google进行其他类型的自动访问也违反了我们的网站站长指南和服务条款。

Google's Terms of Service do not allow the sending of automated queries of any sort to our system without express permission in advance from Google. Sending automated queries consumes resources and includes using any software (such as WebPosition Gold) to send automated queries to Google to determine how a website or webpage ranks in Google search results for various queries. In addition to rank checking, other types of automated access to Google without permission are also a violation of our Webmaster Guidelines and Terms of Service.


这篇关于谷歌搜索(批处理)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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