From c838e0b08a3c779b2812f60b69911fdd6538f99a Mon Sep 17 00:00:00 2001 From: nilaoda Date: Wed, 20 Jul 2022 15:47:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96`--append-url-params`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Processor/DefaultUrlProcessor.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs b/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs index d0e3ca9..018a7ff 100644 --- a/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs +++ b/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs @@ -10,19 +10,19 @@ using System.Threading.Tasks; namespace N_m3u8DL_RE.Parser.Processor { - public partial class DefaultUrlProcessor : UrlProcessor + public class DefaultUrlProcessor : UrlProcessor { - [RegexGenerator("\\?.*")] - private static partial Regex ParaRegex(); - public override bool CanProcess(ExtractorType extractorType, string oriUrl, ParserConfig paserConfig) => true; public override string Process(string oriUrl, ParserConfig paserConfig) { if (paserConfig.AppendUrlParams) { + var uriFromConfig = new Uri(paserConfig.Url); + var newUri = new Uri(oriUrl); + var newQuery = (newUri.Query.TrimStart('?') + "&" + uriFromConfig.Query.TrimStart('?')).Trim('&'); Logger.Debug("Before: " + oriUrl); - oriUrl += ParaRegex().Match(paserConfig.Url).Value; + oriUrl = (newUri.GetLeftPart(UriPartial.Path) + "?" + newQuery).TrimEnd('?'); Logger.Debug("After: " + oriUrl); }