Exemplo n.º 1
0
        public async Task ConfirmPrivacyConsent()
        {
            if (CheckIfLoggedInAsync())
            {
                return;
            }
            await UpdateTumblrKey();

            var referer = @"https://www.tumblr.com/privacy/consent?redirect=";
            var headers = new Dictionary <string, string> {
                { "X-tumblr-form-key", tumblrKey }
            };
            HttpWebRequest request =
                webRequestFactory.CreatePostXhrReqeust("https://www.tumblr.com/svc/privacy/consent", referer, headers);
            var 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.PerformPostXHRReqeust(request, requestBody);

            using (var response = await request.GetResponseAsync() as HttpWebResponse)
            {
                cookieService.SetUriCookie(response.Cookies);
            }
        }