From 004575c152fa06f29f38c4193f62c9df0152242f Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sun, 13 Nov 2022 00:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96URL=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs b/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs index 32a27bd..8407334 100644 --- a/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs +++ b/src/N_m3u8DL-RE.Parser/Processor/DefaultUrlProcessor.cs @@ -19,12 +19,13 @@ namespace N_m3u8DL_RE.Parser.Processor if (paserConfig.AppendUrlParams) { var uriFromConfig = new Uri(paserConfig.Url); - var newUri = new Uri(oriUrl); - var newQuery = (newUri.Query.TrimStart('?') + "&" + uriFromConfig.Query.TrimStart('?')).Trim('&'); - if (!oriUrl.Contains(uriFromConfig.Query)) + var oldUri = new Uri(oriUrl); + var newQuery = (oldUri.Query.TrimStart('?') + "&" + uriFromConfig.Query.TrimStart('?')).Trim('&'); + var sameLeft = oldUri.GetLeftPart(UriPartial.Path) == uriFromConfig.GetLeftPart(UriPartial.Path); + if (sameLeft && !oriUrl.Contains(uriFromConfig.Query)) { Logger.Debug("Before: " + oriUrl); - oriUrl = (newUri.GetLeftPart(UriPartial.Path) + "?" + newQuery).TrimEnd('?'); + oriUrl = (oldUri.GetLeftPart(UriPartial.Path) + "?" + newQuery).TrimEnd('?'); Logger.Debug("After: " + oriUrl); } }