Compare commits

..

No commits in common. "master" and "fix-widevine-cloudflare-retry" have entirely different histories.

5 changed files with 21 additions and 49 deletions

View File

@ -103,10 +103,6 @@ namespace OF_DL.Entities
[JsonConverter(typeof(StringEnumConverter))]
public VideoResolution DownloadVideoResolution { get; set; } = VideoResolution.source;
// When enabled, post/message text is stored as-is without XML stripping.
[ToggleableConfig]
public bool DisableTextSanitization { get; set; } = false;
}
public class CreatorConfig : IFileNameFormatConfig

View File

@ -464,7 +464,7 @@ public class APIHelper : IAPIHelper
Dictionary<string, string> getParams = new()
{
{ "offset", offset.ToString() },
{ "limit", "50" },
{ "limit", "50" }
};
List<string> users = new();
@ -540,8 +540,7 @@ public class APIHelper : IAPIHelper
getParams = new Dictionary<string, string>
{
{ "limit", post_limit.ToString() },
{ "order", "publish_date_desc" },
{ "skip_users", "all" }
{ "order", "publish_date_desc" }
};
break;
@ -549,8 +548,7 @@ public class APIHelper : IAPIHelper
getParams = new Dictionary<string, string>
{
{ "limit", limit.ToString() },
{ "offset", offset.ToString() },
{ "skip_users", "all" }
{ "offset", offset.ToString() }
};
break;
}
@ -740,10 +738,9 @@ public class APIHelper : IAPIHelper
Dictionary<string, string> getParams = new()
{
{ "limit", post_limit.ToString() },
{ "skip_users", "all" },
{ "order", "publish_date_desc" },
{ "format", "infinite" },
{ "author", username }
{ "user_id", username }
};
var body = await BuildHeaderAndExecuteRequests(getParams, endpoint, GetHttpClient(config));
@ -909,8 +906,7 @@ public class APIHelper : IAPIHelper
{
{ "limit", post_limit.ToString() },
{ "order", "publish_date_desc" },
{ "format", "infinite" },
{ "skip_users", "all" }
{ "format", "infinite" }
};
Enumerations.DownloadDateSelection downloadDateSelection = Enumerations.DownloadDateSelection.before;
@ -1241,8 +1237,7 @@ public class APIHelper : IAPIHelper
{
{ "limit", post_limit.ToString() },
{ "order", "publish_date_desc" },
{ "format", "infinite" },
{ "skip_users", "all" }
{ "format", "infinite" }
};
Enumerations.DownloadDateSelection downloadDateSelection = Enumerations.DownloadDateSelection.before;
@ -1529,8 +1524,7 @@ public class APIHelper : IAPIHelper
Dictionary<string, string> getParams = new()
{
{ "limit", post_limit.ToString() },
{ "order", "desc" },
{ "skip_users", "all" }
{ "order", "desc" }
};
var body = await BuildHeaderAndExecuteRequests(getParams, endpoint, GetHttpClient(config));
@ -1846,8 +1840,7 @@ public class APIHelper : IAPIHelper
{ "limit", post_limit.ToString() },
{ "order", "publish_date_desc" },
{ "format", "infinite" },
{ "author", username },
{ "skip_users", "all" }
{ "user_id", username }
};
var body = await BuildHeaderAndExecuteRequests(getParams, endpoint, GetHttpClient(config));

View File

