Skip to content
This repository was archived by the owner on Mar 27, 2020. It is now read-only.

Exception on accessing page exsite.pl #55

Open
grzegorz-wolszczak opened this issue Mar 25, 2020 · 0 comments
Open

Exception on accessing page exsite.pl #55

grzegorz-wolszczak opened this issue Mar 25, 2020 · 0 comments

Comments

@grzegorz-wolszczak
Copy link

Hi , when trying to access site exsite24.pl protected by cloud flare
code:

using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using CloudFlareUtilities;

namespace Main
{
    class Program
    {

        static async Task Main(string[] args)
        {

            //CookieContainer cookieJar = new CookieContainer();

            var urlExsiteBase = "exsite24.pl";
            var urlWithScheme = $"https://{urlExsiteBase}";

            try
            {
                // Create the clearance handler.
                var handler = new ClearanceHandler
                {
                    MaxRetries = 2 // Optionally specify the number of retries, if clearance fails (default is 3).
                };

                // Create a HttpClient that uses the handler to bypass CloudFlare's JavaScript challange.
                var client = new HttpClient(handler);

                // Use the HttpClient as usual. Any JS challenge will be solved automatically for you.
                var content = await client.GetStringAsync(urlWithScheme);
            }
            catch (AggregateException ex) when (ex.InnerException is CloudFlareClearanceException)
            {
                // After all retries, clearance still failed.
            }
            catch (AggregateException ex) when (ex.InnerException is TaskCanceledException)
            {
                // Looks like we ran into a timeout. Too many clearance attempts?
                // Maybe you should increase client.Timeout as each attempt will take about five seconds.
            }
        }
    }
}

I got

Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Unknown operator: ')
   at CloudFlareUtilities.ChallengeSolver.ApplyDecodingStep(Double number, Tuple`2 step)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at CloudFlareUtilities.ChallengeSolver.ResolveStepGroup(IEnumerable`1 group)
   at System.Linq.Enumerable.SelectListIterator`2.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at CloudFlareUtilities.ChallengeSolver.DecodeSecretNumber(String challengePageContent, String targetHost)
   at CloudFlareUtilities.ChallengeSolver.Solve(String challengePageContent, String targetHost)
   at CloudFlareUtilities.ClearanceHandler.PassClearance(HttpResponseMessage response, CancellationToken cancellationToken)
   at CloudFlareUtilities.ClearanceHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
   at Main.Program.Main(String[] args) in Z:\Repos.and.Projects\ExciteCrawler\WebSiteCrawler\Main\Program.cs:line 60
   at Main.Program.<Main>(String[] args)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant