Browse Source

除了jd dp的getlink兼容

dodo hold 9 months ago
parent
commit
cade601d60

File diff suppressed because it is too large
+ 0 - 0
molilian.api/Properties/PublishProfiles/latest.pubxml.user


+ 3 - 3
molilian.core/Core/taoke/UnionParseCore/dp2dp.cs

@@ -803,7 +803,7 @@ namespace molilian.core
         private static ParseDeeplinkResust parseJdDeeplinkInput(string content)
         private static ParseDeeplinkResust parseJdDeeplinkInput(string content)
         {
         {
             ParseDeeplinkResust resust = new();
             ParseDeeplinkResust resust = new();
-            if (!content.StartsWith("openapp.jdmobile://"))
+            if (!content.StartsWith("openapp.jdmobile://")&& !content.StartsWith("openjd://"))
             {
             {
                 resust.success = false;
                 resust.success = false;
                 resust.reason = "不是有效DP";
                 resust.reason = "不是有效DP";
@@ -932,11 +932,11 @@ tbopen://m.taobao.com/tbopen/index.html?h5Url=https%3A%2F%2Fku.m.taobao.com%2Fmi
             {
             {
                 url = content.GetContentPart("h5Url=", "");
                 url = content.GetContentPart("h5Url=", "");
             }
             }
-            if (url.StartsWith("https%253A"))
+            if (url.ToLower().StartsWith("https%253a") || url.ToLower().StartsWith("http%253a"))
             {
             {
                 url = url.UrlDecode().UrlDecode();
                 url = url.UrlDecode().UrlDecode();
             }
             }
-            if (url.StartsWith("https%253A"))
+            if (url.ToLower().StartsWith("https%3a") || url.ToLower().StartsWith("http%3a"))
             {
             {
                 url = url.UrlDecode();
                 url = url.UrlDecode();
             }
             }

+ 29 - 0
molilian.core/Plus/JDUnion/JdUnionPlus.cs

@@ -32,6 +32,35 @@ namespace molilian.core
             if (string.IsNullOrEmpty(content)) return content;
             if (string.IsNullOrEmpty(content)) return content;
             string result = content;
             string result = content;
             //string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
             //string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+
+            //openjd://virtual?params={%22category%22:%22jump%22,%20%22des%22:%22m%22,%20%22url%22:%22https://item.m.jd.com/product/10197819484796.html%22}
+            //openapp.jdmobile://virtual?params={%22category%22:%22jump%22,%20%22des%22:%22m%22,%20%22url%22:%22https://item.m.jd.com/product/10197819484796.html%22}
+
+            // 处理 openjd:// 和 openapp.jdmobile:// 格式的 deeplink
+            if (content.StartsWith("openjd://virtual?params=") || content.StartsWith("openapp.jdmobile://virtual?params="))
+            {
+                try
+                {
+                    string paramsStr = content.GetContentPart("params={", "}");
+                    if (!string.IsNullOrEmpty(paramsStr))
+                    {
+                        paramsStr = $"{{{paramsStr}}}";
+                        string decodedParams = HttpUtility.UrlDecode(paramsStr);
+
+                        // 使用正则提取 "url" 字段的值
+                        var urlMatch = Regex.Match(decodedParams, @"""url""\s*:\s*""([^""]+)""");
+                        if (urlMatch.Success)
+                        {
+                            return urlMatch.Groups[1].Value;
+                        }
+                    }
+                }
+                catch
+                {
+                    // 如果解析失败,继续使用默认逻辑
+                }
+            }
+
             Regex regex = new(AlimamaPlus._url_pattern);
             Regex regex = new(AlimamaPlus._url_pattern);
             MatchCollection matches = regex.Matches(content);
             MatchCollection matches = regex.Matches(content);
 
 

Some files were not shown because too many files changed in this diff