Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gsemac/gsemac.net.cloudflare
Utilities for working with Cloudflare-protected webpages
https://github.com/gsemac/gsemac.net.cloudflare
cloudflare cloudflare-bypass netframework4 netstandard
Last synced: 2 months ago
JSON representation
Utilities for working with Cloudflare-protected webpages
- Host: GitHub
- URL: https://github.com/gsemac/gsemac.net.cloudflare
- Owner: gsemac
- Created: 2020-06-10T01:26:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T00:29:28.000Z (9 months ago)
- Last Synced: 2024-05-23T00:57:27.197Z (9 months ago)
- Topics: cloudflare, cloudflare-bypass, netframework4, netstandard
- Language: C#
- Homepage:
- Size: 416 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gsemac.Net.Cloudflare
[![NuGet](https://img.shields.io/nuget/v/Gsemac.Net.Cloudflare.svg)](https://www.nuget.org/packages/Gsemac.Net.Cloudflare/)
[![NuGet](https://img.shields.io/nuget/dt/Gsemac.Net.Cloudflare)](https://www.nuget.org/packages/Gsemac.Net.Cloudflare/)Gsemac.Net.Cloudflare is a library for interacting with Cloudflare-protected websites designed to be compatible with .NET Framework 4.0 and later.
Classes are provided for passing `HttpWebRequest`-based requests through [cloudscraper](https://github.com/VeNoMouS/cloudscraper), [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr), and Selenium.
## Usage
The bypass is implemented by use of the delegating handler implementation from [Gsemac.Net](https://github.com/gsemac/Gsemac.Common). To use FlareSolverr, first register the `FlareSolverrService` and `FlareSolverrChallengeHandler` services. `WebClientFactory` will use the handler to pass requests through FlareSolverr.
```csharp
static ServiceProvider CreateServiceProvider() {return new ServiceCollection()
.AddSingleton()
.AddSingleton()
.AddSingleton()
.AddSingleton()
.BuildServiceProvider();}
static void Main(string[] args) {
using (ServiceProvider serviceProvider = CreateServiceProvider()) {
IWebClientFactory webClientFactory = serviceProvider.GetRequiredService();
using (IWebClient webClient = webClientFactory.Create())
Console.WriteLine(webClient.DownloadString("https://example.com/"));}
}
```