diff --git a/src/Jackett/Utils/StringUtil.cs b/src/Jackett/Utils/StringUtil.cs index 0287b5f6a..14979a600 100644 --- a/src/Jackett/Utils/StringUtil.cs +++ b/src/Jackett/Utils/StringUtil.cs @@ -1,6 +1,9 @@ -using System; +using AngleSharp.Dom; +using AngleSharp.Html; +using System; using System.Collections.Generic; using System.Collections.Specialized; +using System.IO; using System.Linq; using System.Net.Http; using System.Security.Cryptography; @@ -76,6 +79,20 @@ namespace Jackett.Utils return string.Join("&", collection.AllKeys.Select(a => a + "=" + HttpUtility.UrlEncode(collection[a], encoding))); } + public static string ToHtmlPretty(this IElement element) + { + if (element == null) + return ""; + + StringBuilder sb = new StringBuilder(); + StringWriter sw = new StringWriter(sb); + var formatter = new PrettyMarkupFormatter(); + element.ToHtml(sw, formatter); + return sb.ToString(); + } + + + public static string GenerateRandom(int length) { var chars = "abcdefghijklmnopqrstuvwxyz0123456789";