Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Google not allow webclients?

Tags:

c#

.net

I have the following:

string html_string = "http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=pharma";
string html;
html = new WebClient().DownloadString(html_string);

and when I get the length of HTML, it's returning only the first 28435 characters.

Is it possible that Google is not allowing webclient access?

like image 741
Alex Gordon Avatar asked Jan 23 '23 06:01

Alex Gordon


2 Answers

No, see the TOS

5.3 You agree not to access (or attempt to access) any of the Services by any means other than through the interface that is provided by Google, unless you have been specifically allowed to do so in a separate agreement with Google. You specifically agree not to access (or attempt to access) any of the Services through any automated means (including use of scripts or web crawlers) and shall ensure that you comply with the instructions set out in any robots.txt file present on the Services.

like image 112
fuxia Avatar answered Jan 24 '23 18:01

fuxia


I've tried this snippet and it returned exactly the same HTML as returned by a browser. The only correction I would make is to dispose disposable objects:

string html_string = "http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=pharma";
using (var client = new WebClient())
{
    string html = client.DownloadString(html_string);
}
like image 44
Darin Dimitrov Avatar answered Jan 24 '23 19:01

Darin Dimitrov