Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

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)

privatestaticstringCreateRequestUrl(stringtargetUrl){if(string.IsNullOrEmpty(_apiToken))thrownewException("API_TOKEN cannot be empty!");stringurl= $ "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}";}
staticvoidMain(string[]args){HttpClientHandlerhandler=newHttpClientHandler(){AutomaticDecompression=DecompressionMethods.GZip|DecompressionMethods.Deflate};varclient=newHttpClient(handler);stringrequestUrl=CreateRequestUrl("https://example.com");varresponse=client.GetAsync(requestUrl).Result;Console.WriteLine("Status Code : {0} ",response.StatusCode);Console.WriteLine("HTML : \n{0}",response.Content.ReadAsStringAsync().Result);}