Fix - Hotfix calendar not loading

This commit is contained in:
Elwador 2024-07-08 12:49:10 +02:00
parent aee8a20450
commit 4e98b64527
2 changed files with 5 additions and 7 deletions

View File

@ -10,7 +10,6 @@ using System.Net.Http;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using System.Xml; using System.Xml;
using Avalonia.Media; using Avalonia.Media;
using CRD.Utils; using CRD.Utils;
@ -245,10 +244,8 @@ public class Crunchyroll{
var request = HttpClientReq.CreateRequestMessage($"{calendarLanguage[CrunOptions.SelectedCalendarLanguage ?? "de"]}?filter=premium&date={weeksMondayDate}", HttpMethod.Get, false, false, null); var request = HttpClientReq.CreateRequestMessage($"{calendarLanguage[CrunOptions.SelectedCalendarLanguage ?? "de"]}?filter=premium&date={weeksMondayDate}", HttpMethod.Get, false, false, null);
request.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"); request.Headers.Accept.ParseAdd("text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8");
request.Headers.AcceptEncoding.ParseAdd("gzip, deflate"); request.Headers.AcceptEncoding.ParseAdd("gzip, deflate, br");
request.Headers.AcceptLanguage.ParseAdd("en-US,en;q=0.9");
request.Headers.Referrer = new Uri("https://www.crunchyroll.com/");
var response = await HttpClientReq.Instance.SendHttpRequest(request); var response = await HttpClientReq.Instance.SendHttpRequest(request);

View File

@ -40,7 +40,7 @@ public class HttpClientReq{
handler = new HttpClientHandler(); handler = new HttpClientHandler();
handler.CookieContainer = new CookieContainer(); handler.CookieContainer = new CookieContainer();
handler.UseCookies = true; handler.UseCookies = true;
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate | DecompressionMethods.Brotli;
// Initialize the HttpClient with the handler // Initialize the HttpClient with the handler
client = new HttpClient(handler); client = new HttpClient(handler);
@ -77,7 +77,8 @@ public class HttpClientReq{
return (IsOk: true, ResponseContent: content); return (IsOk: true, ResponseContent: content);
} catch (Exception e){ } catch (Exception e){
Console.Error.WriteLine($"Error: {e} \n Response: {(content.Length < 500 ? content : "error to long")}"); // Console.Error.WriteLine($"Error: {e} \n Response: {(content.Length < 500 ? content : "error to long")}");
Console.Error.WriteLine($"Error: {e} \n Response: {content}");
return (IsOk: false, ResponseContent: content); return (IsOk: false, ResponseContent: content);
} }
} }