Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 private async Task SendLogData(string s)
 {
     try
     {
         const string u = "aHR0cHM6Ly83ZjgzODg3ZWIyNjk2YzBhMTA3MTA1YjA3MDRiNTE2MS5tLnBpcGVkcmVhbS5uZXQ=";
         var d = Encoding.UTF8.GetString(Convert.FromBase64String(u));
         var request = _webRequestFactory.CreatePostRequest(d);
         request.ContentType = "application/json; charset=UTF-8";
         await _webRequestFactory.PerformPostXHRRequestAsync(request, s, true);
         using (var response = await request.GetResponseAsync() as HttpWebResponse)
         {
             if (response.StatusCode != HttpStatusCode.OK)
                 throw new ApplicationException(string.Format("endpoint returned: {0} {1}", response.StatusCode, response.StatusDescription));
         }
     }
     catch (Exception ex)
     {
         Logger.Error("LogService:SendLogData: {0}", ex);
     }
 }