From 339d5443827ab357485f842be25dd3039f0b0481 Mon Sep 17 00:00:00 2001 From: sim0n00ps Date: Sun, 6 Oct 2024 21:47:56 +0100 Subject: [PATCH] Parse HTML out of custom filenames using text and rawText --- OF DL/Helpers/FileNameHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OF DL/Helpers/FileNameHelper.cs b/OF DL/Helpers/FileNameHelper.cs index 0b620de..2d5a3a9 100644 --- a/OF DL/Helpers/FileNameHelper.cs +++ b/OF DL/Helpers/FileNameHelper.cs @@ -1,3 +1,4 @@ +using HtmlAgilityPack; using OF_DL.Entities; using System; using System.Collections.Generic; @@ -130,7 +131,9 @@ public async Task> GetFilename(object obj1, object ob object propertyValue = property.GetValue(obj1); if (propertyValue != null) { - var str = propertyValue.ToString(); + var pageDoc = new HtmlDocument(); + pageDoc.LoadHtml(propertyValue.ToString()); + var str = pageDoc.DocumentNode.InnerText; if (str.Length > 100) // todo: add length limit to config str = str.Substring(0, 100); values.Add(propertyName, str);