diff --git a/OF DL/Program.cs b/OF DL/Program.cs index 20d3197..20f0783 100644 --- a/OF DL/Program.cs +++ b/OF DL/Program.cs @@ -213,6 +213,9 @@ public async static Task Main(string[] args) Environment.Exit(2); } + //Added to stop cookie being filled with un-needed headers + ValidateCookieString(); + if (File.Exists("rules.json")) { AnsiConsole.Markup("[green]rules.json located successfully!\n[/]"); @@ -2562,4 +2565,24 @@ static ProgressColumn[] GetProgressColumns(bool showScrapeSize) } return null; } + + public static void ValidateCookieString() + { + string pattern = @"(auth_id=\d+)|(sess=[^;]+)"; + var matches = Regex.Matches(auth.COOKIE, pattern); + + string output = string.Join("; ", matches); + + if (!output.EndsWith(";")) + { + output += ";"; + } + + if(auth.COOKIE.Trim() != output.Trim()) + { + auth.COOKIE = output; + string newAuthString = JsonConvert.SerializeObject(auth, Formatting.Indented); + File.WriteAllText("auth.json", newAuthString); + } + } }