diff --git a/ImagePoster4DTF/DtfClient.cs b/ImagePoster4DTF/DtfClient.cs index b8e92a7..48b3168 100644 --- a/ImagePoster4DTF/DtfClient.cs +++ b/ImagePoster4DTF/DtfClient.cs @@ -37,7 +37,7 @@ public DtfClient() { .WithHeader("sec-fetch-dest", "empty") .WithHeader("sec-fetch-mode", "cors") .WithHeader("sec-fetch-site", "same-origin") - .WithHeader("x-js-version", "599ad322") + .WithHeader("x-js-version", "11c8b9ea") .WithHeader("x-this-is-csrf", "THIS IS SPARTA!") .WithCookie(new Cookie("pushVisitsCount", "1", "/", ".dtf.ru")) .WithCookie(new Cookie("adblock-state", "1", "/", ".dtf.ru")) diff --git a/ImagePoster4DTF/MainWindow.xaml.cs b/ImagePoster4DTF/MainWindow.xaml.cs index 483bb02..6b32420 100644 --- a/ImagePoster4DTF/MainWindow.xaml.cs +++ b/ImagePoster4DTF/MainWindow.xaml.cs @@ -455,6 +455,19 @@ private async void FireButton_OnClick(object sender, RoutedEventArgs ev) { Log.Debug("...done."); await Task.Delay(334); // 3 requests per second } + catch (FlurlHttpException e) { + Log.Error(e, "...failed, checking for 429:"); + if (e.Call?.Response?.Content == null) continue; + var body = await e.Call.Response.Content.ReadAsStringAsync(); + + if (body.Contains("Ошибка 429")) { + Log.Information("Ratelimited, sleeping 15 secs!"); + await Task.Delay(15000); + i = 0; // Does not count as error + + for (var j = 0; j < 10; j++) await DtfClient.HitRandomPost(); + } + } catch (Exception e) { Log.Error(e, "...failed:"); }