Sfoglia il codice sorgente

0913修复正则处理

dodo hold 11 mesi fa
parent
commit
f006c38167

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


+ 2 - 2
molilian.api/Properties/launchSettings.json

@@ -4,7 +4,7 @@
       "commandName": "Project",
       "launchBrowser": true,
       "launchUrl": "swagger",
-      "environmentVariables": {
+      "environmentVariable2s": {
         "ASPNETCORE_ENVIRONMENT": "Development",
         "EndPoint": "coupon",
         "NtfyServer": "https://ntfy.yunhui800.com/vozQub8a78ABLqqY",
@@ -16,7 +16,7 @@
         "CenterDB": "",
         "CenterRedis": ""
       },
-      "environmentVariables2": {
+      "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development",
         "EndPoint": "bj",
         "NtfyServer": "https://ntfy.yunhui800.com/5Sq9BytXXM5WDY3G",

+ 2 - 5
molilian.core/Core/taoke/UnionParseCore/UnionParseCore.cs

@@ -27,8 +27,8 @@ namespace molilian.core
 
             return channel switch
             {
-                "wemeet" => await WemeetParseAsync(content, ip, oaid),
-                "bdpan" => await PanParseAsync(content, ip, oaid),
+                //"wemeet" => await WemeetParseAsync(content, ip, oaid),
+                //"bdpan" => await PanParseAsync(content, ip, oaid),
                 "jd" => await JdParseAsync(content, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId),
                 "ks" => await KsParseAsync(content, commerceType, ip, oaid, accountid),
                 "dy" => await DyParseAsync(content, commerceType, ip, oaid),
@@ -37,11 +37,8 @@ namespace molilian.core
                 _ => await DeeplinkParseCore.ParseAsync(content, channel, ip, oaid),
             };
         }
-
         //return await DeeplinkParseCore.ParseAsync(content, channel, ip, oaid);
 
-
-
         public static async Task<APIResult> WemeetParseAsync(string content, string ip, string oaid)
         {
             var result = ToolParsePlus.GetFormattedObject(TkChannelEnum.wemeet, content, ip, oaid);

+ 52 - 6
molilian.core/Core/tool/DeeplinkParseCore.cs

@@ -161,19 +161,47 @@ namespace molilian.core
                             if (response.ResponseMessage != null)
                             {
                                 content = response.ResponseMessage.Headers.Location.ToString();
-                                content = content.UrlDecode();
+                                //content = content.UrlDecode();
                             }
+                            if (string.IsNullOrEmpty(content)) return null;
                         }
                         break;
                     case UrlAction.Body:
                         {
-                            var response = await new WebClientUtility
+                            var client = new WebClientUtility
                             {
                                 Proxy = ProxyNodesCore.RandomOne(),
                                 UserAgent = ProviderFakeUserAgent.RandomMobile,
                                 AllowAutoRedirect = true
-                            }.RequestAsync(url);
+                            };
+                            if (!string.IsNullOrEmpty(rule.post))
+                            {
+                                string postData = rule.post;
+                                // 使用现有占位符处理逻辑
+                                if (!string.IsNullOrEmpty(rule.url_pattern))
+                                {
+                                    var urlRegex = new Regex(rule.url_pattern);
+                                    var urlMatch = urlRegex.Match(text);
+                                    if (urlMatch.Success)
+                                    {
+                                        for (var i = 1; i < urlMatch.Groups.Count; i++)
+                                        {
+                                            string val = urlMatch.Groups[i].Value;
+                                            string tempPrompt = string.Empty;
+                                            ReplaceProcessing(val, i, rule.replacements, ref postData, ref tempPrompt);
+                                        }
+                                    }
+                                }
+                                client.Post(postData);
+                            }
+                            //https://weitoutiao.zjurl.cn/tt_living/?app=news_article&module_name=Android_tt_url&room_id=MDUEDEq2rcgYaV8/SarVCgQTTv3vQwSt/yRnpWHHMzSd1LxjfgQQXTdEOrBDTfdJCzQ+vyO1aQ==&share_did=MS4wLjACAAAASvJER5nlmrwCRfsC2t661YpMGJbq2HtGQS31wppWCCm_j6e1qZ7w9bp94n9T6Ouq&share_token=99222dee-be68-4f79-af9e-c32eff162ea8&share_uid=MS4wLjABAAAA9PBhcsrMuvXb3-0VPXN47TT4TKDHqiZR-LCS4B2BodaRdd7OHm7rl1Xx3SxlLrbn&timestamp=1756194703&tt_from=copy_link&upstream_biz=client_share&utm_campaign=client_share&utm_medium=toutiao_android&utm_source=copy_link
+                            //https://weitoutiao.zjurl.cn/tt_living/?app=news_article&module_name=Android_tt_url&room_id=MDUEDEq2rcgYaV8%2FSarVCgQTTv3vQwSt%2FyRnpWHHMzSd1LxjfgQQXTdEOrBDTfdJCzQ%2BvyO1aQ%3D%3D&share_did=MS4wLjACAAAASvJER5nlmrwCRfsC2t661YpMGJbq2HtGQS31wppWCCm_j6e1qZ7w9bp94n9T6Ouq&share_token=99222dee-be68-4f79-af9e-c32eff162ea8&share_uid=MS4wLjABAAAA9PBhcsrMuvXb3-0VPXN47TT4TKDHqiZR-LCS4B2BodaRdd7OHm7rl1Xx3SxlLrbn&timestamp=1756194703&tt_from=copy_link&upstream_biz=client_share&utm_campaign=client_share&utm_medium=toutiao_android&utm_source=copy_link
+
+
+                            var response = await client.RequestAsync(url);
+
                             content = response.Body();
+                            if (string.IsNullOrEmpty(content)) return null;
                         }
                         break;
                     case UrlAction.None:
