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?
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.
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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With