private async Task PerformPrivacyConsentRequestAsync() { if (CheckIfLoggedInAsync()) { return; } await UpdateTumblrKey(); const string referer = @"https://www.tumblr.com/privacy/consent?redirect="; var headers = new Dictionary <string, string> { { "X-tumblr-form-key", tumblrKey } }; HttpWebRequest request = webRequestFactory.CreatePostXhrRequest("https://www.tumblr.com/svc/privacy/consent", referer, headers); const string requestBody = "{\"eu_resident\":true,\"gdpr_is_acceptable_age\":true,\"gdpr_consent_core\":true,\"gdpr_consent_first_party_ads\":true,\"gdpr_consent_third_party_ads\":true,\"gdpr_consent_search_history\":true,\"redirect_to\":\"\"}"; request.ContentType = "application/json"; await webRequestFactory.PerformPostXHRRequestAsync(request, requestBody, false); using (var response = await request.GetResponseAsync() as HttpWebResponse) { cookieService.SetUriCookie(response.Cookies); } }
private async Task Register(string login, string password) { const string url = "https://www.tumblr.com/svc/account/register"; const string referer = "https://www.tumblr.com/login"; var headers = new Dictionary <string, string>(); var request = webRequestFactory.CreatePostXhrRequest(url, referer, headers); cookieService.GetUriCookie(request.CookieContainer, new Uri("https://www.tumblr.com/")); var parameters = new Dictionary <string, string> { { "determine_email", login }, { "user[email]", string.Empty }, { "user[password]", string.Empty }, { "tumblelog[name]", string.Empty }, { "user[age]", string.Empty }, { "context", "no_referer" }, { "version", "STANDARD" }, { "follow", string.Empty }, { "form_key", tumblrKey }, { "seen_suggestion", "0" }, { "used_suggestion", "0" }, { "used_auto_suggestion", "0" }, { "about_tumblr_slide", string.Empty }, { "tracking_url", "/login" }, { "tracking_version", "modal" }, { "random_username_suggestions", "[\"KawaiiBouquetStranger\",\"KeenTravelerFury\",\"RainyMakerTastemaker\",\"SuperbEnthusiastCollective\",\"TeenageYouthFestival\"]" }, { "action", "signup_determine" }, }; await webRequestFactory.PerformPostRequestAsync(request, parameters).ConfigureAwait(false); using (var response = await request.GetResponseAsync().TimeoutAfter(shellService.Settings.TimeOut).ConfigureAwait(false) as HttpWebResponse) { cookieService.SetUriCookie(response.Cookies); } }