@ -160,7 +160,6 @@ public class Program
hoconConfig.AppendLine($" DownloadDateSelection = \"{jsonConfig.DownloadDateSelection.ToString().ToLower()}\"");
hoconConfig.AppendLine($" CustomDate = \"{jsonConfig.CustomDate?.ToString("yyyy-MM-dd")}\"");
hoconConfig.AppendLine($" ShowScrapeSize = {jsonConfig.ShowScrapeSize.ToString().ToLower()}");
hoconConfig.AppendLine($" DisableTextSanitization = false");
hoconConfig.AppendLine($" DownloadVideoResolution = \"{(jsonConfig.DownloadVideoResolution == VideoResolution.source ? "source" : jsonConfig.DownloadVideoResolution.ToString().TrimStart('_'))}\"");
hoconConfig.AppendLine("}");
@ -248,7 +247,7 @@ public class Program
{
string hoconText = File.ReadAllText("config.conf");
var hoconConfig = ConfigurationFactory.ParseString(hoconText);
var hoconConfig = ConfigurationFactory.ParseString(hoconText);
config = new Entities.Config
{
@ -280,9 +279,7 @@ public class Program
DownloadOnlySpecificDates = hoconConfig.GetBoolean("Download.DownloadOnlySpecificDates"),
DownloadDateSelection = Enum.Parse<DownloadDateSelection>(hoconConfig.GetString("Download.DownloadDateSelection"), true),
CustomDate = !string.IsNullOrWhiteSpace(hoconConfig.GetString("Download.CustomDate")) ? DateTime.Parse(hoconConfig.GetString("Download.CustomDate")) : null,
ShowScrapeSize = hoconConfig.GetBoolean("Download.ShowScrapeSize"),
// Optional flag; default to false when missing
DisableTextSanitization = bool.TryParse(hoconConfig.GetString("Download.DisableTextSanitization", "false"), out var dts) ? dts : false,
ShowScrapeSize = hoconConfig.GetBoolean("Download.ShowScrapeSize"),
DownloadVideoResolution = ParseVideoResolution(hoconConfig.GetString("Download.DownloadVideoResolution", "source")),
// File Settings
@ -347,9 +344,7 @@ public class Program
}
}
levelSwitch.MinimumLevel = (LogEventLevel)config.LoggingLevel; //set the logging level based on config
// Apply text sanitization preference globally
OF_DL.Utils.XmlUtils.Passthrough = config.DisableTextSanitization;
levelSwitch.MinimumLevel = (LogEventLevel)config.LoggingLevel; //set the logging level based on config
Log.Debug("Configuration:");
string configString = JsonConvert.SerializeObject(config, Formatting.Indented);
Log.Debug(configString);
@ -404,11 +399,9 @@ public class Program
hoconConfig.AppendLine($" DownloadOnlySpecificDates = {jsonConfig.DownloadOnlySpecificDates.ToString().ToLower()}");
hoconConfig.AppendLine($" DownloadDateSelection = \"{jsonConfig.DownloadDateSelection.ToString().ToLower()}\"");
hoconConfig.AppendLine($" CustomDate = \"{jsonConfig.CustomDate?.ToString("yyyy-MM-dd")}\"");
hoconConfig.AppendLine($" ShowScrapeSize = {jsonConfig.ShowScrapeSize.ToString().ToLower()}");
// New option defaults to false when converting legacy json
hoconConfig.AppendLine($" DisableTextSanitization = false");
hoconConfig.AppendLine($" DownloadVideoResolution = \"{(jsonConfig.DownloadVideoResolution == VideoResolution.source ? "source" : jsonConfig.DownloadVideoResolution.ToString().TrimStart('_'))}\"");
hoconConfig.AppendLine("}");
hoconConfig.AppendLine($" ShowScrapeSize = {jsonConfig.ShowScrapeSize.ToString().ToLower()}");
hoconConfig.AppendLine($" DownloadVideoResolution = \"{(jsonConfig.DownloadVideoResolution == VideoResolution.source ? "source" : jsonConfig.DownloadVideoResolution.ToString().TrimStart('_'))}\"");
hoconConfig.AppendLine("}");
hoconConfig.AppendLine("# File Settings");
hoconConfig.AppendLine("File {");
@ -1310,7 +1303,7 @@ public class Program
await AnsiConsole.Status()
.StartAsync("[red]Getting Paid Messages[/]", async ctx =>
{
paidMessageCollection = await downloadContext.ApiHelper.GetPaidMessages("/posts/paid/chat", path, user.Key, downloadContext.DownloadConfig!, ctx);
paidMessageCollection = await downloadContext.ApiHelper.GetPaidMessages("/posts/paid", path, user.Key, downloadContext.DownloadConfig!, ctx);
});
int oldPaidMessagesCount = 0;
int newPaidMessagesCount = 0;
@ -1963,7 +1956,7 @@ public class Program
await AnsiConsole.Status()
.StartAsync("[red]Getting Paid Posts[/]", async ctx =>
{
purchasedPosts = await downloadContext.ApiHelper.GetPaidPosts("/posts/paid/post", path, user.Key, downloadContext.DownloadConfig!, paid_post_ids, ctx);
purchasedPosts = await downloadContext.ApiHelper.GetPaidPosts("/posts/paid", path, user.Key, downloadContext.DownloadConfig!, paid_post_ids, ctx);
});
int oldPaidPostCount = 0;
@ -2911,7 +2904,6 @@ public class Program
hoconConfig.AppendLine($" DownloadDateSelection = \"{newConfig.DownloadDateSelection.ToString().ToLower()}\"");
hoconConfig.AppendLine($" CustomDate = \"{newConfig.CustomDate?.ToString("yyyy-MM-dd")}\"");
hoconConfig.AppendLine($" ShowScrapeSize = {newConfig.ShowScrapeSize.ToString().ToLower()}");
hoconConfig.AppendLine($" DisableTextSanitization = {newConfig.DisableTextSanitization.ToString().ToLower()}");
hoconConfig.AppendLine($" DownloadVideoResolution = \"{(newConfig.DownloadVideoResolution == VideoResolution.source ? "source" : newConfig.DownloadVideoResolution.ToString().TrimStart('_'))}\"");
hoconConfig.AppendLine("}");
@ -3071,7 +3063,6 @@ public class Program
hoconConfig.AppendLine($" DownloadDateSelection = \"{newConfig.DownloadDateSelection.ToString().ToLower()}\"");
hoconConfig.AppendLine($" CustomDate = \"{newConfig.CustomDate?.ToString("yyyy-MM-dd")}\"");
hoconConfig.AppendLine($" ShowScrapeSize = {newConfig.ShowScrapeSize.ToString().ToLower()}");
hoconConfig.AppendLine($" DisableTextSanitization = {newConfig.DisableTextSanitization.ToString().ToLower()}");
hoconConfig.AppendLine($" DownloadVideoResolution = \"{(newConfig.DownloadVideoResolution == VideoResolution.source ? "source" : newConfig.DownloadVideoResolution.ToString().TrimStart('_'))}\"");
hoconConfig.AppendLine("}");

View File

@ -9,16 +9,8 @@ namespace OF_DL.Utils
{
internal static class XmlUtils
{
// When true, return original text without parsing/stripping.
public static bool Passthrough { get; set; } = false;
public static string EvaluateInnerText(string xmlValue)
{
if (Passthrough)
{
return xmlValue ?? string.Empty;
}
try
{
var parsedText = XElement.Parse($"<root>{xmlValue}</root>");

View File

@ -2,11 +2,6 @@ site_name: OF-DL Docs
site_url: https://docs.ofdl.tools
nav:
- Home: index.md
- Installation:
- Windows: installation/windows.md
- macOS: installation/macos.md
- Linux: installation/linux.md
- Docker: installation/docker.md
- Running the Program: running-the-program.md
- Config:
- Authentication: config/auth.md
@ -14,6 +9,11 @@ nav:
- Configuration: config/configuration.md
- All Configuration Options: config/all-configuration-options.md
- Custom Filename Formats: config/custom-filename-formats.md
- Installation:
- Windows: installation/windows.md
- macOS: installation/macos.md
- Linux: installation/linux.md
- Docker: installation/docker.md
theme:
name: material
features: