Major refactor #141
@ -27,8 +27,8 @@ public static class VersionHelper
|
|||||||
Log.Debug("GetLatestReleaseTag API Response: ");
|
Log.Debug("GetLatestReleaseTag API Response: ");
|
||||||
Log.Debug(body);
|
Log.Debug(body);
|
||||||
|
|
||||||
LatestReleaseAPIResponse? versionCheckResponse =
|
LatestReleaseApiResponse? versionCheckResponse =
|
||||||
JsonConvert.DeserializeObject<LatestReleaseAPIResponse>(body);
|
JsonConvert.DeserializeObject<LatestReleaseApiResponse>(body);
|
||||||
|
|
||||||
if (versionCheckResponse == null || versionCheckResponse.TagName == "")
|
if (versionCheckResponse == null || versionCheckResponse.TagName == "")
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,10 +4,18 @@ namespace OF_DL.Models;
|
|||||||
|
|
||||||
public class Auth
|
public class Auth
|
||||||
{
|
{
|
||||||
public string? USER_ID { get; set; } = "";
|
[JsonProperty(PropertyName = "USER_ID")]
|
||||||
public string? USER_AGENT { get; set; } = "";
|
public string? UserId { get; set; } = "";
|
||||||
public string? X_BC { get; set; } = "";
|
|
||||||
public string? COOKIE { get; set; } = "";
|
|
||||||
|
|
||||||
[JsonIgnore] public string? FFMPEG_PATH { get; set; } = "";
|
[JsonProperty(PropertyName = "USER_AGENT")]
|
||||||
|
public string? UserAgent { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "X_BC")] public string? XBc { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "COOKIE")]
|
||||||
|
public string? Cookie { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[JsonProperty(PropertyName = "FFMPEG_PATH")]
|
||||||
|
public string? FfmpegPath { get; set; } = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,12 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace OF_DL.Models;
|
namespace OF_DL.Models;
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public class CDRMProjectRequest
|
public class CDRMProjectRequest
|
||||||
{
|
{
|
||||||
[JsonProperty("pssh")] public string PSSH { get; set; } = "";
|
[JsonProperty("pssh")] public string Pssh { get; set; } = "";
|
||||||
|
|
||||||
[JsonProperty("licurl")] public string LicenseURL { get; set; } = "";
|
[JsonProperty("licurl")] public string LicenseUrl { get; set; } = "";
|
||||||
|
|
||||||
[JsonProperty("headers")] public string Headers { get; set; } = "";
|
[JsonProperty("headers")] public string Headers { get; set; } = "";
|
||||||
|
|
||||||
|
|||||||
@ -105,52 +105,39 @@ public class Config : IFileNameFormatConfig
|
|||||||
|
|
||||||
public IFileNameFormatConfig GetCreatorFileNameFormatConfig(string username)
|
public IFileNameFormatConfig GetCreatorFileNameFormatConfig(string username)
|
||||||
{
|
{
|
||||||
FileNameFormatConfig createFileNameFormatConfig = new();
|
FileNameFormatConfig combinedFilenameFormatConfig = new();
|
||||||
|
|
||||||
Func<string?, string?, string?> func = (val1, val2) =>
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(val1))
|
|
||||||
{
|
|
||||||
return val2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return val1;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (CreatorConfigs.TryGetValue(username, out CreatorConfig? creatorConfig))
|
if (CreatorConfigs.TryGetValue(username, out CreatorConfig? creatorConfig))
|
||||||
{
|
{
|
||||||
createFileNameFormatConfig.PaidMessageFileNameFormat = creatorConfig.PaidMessageFileNameFormat;
|
combinedFilenameFormatConfig.PaidMessageFileNameFormat =
|
||||||
createFileNameFormatConfig.PostFileNameFormat = creatorConfig.PostFileNameFormat;
|
!string.IsNullOrEmpty(creatorConfig.PaidMessageFileNameFormat)
|
||||||
createFileNameFormatConfig.MessageFileNameFormat = creatorConfig.MessageFileNameFormat;
|
? creatorConfig.PaidMessageFileNameFormat
|
||||||
createFileNameFormatConfig.PaidPostFileNameFormat = creatorConfig.PaidPostFileNameFormat;
|
: PaidMessageFileNameFormat;
|
||||||
}
|
|
||||||
|
|
||||||
createFileNameFormatConfig.PaidMessageFileNameFormat =
|
combinedFilenameFormatConfig.PostFileNameFormat = !string.IsNullOrEmpty(creatorConfig.PostFileNameFormat)
|
||||||
func(createFileNameFormatConfig.PaidMessageFileNameFormat, PaidMessageFileNameFormat);
|
? creatorConfig.PostFileNameFormat
|
||||||
createFileNameFormatConfig.PostFileNameFormat =
|
: PostFileNameFormat;
|
||||||
func(createFileNameFormatConfig.PostFileNameFormat, PostFileNameFormat);
|
|
||||||
createFileNameFormatConfig.MessageFileNameFormat =
|
combinedFilenameFormatConfig.MessageFileNameFormat =
|
||||||
func(createFileNameFormatConfig.MessageFileNameFormat, MessageFileNameFormat);
|
!string.IsNullOrEmpty(creatorConfig.MessageFileNameFormat)
|
||||||
createFileNameFormatConfig.PaidPostFileNameFormat =
|
? creatorConfig.MessageFileNameFormat
|
||||||
func(createFileNameFormatConfig.PaidPostFileNameFormat, PaidPostFileNameFormat);
|
: MessageFileNameFormat;
|
||||||
|
|
||||||
|
combinedFilenameFormatConfig.PaidPostFileNameFormat =
|
||||||
|
!string.IsNullOrEmpty(creatorConfig.PaidPostFileNameFormat)
|
||||||
|
? creatorConfig.PaidPostFileNameFormat
|
||||||
|
: PaidPostFileNameFormat;
|
||||||
|
}
|
||||||
|
|
||||||
Log.Debug("PaidMessageFilenameFormat: {CombinedConfigPaidMessageFileNameFormat}",
|
Log.Debug("PaidMessageFilenameFormat: {CombinedConfigPaidMessageFileNameFormat}",
|
||||||
createFileNameFormatConfig.PaidMessageFileNameFormat);
|
combinedFilenameFormatConfig.PaidMessageFileNameFormat);
|
||||||
Log.Debug("PostFileNameFormat: {CombinedConfigPostFileNameFormat}",
|
Log.Debug("PostFileNameFormat: {CombinedConfigPostFileNameFormat}",
|
||||||
createFileNameFormatConfig.PostFileNameFormat);
|
combinedFilenameFormatConfig.PostFileNameFormat);
|
||||||
Log.Debug("MessageFileNameFormat: {CombinedConfigMessageFileNameFormat}",
|
Log.Debug("MessageFileNameFormat: {CombinedConfigMessageFileNameFormat}",
|
||||||
createFileNameFormatConfig.MessageFileNameFormat);
|
combinedFilenameFormatConfig.MessageFileNameFormat);
|
||||||
Log.Debug("PaidPostFileNameFormat: {CombinedConfigPaidPostFileNameFormat}",
|
Log.Debug("PaidPostFileNameFormat: {CombinedConfigPaidPostFileNameFormat}",
|
||||||
createFileNameFormatConfig.PaidPostFileNameFormat);
|
combinedFilenameFormatConfig.PaidPostFileNameFormat);
|
||||||
|
|
||||||
return createFileNameFormatConfig;
|
return combinedFilenameFormatConfig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreatorConfig : IFileNameFormatConfig
|
|
||||||
{
|
|
||||||
public string? PaidPostFileNameFormat { get; set; }
|
|
||||||
public string? PostFileNameFormat { get; set; }
|
|
||||||
public string? PaidMessageFileNameFormat { get; set; }
|
|
||||||
public string? MessageFileNameFormat { get; set; }
|
|
||||||
}
|
|
||||||
|
|||||||
12
OF DL/Models/CreatorConfig.cs
Normal file
12
OF DL/Models/CreatorConfig.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace OF_DL.Models;
|
||||||
|
|
||||||
|
public class CreatorConfig : IFileNameFormatConfig
|
||||||
|
{
|
||||||
|
public string? PaidPostFileNameFormat { get; set; }
|
||||||
|
|
||||||
|
public string? PostFileNameFormat { get; set; }
|
||||||
|
|
||||||
|
public string? PaidMessageFileNameFormat { get; set; }
|
||||||
|
|
||||||
|
public string? MessageFileNameFormat { get; set; }
|
||||||
|
}
|
||||||
@ -26,5 +26,5 @@ public class DynamicRules
|
|||||||
public int? ChecksumConstant { get; set; }
|
public int? ChecksumConstant { get; set; }
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "checksum_indexes")]
|
[JsonProperty(PropertyName = "checksum_indexes")]
|
||||||
public List<int> ChecksumIndexes { get; set; }
|
public List<int> ChecksumIndexes { get; set; } = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,10 @@ namespace OF_DL.Models;
|
|||||||
public class FileNameFormatConfig : IFileNameFormatConfig
|
public class FileNameFormatConfig : IFileNameFormatConfig
|
||||||
{
|
{
|
||||||
public string? PaidPostFileNameFormat { get; set; }
|
public string? PaidPostFileNameFormat { get; set; }
|
||||||
|
|
||||||
public string? PostFileNameFormat { get; set; }
|
public string? PostFileNameFormat { get; set; }
|
||||||
|
|
||||||
public string? PaidMessageFileNameFormat { get; set; }
|
public string? PaidMessageFileNameFormat { get; set; }
|
||||||
|
|
||||||
public string? MessageFileNameFormat { get; set; }
|
public string? MessageFileNameFormat { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,10 @@ namespace OF_DL.Models;
|
|||||||
public interface IFileNameFormatConfig
|
public interface IFileNameFormatConfig
|
||||||
{
|
{
|
||||||
string? PaidPostFileNameFormat { get; set; }
|
string? PaidPostFileNameFormat { get; set; }
|
||||||
|
|
||||||
string? PostFileNameFormat { get; set; }
|
string? PostFileNameFormat { get; set; }
|
||||||
|
|
||||||
string? PaidMessageFileNameFormat { get; set; }
|
string? PaidMessageFileNameFormat { get; set; }
|
||||||
|
|
||||||
string? MessageFileNameFormat { get; set; }
|
string? MessageFileNameFormat { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace OF_DL.Models;
|
namespace OF_DL.Models;
|
||||||
|
|
||||||
public class LatestReleaseAPIResponse
|
public class LatestReleaseApiResponse
|
||||||
{
|
{
|
||||||
[JsonProperty(PropertyName = "tag_name")]
|
[JsonProperty(PropertyName = "tag_name")]
|
||||||
public string TagName { get; set; } = "";
|
public string TagName { get; set; } = "";
|
||||||
@ -2,11 +2,12 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace OF_DL.Models;
|
namespace OF_DL.Models;
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public class OFDLRequest
|
public class OFDLRequest
|
||||||
{
|
{
|
||||||
[JsonProperty("pssh")] public string PSSH { get; set; } = "";
|
[JsonProperty("pssh")] public string Pssh { get; set; } = "";
|
||||||
|
|
||||||
[JsonProperty("licenceURL")] public string LicenseURL { get; set; } = "";
|
[JsonProperty("licenceURL")] public string LicenseUrl { get; set; } = "";
|
||||||
|
|
||||||
[JsonProperty("headers")] public string Headers { get; set; } = "";
|
[JsonProperty("headers")] public string Headers { get; set; } = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
namespace OF_DL.Models;
|
namespace OF_DL.Models;
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
internal class ToggleableConfigAttribute : Attribute
|
internal class ToggleableConfigAttribute : Attribute;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@ -376,12 +376,12 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
Log.Debug($"FFMPEG found: {configService.CurrentConfig.FFmpegPath}");
|
Log.Debug($"FFMPEG found: {configService.CurrentConfig.FFmpegPath}");
|
||||||
Log.Debug("FFMPEG path set in config.conf");
|
Log.Debug("FFMPEG path set in config.conf");
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrEmpty(authService.CurrentAuth!.FFMPEG_PATH) &&
|
else if (!string.IsNullOrEmpty(authService.CurrentAuth!.FfmpegPath) &&
|
||||||
ValidateFilePath(authService.CurrentAuth.FFMPEG_PATH))
|
ValidateFilePath(authService.CurrentAuth.FfmpegPath))
|
||||||
{
|
{
|
||||||
// FFmpeg path is set in auth.json and is valid (config.conf takes precedence and auth.json is only available for backward compatibility)
|
// FFmpeg path is set in auth.json and is valid (config.conf takes precedence and auth.json is only available for backward compatibility)
|
||||||
ffmpegFound = true;
|
ffmpegFound = true;
|
||||||
configService.CurrentConfig.FFmpegPath = authService.CurrentAuth.FFMPEG_PATH;
|
configService.CurrentConfig.FFmpegPath = authService.CurrentAuth.FfmpegPath;
|
||||||
Log.Debug($"FFMPEG found: {configService.CurrentConfig.FFmpegPath}");
|
Log.Debug($"FFMPEG found: {configService.CurrentConfig.FFmpegPath}");
|
||||||
Log.Debug("FFMPEG path set in auth.json");
|
Log.Debug("FFMPEG path set in auth.json");
|
||||||
}
|
}
|
||||||
@ -2638,7 +2638,7 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
public static void ValidateCookieString(Auth auth)
|
public static void ValidateCookieString(Auth auth)
|
||||||
{
|
{
|
||||||
string pattern = @"(auth_id=\d+)|(sess=[^;]+)";
|
string pattern = @"(auth_id=\d+)|(sess=[^;]+)";
|
||||||
MatchCollection matches = Regex.Matches(auth.COOKIE, pattern);
|
MatchCollection matches = Regex.Matches(auth.Cookie, pattern);
|
||||||
|
|
||||||
string output = string.Join("; ", matches);
|
string output = string.Join("; ", matches);
|
||||||
|
|
||||||
@ -2647,9 +2647,9 @@ public class Program(IServiceProvider serviceProvider)
|
|||||||
output += ";";
|
output += ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth.COOKIE.Trim() != output.Trim())
|
if (auth.Cookie.Trim() != output.Trim())
|
||||||
{
|
{
|
||||||
auth.COOKIE = output;
|
auth.Cookie = output;
|
||||||
string newAuthString = JsonConvert.SerializeObject(auth, Formatting.Indented);
|
string newAuthString = JsonConvert.SerializeObject(auth, Formatting.Indented);
|
||||||
File.WriteAllText("auth.json", newAuthString);
|
File.WriteAllText("auth.json", newAuthString);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
DateTimeOffset dto = DateTime.UtcNow;
|
DateTimeOffset dto = DateTime.UtcNow;
|
||||||
long timestamp = dto.ToUnixTimeMilliseconds();
|
long timestamp = dto.ToUnixTimeMilliseconds();
|
||||||
|
|
||||||
string input = $"{root!.StaticParam}\n{timestamp}\n{path + queryParams}\n{authService.CurrentAuth.USER_ID}";
|
string input = $"{root!.StaticParam}\n{timestamp}\n{path + queryParams}\n{authService.CurrentAuth.UserId}";
|
||||||
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
|
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
|
||||||
byte[] hashBytes = SHA1.HashData(inputBytes);
|
byte[] hashBytes = SHA1.HashData(inputBytes);
|
||||||
string hashString = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
|
string hashString = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
|
||||||
@ -108,12 +108,12 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
{
|
{
|
||||||
{ "accept", "application/json, text/plain" },
|
{ "accept", "application/json, text/plain" },
|
||||||
{ "app-token", root.AppToken! },
|
{ "app-token", root.AppToken! },
|
||||||
{ "cookie", authService.CurrentAuth!.COOKIE! },
|
{ "cookie", authService.CurrentAuth!.Cookie! },
|
||||||
{ "sign", sign },
|
{ "sign", sign },
|
||||||
{ "time", timestamp.ToString() },
|
{ "time", timestamp.ToString() },
|
||||||
{ "user-id", authService.CurrentAuth!.USER_ID! },
|
{ "user-id", authService.CurrentAuth!.UserId! },
|
||||||
{ "user-agent", authService.CurrentAuth!.USER_AGENT! },
|
{ "user-agent", authService.CurrentAuth!.UserAgent! },
|
||||||
{ "x-bc", authService.CurrentAuth!.X_BC! }
|
{ "x-bc", authService.CurrentAuth!.XBc! }
|
||||||
};
|
};
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
@ -1634,7 +1634,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!configService.CurrentConfig.IgnoreOwnMessages ||
|
if (!configService.CurrentConfig.IgnoreOwnMessages ||
|
||||||
list.FromUser?.Id != Convert.ToInt32(authService.CurrentAuth.USER_ID))
|
list.FromUser?.Id != Convert.ToInt32(authService.CurrentAuth.UserId))
|
||||||
{
|
{
|
||||||
await dbService.AddMessage(folder, list.Id, list.Text ?? "", list.Price ?? "0",
|
await dbService.AddMessage(folder, list.Id, list.Text ?? "", list.Price ?? "0",
|
||||||
list.CanPurchaseReason == "opened" ? true :
|
list.CanPurchaseReason == "opened" ? true :
|
||||||
@ -1834,7 +1834,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
message = MessagesMapper.FromDto(messageDto);
|
message = MessagesMapper.FromDto(messageDto);
|
||||||
|
|
||||||
if (!configService.CurrentConfig.IgnoreOwnMessages ||
|
if (!configService.CurrentConfig.IgnoreOwnMessages ||
|
||||||
message.FromUser?.Id != Convert.ToInt32(authService.CurrentAuth.USER_ID))
|
message.FromUser?.Id != Convert.ToInt32(authService.CurrentAuth.UserId))
|
||||||
{
|
{
|
||||||
await dbService.AddMessage(folder, message.Id, message.Text ?? "",
|
await dbService.AddMessage(folder, message.Id, message.Text ?? "",
|
||||||
message.Price != null ? message.Price.ToString() : "0", true, false,
|
message.Price != null ? message.Price.ToString() : "0", true, false,
|
||||||
@ -2101,7 +2101,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
.OrderByDescending(p => p.PostedAt ?? p.CreatedAt))
|
.OrderByDescending(p => p.PostedAt ?? p.CreatedAt))
|
||||||
{
|
{
|
||||||
if (!configService.CurrentConfig.IgnoreOwnMessages ||
|
if (!configService.CurrentConfig.IgnoreOwnMessages ||
|
||||||
purchase.FromUser.Id != Convert.ToInt32(authService.CurrentAuth.USER_ID))
|
purchase.FromUser.Id != Convert.ToInt32(authService.CurrentAuth.UserId))
|
||||||
{
|
{
|
||||||
if (purchase.PostedAt != null)
|
if (purchase.PostedAt != null)
|
||||||
{
|
{
|
||||||
@ -3034,10 +3034,10 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
|
|
||||||
HttpClient client = new();
|
HttpClient client = new();
|
||||||
HttpRequestMessage request = new(HttpMethod.Get, mpdUrl);
|
HttpRequestMessage request = new(HttpMethod.Get, mpdUrl);
|
||||||
request.Headers.Add("user-agent", authService.CurrentAuth.USER_AGENT);
|
request.Headers.Add("user-agent", authService.CurrentAuth.UserAgent);
|
||||||
request.Headers.Add("Accept", "*/*");
|
request.Headers.Add("Accept", "*/*");
|
||||||
request.Headers.Add("Cookie",
|
request.Headers.Add("Cookie",
|
||||||
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.COOKIE};");
|
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.Cookie};");
|
||||||
using (HttpResponseMessage response = await client.SendAsync(request))
|
using (HttpResponseMessage response = await client.SendAsync(request))
|
||||||
{
|
{
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@ -3083,10 +3083,10 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
|
|
||||||
HttpClient client = new();
|
HttpClient client = new();
|
||||||
HttpRequestMessage request = new(HttpMethod.Get, mpdUrl);
|
HttpRequestMessage request = new(HttpMethod.Get, mpdUrl);
|
||||||
request.Headers.Add("user-agent", authService.CurrentAuth.USER_AGENT);
|
request.Headers.Add("user-agent", authService.CurrentAuth.UserAgent);
|
||||||
request.Headers.Add("Accept", "*/*");
|
request.Headers.Add("Accept", "*/*");
|
||||||
request.Headers.Add("Cookie",
|
request.Headers.Add("Cookie",
|
||||||
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.COOKIE};");
|
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.Cookie};");
|
||||||
using (HttpResponseMessage response =
|
using (HttpResponseMessage response =
|
||||||
await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead))
|
await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead))
|
||||||
{
|
{
|
||||||
@ -3129,8 +3129,8 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
|
|
||||||
CDRMProjectRequest cdrmProjectRequest = new()
|
CDRMProjectRequest cdrmProjectRequest = new()
|
||||||
{
|
{
|
||||||
PSSH = pssh,
|
Pssh = pssh,
|
||||||
LicenseURL = licenceURL,
|
LicenseUrl = licenceURL,
|
||||||
Headers = JsonConvert.SerializeObject(drmHeaders),
|
Headers = JsonConvert.SerializeObject(drmHeaders),
|
||||||
Cookies = "",
|
Cookies = "",
|
||||||
Data = ""
|
Data = ""
|
||||||
@ -3212,7 +3212,7 @@ public class APIService(IAuthService authService, IConfigService configService,
|
|||||||
|
|
||||||
OFDLRequest ofdlRequest = new()
|
OFDLRequest ofdlRequest = new()
|
||||||
{
|
{
|
||||||
PSSH = pssh, LicenseURL = licenceURL, Headers = JsonConvert.SerializeObject(drmHeaders)
|
Pssh = pssh, LicenseUrl = licenceURL, Headers = JsonConvert.SerializeObject(drmHeaders)
|
||||||
};
|
};
|
||||||
|
|
||||||
string json = JsonConvert.SerializeObject(ofdlRequest);
|
string json = JsonConvert.SerializeObject(ofdlRequest);
|
||||||
|
|||||||
@ -212,7 +212,7 @@ public class AuthService : IAuthService
|
|||||||
string cookies = string.Join(" ", mappedCookies.Keys.Where(key => _desiredCookies.Contains(key))
|
string cookies = string.Join(" ", mappedCookies.Keys.Where(key => _desiredCookies.Contains(key))
|
||||||
.Select(key => $"${key}={mappedCookies[key]};"));
|
.Select(key => $"${key}={mappedCookies[key]};"));
|
||||||
|
|
||||||
return new Auth { COOKIE = cookies, USER_AGENT = userAgent, USER_ID = userId, X_BC = xBc };
|
return new Auth { Cookie = cookies, UserAgent = userAgent, UserId = userId, XBc = xBc };
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -334,10 +334,10 @@ public class DownloadService(
|
|||||||
{
|
{
|
||||||
HttpClient client = new();
|
HttpClient client = new();
|
||||||
HttpRequestMessage request = new(HttpMethod.Get, mpdUrl);
|
HttpRequestMessage request = new(HttpMethod.Get, mpdUrl);
|
||||||
request.Headers.Add("user-agent", authService.CurrentAuth.USER_AGENT);
|
request.Headers.Add("user-agent", authService.CurrentAuth.UserAgent);
|
||||||
request.Headers.Add("Accept", "*/*");
|
request.Headers.Add("Accept", "*/*");
|
||||||
request.Headers.Add("Cookie",
|
request.Headers.Add("Cookie",
|
||||||
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.COOKIE};");
|
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.Cookie};");
|
||||||
using (HttpResponseMessage response = await client.SendAsync(request))
|
using (HttpResponseMessage response = await client.SendAsync(request))
|
||||||
{
|
{
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
@ -568,8 +568,8 @@ public class DownloadService(
|
|||||||
|
|
||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
client.DefaultRequestHeaders.Add("Cookie",
|
client.DefaultRequestHeaders.Add("Cookie",
|
||||||
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.COOKIE}");
|
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {authService.CurrentAuth.Cookie}");
|
||||||
client.DefaultRequestHeaders.Add("User-Agent", authService.CurrentAuth.USER_AGENT);
|
client.DefaultRequestHeaders.Add("User-Agent", authService.CurrentAuth.UserAgent);
|
||||||
|
|
||||||
using HttpResponseMessage response =
|
using HttpResponseMessage response =
|
||||||
await client.GetAsync(mpdURL, HttpCompletionOption.ResponseHeadersRead);
|
await client.GetAsync(mpdURL, HttpCompletionOption.ResponseHeadersRead);
|
||||||
@ -581,7 +581,7 @@ public class DownloadService(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
client.DefaultRequestHeaders.Add("User-Agent", authService.CurrentAuth.USER_AGENT);
|
client.DefaultRequestHeaders.Add("User-Agent", authService.CurrentAuth.UserAgent);
|
||||||
using HttpResponseMessage response =
|
using HttpResponseMessage response =
|
||||||
await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead);
|
await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead);
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
@ -612,8 +612,8 @@ public class DownloadService(
|
|||||||
|
|
||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
client.DefaultRequestHeaders.Add("Cookie",
|
client.DefaultRequestHeaders.Add("Cookie",
|
||||||
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {auth.COOKIE}");
|
$"CloudFront-Policy={policy}; CloudFront-Signature={signature}; CloudFront-Key-Pair-Id={kvp}; {auth.Cookie}");
|
||||||
client.DefaultRequestHeaders.Add("User-Agent", auth.USER_AGENT);
|
client.DefaultRequestHeaders.Add("User-Agent", auth.UserAgent);
|
||||||
|
|
||||||
using HttpResponseMessage response = await client.GetAsync(mpdURL, HttpCompletionOption.ResponseHeadersRead);
|
using HttpResponseMessage response = await client.GetAsync(mpdURL, HttpCompletionOption.ResponseHeadersRead);
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
@ -1242,8 +1242,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,8 +1371,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1501,8 +1501,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1629,8 +1629,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1759,8 +1759,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1888,8 +1888,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2017,8 +2017,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2147,8 +2147,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2267,8 +2267,8 @@ public class DownloadService(
|
|||||||
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
? !File.Exists(folder + path + "/" + customFileName + ".mp4")
|
||||||
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
: !File.Exists(folder + path + "/" + filename + "_source.mp4"))
|
||||||
{
|
{
|
||||||
return await DownloadDrmMedia(authService.CurrentAuth.USER_AGENT, policy, signature, kvp,
|
return await DownloadDrmMedia(authService.CurrentAuth.UserAgent, policy, signature, kvp,
|
||||||
authService.CurrentAuth.COOKIE, url, decryptionKey, folder, lastModified, media_id, api_type,
|
authService.CurrentAuth.Cookie, url, decryptionKey, folder, lastModified, media_id, api_type,
|
||||||
progressReporter, customFileName, filename, path);
|
progressReporter, customFileName, filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user