Add - Added stream endpoint selection to settings
Chg - Removed non drm stream requests (RIP)
This commit is contained in:
parent
272d59a03b
commit
0cd056c8e4
|
@ -33,7 +33,6 @@ namespace CRD.Downloader;
|
||||||
public class Crunchyroll{
|
public class Crunchyroll{
|
||||||
public CrToken? Token;
|
public CrToken? Token;
|
||||||
public CrCmsToken? CmsToken;
|
public CrCmsToken? CmsToken;
|
||||||
private readonly string _api = "web"; //web | android
|
|
||||||
|
|
||||||
public CrProfile Profile = new();
|
public CrProfile Profile = new();
|
||||||
public CrDownloadOptions CrunOptions;
|
public CrDownloadOptions CrunOptions;
|
||||||
|
@ -151,7 +150,7 @@ public class Crunchyroll{
|
||||||
CrunOptions.Theme = "System";
|
CrunOptions.Theme = "System";
|
||||||
CrunOptions.SelectedCalendarLanguage = "de";
|
CrunOptions.SelectedCalendarLanguage = "de";
|
||||||
CrunOptions.DlVideoOnce = true;
|
CrunOptions.DlVideoOnce = true;
|
||||||
CrunOptions.UseNonDrmStreams = true;
|
CrunOptions.StreamEndpoint = "web/firefox";
|
||||||
|
|
||||||
CrunOptions.History = true;
|
CrunOptions.History = true;
|
||||||
|
|
||||||
|
@ -551,15 +550,16 @@ public class Crunchyroll{
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!options.UseNonDrmStreams && !_widevine.canDecrypt){
|
if (!_widevine.canDecrypt){
|
||||||
// Console.Error.WriteLine("Only searching for drm streams but widevine can't decrypt");
|
Console.Error.WriteLine("L3 key files missing");
|
||||||
// MainWindow.Instance.ShowError("Settings set to not search for DRM streams - but can't find CDM files in widevine folder ");
|
MainWindow.Instance.ShowError("Can't find CDM files in widevine folder ");
|
||||||
// return new DownloadResponse{
|
return new DownloadResponse{
|
||||||
// Data = new List<DownloadedMedia>(),
|
Data = new List<DownloadedMedia>(),
|
||||||
// Error = true,
|
Error = true,
|
||||||
// FileName = "./unknown"
|
FileName = "./unknown",
|
||||||
// };
|
ErrorText = "Missing L3 Key"
|
||||||
// }
|
};
|
||||||
|
}
|
||||||
|
|
||||||
string mediaName = $"{data.SeasonTitle} - {data.EpisodeNumber} - {data.EpisodeTitle}";
|
string mediaName = $"{data.SeasonTitle} - {data.EpisodeNumber} - {data.EpisodeTitle}";
|
||||||
string fileName = "";
|
string fileName = "";
|
||||||
|
@ -673,16 +673,6 @@ public class Crunchyroll{
|
||||||
|
|
||||||
var pbData = fetchPlaybackData.pbData;
|
var pbData = fetchPlaybackData.pbData;
|
||||||
|
|
||||||
|
|
||||||
#region NonDrmRequest
|
|
||||||
|
|
||||||
if (options.UseNonDrmStreams || !_widevine.canDecrypt){
|
|
||||||
await FetchNoDrmPlaybackData(mediaGuid, pbData);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
List<string> hsLangs = new List<string>();
|
List<string> hsLangs = new List<string>();
|
||||||
var pbStreams = pbData.Data?[0];
|
var pbStreams = pbData.Data?[0];
|
||||||
var streams = new List<StreamDetailsPop>();
|
var streams = new List<StreamDetailsPop>();
|
||||||
|
@ -809,7 +799,7 @@ public class Crunchyroll{
|
||||||
dlFailed = true;
|
dlFailed = true;
|
||||||
return new DownloadResponse{
|
return new DownloadResponse{
|
||||||
Data = new List<DownloadedMedia>(),
|
Data = new List<DownloadedMedia>(),
|
||||||
Error = true,
|
Error = dlFailed,
|
||||||
FileName = "./unknown",
|
FileName = "./unknown",
|
||||||
ErrorText = "Playlist fetch problem"
|
ErrorText = "Playlist fetch problem"
|
||||||
};
|
};
|
||||||
|
@ -1500,31 +1490,39 @@ public class Crunchyroll{
|
||||||
return (audioDownloadResult.Ok, audioDownloadResult.Parts, tsFile);
|
return (audioDownloadResult.Ok, audioDownloadResult.Parts, tsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task FetchNoDrmPlaybackData(string currentMediaId, PlaybackData pbData){
|
private async Task<(bool IsOk, PlaybackData pbData, string error)> FetchPlaybackData(string mediaId, string mediaGuidId, CrunchyEpMetaData epMeta){
|
||||||
var playbackRequestNonDrm = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{currentMediaId}/console/switch/play", HttpMethod.Get, true, true, null);
|
PlaybackData temppbData = new PlaybackData{ Total = 0, Data = new List<Dictionary<string, Dictionary<string, StreamDetails>>>() };
|
||||||
playbackRequestNonDrm.Headers.UserAgent.ParseAdd("Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27");
|
bool ok = true;
|
||||||
|
|
||||||
var playbackRequestNonDrmResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequestNonDrm);
|
HttpRequestMessage playbackRequest;
|
||||||
|
(bool IsOk, string ResponseContent) playbackRequestResponse;
|
||||||
|
|
||||||
if (!playbackRequestNonDrmResponse.IsOk && playbackRequestNonDrmResponse.ResponseContent != string.Empty){
|
|
||||||
var s = playbackRequestNonDrmResponse.ResponseContent;
|
playbackRequest = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{mediaGuidId}/{CrunOptions.StreamEndpoint}/play", HttpMethod.Get, true, false, null);
|
||||||
|
|
||||||
|
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
||||||
|
|
||||||
|
if (!playbackRequestResponse.IsOk && playbackRequestResponse.ResponseContent != string.Empty){
|
||||||
|
var s = playbackRequestResponse.ResponseContent;
|
||||||
var error = StreamError.FromJson(s);
|
var error = StreamError.FromJson(s);
|
||||||
if (error != null && error.IsTooManyActiveStreamsError()){
|
if (error != null && error.IsTooManyActiveStreamsError()){
|
||||||
foreach (var errorActiveStream in error.ActiveStreams){
|
foreach (var errorActiveStream in error.ActiveStreams){
|
||||||
await HttpClientReq.DeAuthVideo(errorActiveStream.ContentId, errorActiveStream.Token);
|
await HttpClientReq.DeAuthVideo(errorActiveStream.ContentId, errorActiveStream.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
playbackRequestNonDrm = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{currentMediaId}/console/switch/play", HttpMethod.Get, true, true, null);
|
playbackRequest = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{mediaGuidId}/{CrunOptions.StreamEndpoint}/play", HttpMethod.Get, true, false, null);
|
||||||
playbackRequestNonDrm.Headers.UserAgent.ParseAdd("Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27");
|
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
||||||
playbackRequestNonDrmResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequestNonDrm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playbackRequestNonDrmResponse.IsOk && playbackRequestNonDrmResponse.ResponseContent != string.Empty){
|
if (playbackRequestResponse.IsOk){
|
||||||
CrunchyStreamData? playStream = JsonConvert.DeserializeObject<CrunchyStreamData>(playbackRequestNonDrmResponse.ResponseContent, SettingsJsonSerializerSettings);
|
temppbData = new PlaybackData{ Total = 0, Data = new List<Dictionary<string, Dictionary<string, StreamDetails>>>() };
|
||||||
|
temppbData.Data.Add(new Dictionary<string, Dictionary<string, StreamDetails>>());
|
||||||
|
|
||||||
|
CrunchyStreamData? playStream = JsonConvert.DeserializeObject<CrunchyStreamData>(playbackRequestResponse.ResponseContent, SettingsJsonSerializerSettings);
|
||||||
CrunchyStreams derivedPlayCrunchyStreams = new CrunchyStreams();
|
CrunchyStreams derivedPlayCrunchyStreams = new CrunchyStreams();
|
||||||
if (playStream != null){
|
if (playStream != null){
|
||||||
if (playStream.Token != null) await HttpClientReq.DeAuthVideo(currentMediaId, playStream.Token);
|
if (playStream.Token != null) await HttpClientReq.DeAuthVideo(mediaGuidId, playStream.Token);
|
||||||
|
|
||||||
if (playStream.HardSubs != null)
|
if (playStream.HardSubs != null)
|
||||||
foreach (var hardsub in playStream.HardSubs){
|
foreach (var hardsub in playStream.HardSubs){
|
||||||
|
@ -1540,69 +1538,22 @@ public class Crunchyroll{
|
||||||
HardsubLocale = Locale.DefaulT
|
HardsubLocale = Locale.DefaulT
|
||||||
};
|
};
|
||||||
|
|
||||||
if (pbData.Data != null) pbData.Data[0]["adaptive_switch_dash"] = derivedPlayCrunchyStreams;
|
if (temppbData.Data != null){
|
||||||
}
|
temppbData.Data[0]["drm_adaptive_dash"] = derivedPlayCrunchyStreams;
|
||||||
} else{
|
temppbData.Total = 1;
|
||||||
Console.WriteLine("Non-DRM Request Stream URLs FAILED!");
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<(bool IsOk, PlaybackData pbData, string error)> FetchPlaybackData(string mediaId, string mediaGuidId, CrunchyEpMetaData epMeta){
|
temppbData.Meta = new PlaybackMeta(){ AudioLocale = playStream.AudioLocale, Versions = playStream.Versions, Bifs = new List<string>{ playStream.Bifs }, MediaId = mediaId };
|
||||||
PlaybackData temppbData = new PlaybackData{ Total = 0, Data = new List<Dictionary<string, Dictionary<string, StreamDetails>>>() };
|
temppbData.Meta.Subtitles = new Subtitles();
|
||||||
bool ok = true;
|
foreach (var playStreamSubtitle in playStream.Subtitles){
|
||||||
|
Subtitle sub = playStreamSubtitle.Value;
|
||||||
HttpRequestMessage playbackRequest;
|
temppbData.Meta.Subtitles.Add(playStreamSubtitle.Key, new SubtitleInfo(){ Format = sub.Format, Locale = sub.Locale, Url = sub.Url });
|
||||||
(bool IsOk, string ResponseContent) playbackRequestResponse;
|
|
||||||
|
|
||||||
if (_api == "android"){
|
|
||||||
NameValueCollection query = HttpUtility.ParseQueryString(new UriBuilder().Query);
|
|
||||||
|
|
||||||
query["force_locale"] = "";
|
|
||||||
query["preferred_audio_language"] = "ja-JP";
|
|
||||||
query["Policy"] = CmsToken?.Cms.Policy;
|
|
||||||
query["Signature"] = CmsToken?.Cms.Signature;
|
|
||||||
query["Key-Pair-Id"] = CmsToken?.Cms.KeyPairId;
|
|
||||||
|
|
||||||
|
|
||||||
playbackRequest = HttpClientReq.CreateRequestMessage($"{Api.BetaCms}{CmsToken?.Cms.Bucket}/videos/{mediaId}/streams?", HttpMethod.Get, true, true, query);
|
|
||||||
|
|
||||||
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
|
||||||
|
|
||||||
if (playbackRequestResponse.IsOk){
|
|
||||||
var androidTempData = Helpers.Deserialize<PlaybackDataAndroid>(playbackRequestResponse.ResponseContent, SettingsJsonSerializerSettings);
|
|
||||||
temppbData = new PlaybackData(){
|
|
||||||
Data = androidTempData.streams, Total = androidTempData.streams.Count,
|
|
||||||
Meta = new PlaybackMeta(){
|
|
||||||
MediaId = androidTempData.media_id, Subtitles = androidTempData.subtitles, Bifs = androidTempData.bifs, Versions = androidTempData.versions, AudioLocale = androidTempData.audio_locale,
|
|
||||||
ClosedCaptions = androidTempData.closed_captions, Captions = androidTempData.captions
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else{
|
|
||||||
NameValueCollection query2 = HttpUtility.ParseQueryString(new UriBuilder().Query);
|
|
||||||
|
|
||||||
query2["preferred_audio_language"] = "ja-JP";
|
|
||||||
query2["Policy"] = CmsToken?.Cms.Policy;
|
|
||||||
query2["Signature"] = CmsToken?.Cms.Signature;
|
|
||||||
query2["Key-Pair-Id"] = CmsToken?.Cms.KeyPairId;
|
|
||||||
|
|
||||||
playbackRequest = HttpClientReq.CreateRequestMessage($"{Api.ApiBeta}{epMeta.Playback}?", HttpMethod.Get, true, true, query2);
|
|
||||||
|
|
||||||
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
|
||||||
|
|
||||||
if (playbackRequestResponse.IsOk){
|
|
||||||
temppbData = Helpers.Deserialize<PlaybackData>(playbackRequestResponse.ResponseContent, SettingsJsonSerializerSettings) ??
|
|
||||||
new PlaybackData{ Total = 0, Data = new List<Dictionary<string, Dictionary<string, StreamDetails>>>() };
|
|
||||||
} else{
|
|
||||||
Console.WriteLine("'Fallback Request Stream URLs FAILED!'");
|
|
||||||
ok = playbackRequestResponse.IsOk;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
// var playbackRequest22 = HttpClientReq.CreateRequestMessage($"{Api.Cms}/videos/{mediaId}/streams", HttpMethod.Get, true, false, null);
|
Console.WriteLine("Request Stream URLs FAILED! Attempting fallback");
|
||||||
//
|
|
||||||
// var playbackRequestResponse22 = await HttpClientReq.Instance.SendHttpRequest(playbackRequest22);
|
|
||||||
|
|
||||||
playbackRequest = HttpClientReq.CreateRequestMessage($"{Api.Cms}/videos/{mediaId}/streams", HttpMethod.Get, true, false, null);
|
playbackRequest = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{mediaGuidId}/web/firefox/play", HttpMethod.Get, true, false, null);
|
||||||
|
|
||||||
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
||||||
|
|
||||||
|
@ -1614,73 +1565,53 @@ public class Crunchyroll{
|
||||||
await HttpClientReq.DeAuthVideo(errorActiveStream.ContentId, errorActiveStream.Token);
|
await HttpClientReq.DeAuthVideo(errorActiveStream.ContentId, errorActiveStream.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
playbackRequest = HttpClientReq.CreateRequestMessage($"{Api.Cms}/videos/{mediaId}/streams", HttpMethod.Get, true, false, null);
|
playbackRequest = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{mediaGuidId}/web/firefox/play", HttpMethod.Get, true, false, null);
|
||||||
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!playbackRequestResponse.IsOk){
|
if (playbackRequestResponse.IsOk){
|
||||||
temppbData = Helpers.Deserialize<PlaybackData>(playbackRequestResponse.ResponseContent, SettingsJsonSerializerSettings) ??
|
temppbData = new PlaybackData{ Total = 0, Data = new List<Dictionary<string, Dictionary<string, StreamDetails>>>() };
|
||||||
new PlaybackData{ Total = 0, Data = new List<Dictionary<string, Dictionary<string, StreamDetails>>>() };
|
temppbData.Data.Add(new Dictionary<string, Dictionary<string, StreamDetails>>());
|
||||||
|
|
||||||
|
CrunchyStreamData? playStream = JsonConvert.DeserializeObject<CrunchyStreamData>(playbackRequestResponse.ResponseContent, SettingsJsonSerializerSettings);
|
||||||
|
CrunchyStreams derivedPlayCrunchyStreams = new CrunchyStreams();
|
||||||
|
if (playStream != null){
|
||||||
|
if (playStream.Token != null) await HttpClientReq.DeAuthVideo(mediaGuidId, playStream.Token);
|
||||||
|
|
||||||
|
if (playStream.HardSubs != null)
|
||||||
|
foreach (var hardsub in playStream.HardSubs){
|
||||||
|
var stream = hardsub.Value;
|
||||||
|
derivedPlayCrunchyStreams[hardsub.Key] = new StreamDetails{
|
||||||
|
Url = stream.Url,
|
||||||
|
HardsubLocale = stream.Hlang
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
derivedPlayCrunchyStreams[""] = new StreamDetails{
|
||||||
|
Url = playStream.Url,
|
||||||
|
HardsubLocale = Locale.DefaulT
|
||||||
|
};
|
||||||
|
|
||||||
|
if (temppbData.Data != null){
|
||||||
|
temppbData.Data[0]["drm_adaptive_dash"] = derivedPlayCrunchyStreams;
|
||||||
|
temppbData.Total = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
temppbData.Meta = new PlaybackMeta(){ AudioLocale = playStream.AudioLocale, Versions = playStream.Versions, Bifs = new List<string>{ playStream.Bifs }, MediaId = mediaId };
|
||||||
|
temppbData.Meta.Subtitles = new Subtitles();
|
||||||
|
foreach (var playStreamSubtitle in playStream.Subtitles){
|
||||||
|
Subtitle sub = playStreamSubtitle.Value;
|
||||||
|
temppbData.Meta.Subtitles.Add(playStreamSubtitle.Key, new SubtitleInfo(){ Format = sub.Format, Locale = sub.Locale, Url = sub.Url });
|
||||||
|
}
|
||||||
|
}
|
||||||
} else{
|
} else{
|
||||||
Console.WriteLine("Request Stream URLs FAILED! Attempting fallback");
|
Console.Error.WriteLine("'Fallback Request Stream URLs FAILED!'");
|
||||||
|
ok = playbackRequestResponse.IsOk;
|
||||||
playbackRequest = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{mediaGuidId}/web/firefox/play", HttpMethod.Get, true, false, null);
|
|
||||||
|
|
||||||
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
|
||||||
|
|
||||||
if (!playbackRequestResponse.IsOk && playbackRequestResponse.ResponseContent != string.Empty){
|
|
||||||
var s = playbackRequestResponse.ResponseContent;
|
|
||||||
var error = StreamError.FromJson(s);
|
|
||||||
if (error != null && error.IsTooManyActiveStreamsError()){
|
|
||||||
foreach (var errorActiveStream in error.ActiveStreams){
|
|
||||||
await HttpClientReq.DeAuthVideo(errorActiveStream.ContentId, errorActiveStream.Token);
|
|
||||||
}
|
|
||||||
|
|
||||||
playbackRequest = HttpClientReq.CreateRequestMessage($"https://cr-play-service.prd.crunchyrollsvc.com/v1/{mediaGuidId}/web/firefox/play", HttpMethod.Get, true, false, null);
|
|
||||||
playbackRequestResponse = await HttpClientReq.Instance.SendHttpRequest(playbackRequest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playbackRequestResponse.IsOk){
|
|
||||||
temppbData = new PlaybackData{ Total = 0, Data = new List<Dictionary<string, Dictionary<string, StreamDetails>>>() };
|
|
||||||
temppbData.Data.Add(new Dictionary<string, Dictionary<string, StreamDetails>>());
|
|
||||||
|
|
||||||
CrunchyStreamData? playStream = JsonConvert.DeserializeObject<CrunchyStreamData>(playbackRequestResponse.ResponseContent, SettingsJsonSerializerSettings);
|
|
||||||
CrunchyStreams derivedPlayCrunchyStreams = new CrunchyStreams();
|
|
||||||
if (playStream != null){
|
|
||||||
if (playStream.Token != null) await HttpClientReq.DeAuthVideo(mediaGuidId, playStream.Token);
|
|
||||||
|
|
||||||
if (playStream.HardSubs != null)
|
|
||||||
foreach (var hardsub in playStream.HardSubs){
|
|
||||||
var stream = hardsub.Value;
|
|
||||||
derivedPlayCrunchyStreams[hardsub.Key] = new StreamDetails{
|
|
||||||
Url = stream.Url,
|
|
||||||
HardsubLocale = stream.Hlang
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
derivedPlayCrunchyStreams[""] = new StreamDetails{
|
|
||||||
Url = playStream.Url,
|
|
||||||
HardsubLocale = Locale.DefaulT
|
|
||||||
};
|
|
||||||
|
|
||||||
if (temppbData.Data != null) temppbData.Data[0]["drm_adaptive_switch_dash"] = derivedPlayCrunchyStreams;
|
|
||||||
|
|
||||||
temppbData.Meta = new PlaybackMeta(){ AudioLocale = playStream.AudioLocale, Versions = playStream.Versions, Bifs = new List<string>{ playStream.Bifs }, MediaId = mediaId };
|
|
||||||
temppbData.Meta.Subtitles = new Subtitles();
|
|
||||||
foreach (var playStreamSubtitle in playStream.Subtitles){
|
|
||||||
Subtitle sub = playStreamSubtitle.Value;
|
|
||||||
temppbData.Meta.Subtitles.Add(playStreamSubtitle.Key, new SubtitleInfo(){ Format = sub.Format, Locale = sub.Locale, Url = sub.Url });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else{
|
|
||||||
Console.Error.WriteLine("'Fallback Request Stream URLs FAILED!'");
|
|
||||||
ok = playbackRequestResponse.IsOk;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (IsOk: ok, pbData: temppbData, error: ok ? "" : playbackRequestResponse.ResponseContent);
|
return (IsOk: ok, pbData: temppbData, error: ok ? "" : playbackRequestResponse.ResponseContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,33 +47,6 @@ public class HttpClientReq{
|
||||||
// client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0");
|
// client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0");
|
||||||
client.DefaultRequestHeaders.UserAgent.ParseAdd("Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27");
|
client.DefaultRequestHeaders.UserAgent.ParseAdd("Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27");
|
||||||
|
|
||||||
// // Set Accept headers
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/html"));
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xhtml+xml"));
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml", 0.9));
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("image/avif"));
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("image/webp"));
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("image/apng"));
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*", 0.8));
|
|
||||||
// client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/signed-exchange", 0.7));
|
|
||||||
//
|
|
||||||
// // Set Accept-Language
|
|
||||||
// client.DefaultRequestHeaders.AcceptLanguage.Add(new StringWithQualityHeaderValue("en-US"));
|
|
||||||
// client.DefaultRequestHeaders.AcceptLanguage.Add(new StringWithQualityHeaderValue("en", 0.9));
|
|
||||||
//
|
|
||||||
// // Set Cache-Control and Pragma for no caching
|
|
||||||
// client.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue{ NoCache = true };
|
|
||||||
// client.DefaultRequestHeaders.Pragma.Add(new NameValueHeaderValue("no-cache"));
|
|
||||||
//
|
|
||||||
// // Set other headers
|
|
||||||
// client.DefaultRequestHeaders.Add("sec-ch-ua", "\"Google Chrome\";v=\"123\", \"Not:A-Brand\";v=\"8\", \"Chromium\";v=\"123\"");
|
|
||||||
// client.DefaultRequestHeaders.Add("sec-ch-ua-mobile", "?0");
|
|
||||||
// client.DefaultRequestHeaders.Add("sec-ch-ua-platform", "\"Windows\"");
|
|
||||||
// client.DefaultRequestHeaders.Add("sec-fetch-dest", "document");
|
|
||||||
// client.DefaultRequestHeaders.Add("sec-fetch-mode", "navigate");
|
|
||||||
// client.DefaultRequestHeaders.Add("sec-fetch-site", "none");
|
|
||||||
// client.DefaultRequestHeaders.Add("sec-fetch-user", "?1");
|
|
||||||
// client.DefaultRequestHeaders.Add("upgrade-insecure-requests", "1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetETPCookie(string refresh_token){
|
public void SetETPCookie(string refresh_token){
|
||||||
|
|
|
@ -113,13 +113,13 @@ public class CrDownloadOptions{
|
||||||
[YamlMember(Alias = "history", ApplyNamingConventions = false)]
|
[YamlMember(Alias = "history", ApplyNamingConventions = false)]
|
||||||
public bool History{ get; set; }
|
public bool History{ get; set; }
|
||||||
|
|
||||||
[YamlMember(Alias = "user_non_drm_streams", ApplyNamingConventions = false)]
|
|
||||||
public bool UseNonDrmStreams{ get; set; }
|
|
||||||
|
|
||||||
[YamlMember(Alias = "sonarr_properties", ApplyNamingConventions = false)]
|
[YamlMember(Alias = "sonarr_properties", ApplyNamingConventions = false)]
|
||||||
public SonarrProperties? SonarrProperties{ get; set; }
|
public SonarrProperties? SonarrProperties{ get; set; }
|
||||||
|
|
||||||
[YamlMember(Alias = "log_mode", ApplyNamingConventions = false)]
|
[YamlMember(Alias = "log_mode", ApplyNamingConventions = false)]
|
||||||
public bool LogMode{ get; set; }
|
public bool LogMode{ get; set; }
|
||||||
|
|
||||||
|
[YamlMember(Alias = "stream_endpoint", ApplyNamingConventions = false)]
|
||||||
|
public string? StreamEndpoint{ get; set; }
|
||||||
|
|
||||||
}
|
}
|
|
@ -45,9 +45,6 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool _history;
|
private bool _history;
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private bool _useNonDrmEndpoint = true;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private int _leadingNumbers;
|
private int _leadingNumbers;
|
||||||
|
|
||||||
|
@ -81,6 +78,9 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private ObservableCollection<ListBoxItem> _selectedDubLang = new();
|
private ObservableCollection<ListBoxItem> _selectedDubLang = new();
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ComboBoxItem _selectedStreamEndpoint;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private ComboBoxItem _selectedDefaultDubLang;
|
private ComboBoxItem _selectedDefaultDubLang;
|
||||||
|
|
||||||
|
@ -222,6 +222,22 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
new ListBoxItem(){ Content = "none" },
|
new ListBoxItem(){ Content = "none" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public ObservableCollection<ComboBoxItem> StreamEndpoints{ get; } = new(){
|
||||||
|
new ComboBoxItem(){ Content = "web/firefox" },
|
||||||
|
new ComboBoxItem(){ Content = "console/switch" },
|
||||||
|
new ComboBoxItem(){ Content = "console/ps4" },
|
||||||
|
new ComboBoxItem(){ Content = "console/ps5" },
|
||||||
|
new ComboBoxItem(){ Content = "console/xbox_one" },
|
||||||
|
new ComboBoxItem(){ Content = "web/edge" },
|
||||||
|
// new ComboBoxItem(){ Content = "web/safari" },
|
||||||
|
new ComboBoxItem(){ Content = "web/chrome" },
|
||||||
|
new ComboBoxItem(){ Content = "web/fallback" },
|
||||||
|
// new ComboBoxItem(){ Content = "ios/iphone" },
|
||||||
|
// new ComboBoxItem(){ Content = "ios/ipad" },
|
||||||
|
new ComboBoxItem(){ Content = "android/phone" },
|
||||||
|
new ComboBoxItem(){ Content = "tv/samsung" },
|
||||||
|
};
|
||||||
|
|
||||||
private readonly FluentAvaloniaTheme _faTheme;
|
private readonly FluentAvaloniaTheme _faTheme;
|
||||||
|
|
||||||
private bool settingsLoaded;
|
private bool settingsLoaded;
|
||||||
|
@ -252,6 +268,9 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
ComboBoxItem? defaultSubLang = DefaultSubLangList.FirstOrDefault(a => a.Content != null && (string)a.Content == (options.DefaultSub ?? "")) ?? null;
|
ComboBoxItem? defaultSubLang = DefaultSubLangList.FirstOrDefault(a => a.Content != null && (string)a.Content == (options.DefaultSub ?? "")) ?? null;
|
||||||
SelectedDefaultSubLang = defaultSubLang ?? DefaultSubLangList[0];
|
SelectedDefaultSubLang = defaultSubLang ?? DefaultSubLangList[0];
|
||||||
|
|
||||||
|
ComboBoxItem? streamEndpoint = StreamEndpoints.FirstOrDefault(a => a.Content != null && (string)a.Content == (options.StreamEndpoint ?? "")) ?? null;
|
||||||
|
SelectedStreamEndpoint = streamEndpoint ?? StreamEndpoints[0];
|
||||||
|
|
||||||
var softSubLang = SubLangList.Where(a => options.DlSubs.Contains(a.Content)).ToList();
|
var softSubLang = SubLangList.Where(a => options.DlSubs.Contains(a.Content)).ToList();
|
||||||
|
|
||||||
SelectedSubLang.Clear();
|
SelectedSubLang.Clear();
|
||||||
|
@ -278,7 +297,6 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
SonarrApiKey = props.ApiKey + "";
|
SonarrApiKey = props.ApiKey + "";
|
||||||
}
|
}
|
||||||
|
|
||||||
UseNonDrmEndpoint = options.UseNonDrmStreams;
|
|
||||||
DownloadVideo = !options.Novids;
|
DownloadVideo = !options.Novids;
|
||||||
DownloadAudio = !options.Noaudio;
|
DownloadAudio = !options.Noaudio;
|
||||||
DownloadVideoForEveryDub = !options.DlVideoOnce;
|
DownloadVideoForEveryDub = !options.DlVideoOnce;
|
||||||
|
@ -359,6 +377,9 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
Crunchyroll.Instance.CrunOptions.DefaultAudio = SelectedDefaultDubLang.Content + "";
|
Crunchyroll.Instance.CrunOptions.DefaultAudio = SelectedDefaultDubLang.Content + "";
|
||||||
Crunchyroll.Instance.CrunOptions.DefaultSub = SelectedDefaultSubLang.Content + "";
|
Crunchyroll.Instance.CrunOptions.DefaultSub = SelectedDefaultSubLang.Content + "";
|
||||||
|
|
||||||
|
|
||||||
|
Crunchyroll.Instance.CrunOptions.StreamEndpoint = SelectedStreamEndpoint.Content + "";
|
||||||
|
|
||||||
List<string> dubLangs = new List<string>();
|
List<string> dubLangs = new List<string>();
|
||||||
foreach (var listBoxItem in SelectedDubLang){
|
foreach (var listBoxItem in SelectedDubLang){
|
||||||
dubLangs.Add(listBoxItem.Content + "");
|
dubLangs.Add(listBoxItem.Content + "");
|
||||||
|
@ -369,7 +390,6 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
|
|
||||||
Crunchyroll.Instance.CrunOptions.SimultaneousDownloads = SimultaneousDownloads;
|
Crunchyroll.Instance.CrunOptions.SimultaneousDownloads = SimultaneousDownloads;
|
||||||
|
|
||||||
Crunchyroll.Instance.CrunOptions.UseNonDrmStreams = UseNonDrmEndpoint;
|
|
||||||
Crunchyroll.Instance.CrunOptions.QualityAudio = SelectedAudioQuality?.Content + "";
|
Crunchyroll.Instance.CrunOptions.QualityAudio = SelectedAudioQuality?.Content + "";
|
||||||
Crunchyroll.Instance.CrunOptions.QualityVideo = SelectedVideoQuality?.Content + "";
|
Crunchyroll.Instance.CrunOptions.QualityVideo = SelectedVideoQuality?.Content + "";
|
||||||
Crunchyroll.Instance.CrunOptions.Theme = CurrentAppTheme?.Content + "";
|
Crunchyroll.Instance.CrunOptions.Theme = CurrentAppTheme?.Content + "";
|
||||||
|
@ -412,8 +432,6 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
Crunchyroll.Instance.CrunOptions.FfmpegOptions = ffmpegParams;
|
Crunchyroll.Instance.CrunOptions.FfmpegOptions = ffmpegParams;
|
||||||
|
|
||||||
CfgManager.WriteSettingsToFile();
|
CfgManager.WriteSettingsToFile();
|
||||||
|
|
||||||
// Console.WriteLine("Updated Settings");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSubAndDubString(){
|
private void UpdateSubAndDubString(){
|
||||||
|
@ -556,10 +574,6 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnUseNonDrmEndpointChanged(bool value){
|
|
||||||
UpdateSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void OnHistoryChanged(bool value){
|
partial void OnHistoryChanged(bool value){
|
||||||
UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
|
@ -608,6 +622,10 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
partial void OnDownloadVideoForEveryDubChanged(bool value){
|
partial void OnDownloadVideoForEveryDubChanged(bool value){
|
||||||
UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void OnSelectedStreamEndpointChanged(ComboBoxItem value){
|
||||||
|
UpdateSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MuxingParam{
|
public class MuxingParam{
|
||||||
|
|
|
@ -123,6 +123,15 @@
|
||||||
Description="Adjust download settings"
|
Description="Adjust download settings"
|
||||||
IsExpanded="False">
|
IsExpanded="False">
|
||||||
|
|
||||||
|
<controls:SettingsExpanderItem Content="Stream Endpoint ">
|
||||||
|
<controls:SettingsExpanderItem.Footer>
|
||||||
|
<ComboBox HorizontalContentAlignment="Center" MinWidth="210" MaxDropDownHeight="400"
|
||||||
|
ItemsSource="{Binding StreamEndpoints}"
|
||||||
|
SelectedItem="{Binding SelectedStreamEndpoint}">
|
||||||
|
</ComboBox>
|
||||||
|
</controls:SettingsExpanderItem.Footer>
|
||||||
|
</controls:SettingsExpanderItem>
|
||||||
|
|
||||||
<controls:SettingsExpanderItem Content="Simultaneous Downloads">
|
<controls:SettingsExpanderItem Content="Simultaneous Downloads">
|
||||||
<controls:SettingsExpanderItem.Footer>
|
<controls:SettingsExpanderItem.Footer>
|
||||||
<controls:NumberBox Minimum="0" Maximum="5"
|
<controls:NumberBox Minimum="0" Maximum="5"
|
||||||
|
@ -174,14 +183,7 @@
|
||||||
</controls:SettingsExpanderItem.Footer>
|
</controls:SettingsExpanderItem.Footer>
|
||||||
</controls:SettingsExpanderItem>
|
</controls:SettingsExpanderItem>
|
||||||
|
|
||||||
<controls:SettingsExpanderItem Content="Check for Non-DRM streams">
|
|
||||||
<controls:SettingsExpanderItem.Footer>
|
|
||||||
<CheckBox IsChecked="{Binding UseNonDrmEndpoint}"> </CheckBox>
|
|
||||||
</controls:SettingsExpanderItem.Footer>
|
|
||||||
</controls:SettingsExpanderItem>
|
|
||||||
|
|
||||||
<controls:SettingsExpander.Footer>
|
<controls:SettingsExpander.Footer>
|
||||||
|
|
||||||
</controls:SettingsExpander.Footer>
|
</controls:SettingsExpander.Footer>
|
||||||
</controls:SettingsExpander>
|
</controls:SettingsExpander>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue