|
@@ -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);
|
|
|
|
|
|