Giter VIP home page Giter VIP logo

dotnet-example's Introduction

Scrape.do C# Example

scrape.do

Web Scraper API

You can send request to any webpages with proxy gateway & web api provided by scrape.do. As you can see from the example, this takes only few lines of code

You can see in example (Program.cs)

private static string CreateRequestUrl(string targetUrl) {
	if (string.IsNullOrEmpty(_apiToken)) throw new Exception("API_TOKEN cannot be empty!");

	string url = $ "http://api.scrape.do?token={_apiToken}";

	if (_jsRender) url += "&render=true";
	if (_superProxy) url += "&super=true";
	if (!string.IsNullOrEmpty(_geoCode)) url += $ "&geoCode={_geoCode}";
	if (!string.IsNullOrEmpty(_session)) url += $ "&session={_session}";

	return $ "{url}&url={targetUrl}";
}
static void Main(string[] args) {

	HttpClientHandler handler = new HttpClientHandler() {
		AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
	};

	var client = new HttpClient(handler);

	string requestUrl = CreateRequestUrl("https://example.com");
	var response = client.GetAsync(requestUrl).Result;

	Console.WriteLine("Status Code : {0} ", response.StatusCode);
	Console.WriteLine("HTML : \n{0}", response.Content.ReadAsStringAsync().Result);
}

dotnet-example's People

Contributors

mertbekci avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.