KichangKim / DanbooruDownloader

Danbooru image downloader.
MIT License
149 stars 25 forks source link

CloudflareClearanceException: Clearance failed after 10 attempt #14

Closed nemson-source closed 1 year ago

nemson-source commented 1 year ago

i did the cloudflaie update and it work for some time now i get this error and i cant get it to go


2023-02-17 11:32:35.6142|ERROR|DanbooruDownloader.Commands.DumpCommand|CloudflareSolverRe.Exceptions.CloudflareClearanceException: Clearance failed after 10 attempt(s).
   at CloudflareSolverRe.ClearanceHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
   at DanbooruDownloader.Utilities.DanbooruUtility.GetPosts(Int64 startId, String username, String apikey) in D:\DanbooruDownloader-master\DanbooruDownloader\Utilities\DanbooruUtility.cs:line 34
   at DanbooruDownloader.Commands.DumpCommand.<>c__DisplayClass1_1.<<Run>b__0>d.MoveNext() in D:\DanbooruDownloader-master\DanbooruDownloader\Commands\DumpCommand.cs:line 50
--- End of stack trace from previous location ---
   at DanbooruDownloader.Utilities.TaskUtility.RunWithRetry(Func`1 job, Func`2 retryCondition, Int32 retryCount, Int32 retryDelay) in D:\DanbooruDownloader-master\DanbooruDownloader\Utilities\TaskUtility.cs:line 16```
nemson-source commented 1 year ago

found the problem i had to change the useragent i changed mine to this


var handler = new ClearanceHandler(
            userAgent: "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36")
TeteuXD2 commented 1 year ago

in what file you wrote the "userAgent"? DanbooruUtility or DumpCommands?

TeteuXD2 commented 1 year ago

like this? printscreen: https://prnt.sc/JDZDPHJHIOsu

nemson-source commented 1 year ago

in what file you wrote the "userAgent"? DanbooruUtility or DumpCommands?

in both files

nemson-source commented 1 year ago

like this? https://prnt.sc/JDZDPHJHIOsu


var handler = new ClearanceHandler(
            userAgent: "your useragent")
            {
                MaxTries = 3,
                ClearanceDelay = 3000
            };
TeteuXD2 commented 1 year ago

Now this.... https://prnt.sc/F3RESVE_fQ6a

Line 36: https://prnt.sc/7kVFCHlaFowO

Line 50: https://prnt.sc/LqmngwDcHX_j

nemson-source commented 1 year ago

the user agent is blocket here are some user-agents https://deviceatlas.com/blog/list-of-user-agent-strings you can also try modifying it

Now this.... https://prnt.sc/F3RESVE_fQ6a

Line 36: https://prnt.sc/7kVFCHlaFowO

Line 50: https://prnt.sc/LqmngwDcHX_j

GuyegOOd commented 1 year ago

In case anyone still encounter the issue even after setting the custom UserAgent, just set it to your own username and it works for me.

src: https://danbooru.donmai.us/forum_topics/22838

nemson-source commented 1 year ago

this also works but only with the danbooru username