@@ -472,12 +500,31 @@ namespace molilian.core
                     case UrlAction.Body:
                     case UrlAction.JsonBody:
                         {
-                            var response = await new WebClientUtility
+                            //var response = await new WebClientUtility
+                            //{
+                            //    Proxy = ProxyNodesCore.RandomOne(),
+                            //    UserAgent = ProviderFakeUserAgent.RandomMobile,
+                            //    AllowAutoRedirect = true
+                            //}.RequestAsync(url);
+
+                            var client = new WebClientUtility
                             {
                                 Proxy = ProxyNodesCore.RandomOne(),
                                 UserAgent = ProviderFakeUserAgent.RandomMobile,
                                 AllowAutoRedirect = true
-                            }.RequestAsync(url);
+                            };
+                            if (!string.IsNullOrEmpty(resource.post))
+                            {
+                                string postData = resource.post;
+                                // 处理POST数据中的占位符
+                                for (var i = 1; i < baseMatch.Groups.Count; i++)
+                                {
+                                    string val = baseMatch.Groups[i].Value;
+                                    ReplaceProcessing(val, i, replacements, ref postData, ref prompt_text);
+                                }
+                                client.Post(postData);
+                            }
+                            var response = await client.RequestAsync(url);
                             content = response.Body();
                         }
                         break;
@@ -613,5 +660,4 @@ namespace molilian.core
         }
 
     }
-
 }

+ 3 - 1
molilian.core/Core/tool/TestParseCore.cs

@@ -7,7 +7,9 @@ namespace molilian.core
             "C712574A37194CC8AA2C94F4E94BF632069e05173327fe9168cc3829a5a22820",
             "E5519EE0E4724362BD71D42F8D5CD0200b57296c00ba6e16d2b0ff67abb97a87",
             "8E61FDE9411443F9A3642A6ACAD42747EC7D424979CC9C51CB1670D630EE7D8F",
-            "FF29AB4ECA4E42A7A4E90DD266AE7B94c4e39ff01b38641d1738a7d57e83511b"
+            //capi
+            "FF29AB4ECA4E42A7A4E90DD266AE7B94c4e39ff01b38641d1738a7d57e83511b",
+            "C3516876C271412593EE38CC2FC23F453cd4f48566c73a32f0f45ca37556b3bd"
             ];
 
         public static bool InWhitelist(string ip, string oaid)

+ 2 - 0
molilian.core/DTO/deeplink/DeeplinkParseRuleDTO.cs

@@ -54,6 +54,7 @@ namespace molilian.core
         public string body_pattern { get; set; } = string.Empty;
         public string url_pattern { get; set; } = string.Empty;
         public string pattern { get; set; } = string.Empty;
+        public string post { get; set; } = string.Empty;
         public string plugin { get; set; } = string.Empty;
         public List<string[]> replace { get; set; } = new();
         public string deeplink_template { get; set; } = string.Empty;
@@ -80,6 +81,7 @@ namespace molilian.core
     public class DeeplinkResources
     {
         public string name { get; set; } = string.Empty;
+        public string post { get; set; } = string.Empty;
         public string url_pattern { get; set; } = string.Empty;
         public UrlAction url_action { get; set; } = UrlAction.None;
         public List<string> pattern { get; set; } = [];

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