DeeplinkParseCore.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. 
  2. using dodohold.core;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Sayaka.Common;
  5. using System.Text.Json;
  6. using System.Text.RegularExpressions;
  7. using System.Web;
  8. namespace molilian.core
  9. {
  10. public partial class DeeplinkParseCore
  11. {
  12. private static string _end_point;
  13. private static readonly string[] separators = ["\r\n", "\n"];
  14. static DeeplinkParseCore()
  15. {
  16. _end_point = Environment.GetEnvironmentVariable("EndPoint");
  17. }
  18. public static DeeplinkParseDataDTO GetFormattedObject(UnionParseRequest request)
  19. {
  20. return new DeeplinkParseDataDTO()
  21. {
  22. message = string.Empty,
  23. success = false,
  24. content = request.Content,
  25. ip = request.Ip,
  26. oaid = request.Oaid,
  27. elapsedTime = 0,
  28. create_time = DateTime.Now,
  29. end_point = _end_point,
  30. };
  31. }
  32. public static async Task<ActionResult> ParseAsync(UnionParseRequest request)
  33. {
  34. var result = GetFormattedObject(request);
  35. request.Content = request.Content.Trim();
  36. var rule = DeeplinkParseRuleCore.GetOne(request.Channel);
  37. if (rule == null)
  38. {
  39. result.success = false;
  40. result.message = "转链失败";
  41. result.reason = "无效平台";
  42. _ = TkLogCore.ParseLogAsync(result);
  43. return new APIResult(new
  44. {
  45. result.success,
  46. result.message,
  47. result.reason,
  48. });
  49. }
  50. result.channel_id = rule.channel_id;
  51. result.channel_name = rule.channel_name;
  52. var overrideContent = await OverrideRuleCore.ProcessAsync(request.Channel, request.Content, request.Ip, request.Oaid, string.Empty, 0, request.SpecialText);
  53. if (overrideContent != null)
  54. {
  55. result.success = true;
  56. result.message = "OK";
  57. result.deeplink_url = overrideContent.output_text;
  58. _ = TkLogCore.ParseLogAsync(result);
  59. return new APIResult(new
  60. {
  61. result.success,
  62. result.message,
  63. channel = result.channel_name,
  64. result.deeplink_url
  65. });
  66. }
  67. if (ShouldIgnoreRequest(rule.IgnorePercentageCity, request.Ip, request.Oaid, out string reason))
  68. {
  69. result.success = false;
  70. result.message = "放弃转链";
  71. result.reason = reason;
  72. _ = TkLogCore.ParseLogAsync(result);
  73. return new APIResult(new
  74. {
  75. result.success,
  76. result.message,
  77. result.reason,
  78. });
  79. }
  80. result = await GenerateDeeplink(request.Content, rule, result);
  81. _ = TkLogCore.ParseLogAsync(result);
  82. return new APIResult(new
  83. {
  84. result.success,
  85. result.message,
  86. channel = result.channel_name,
  87. result.deeplink_url,
  88. result.itemName,
  89. });
  90. }
  91. public static bool ShouldIgnoreRequest(string ignorePercentageCity, string ip, string oaid, out string reason)
  92. {
  93. reason = string.Empty;
  94. try
  95. {
  96. // IP和流量控制
  97. string? ipInfo = IP2RegionPlus.Search(ip);
  98. if (!TestParseCore.InWhitelist(ip, oaid) && AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
  99. {
  100. reason = $"地区控制:{regionInfo}";
  101. return true;
  102. }
  103. }
  104. catch (Exception ex)
  105. {
  106. reason = "配置异常";
  107. }
  108. return false;
  109. }
  110. public static async Task<DeeplinkParseDataDTO> GenerateDeeplink(string text, DeeplinkParseRuleDTO config, DeeplinkParseDataDTO result)
  111. {
  112. try
  113. {
  114. var list = config.rules.Convert2Object<List<DeeplinkParseRule>>();
  115. foreach (var rule in list)
  116. {
  117. var e = await WorkEachRule(text, config, result, rule);
  118. if (e != null) return e;
  119. }
  120. }
  121. catch (Exception ex)
  122. {
  123. }
  124. result.success = false;
  125. return result;
  126. }
  127. private static async Task<DeeplinkParseDataDTO?> WorkEachRule(string text, DeeplinkParseRuleDTO config, DeeplinkParseDataDTO result, DeeplinkParseRule rule)
  128. {
  129. if (!rule.enable) return null;
  130. string content = text;
  131. if (!string.IsNullOrEmpty(rule.url_pattern))
  132. {
  133. var regex = new Regex(rule.url_pattern);
  134. var match = regex.Match(content);
  135. if (!match.Success) return null;
  136. content = match.Groups[1].Value;
  137. }
  138. string url = ToolParsePlus.GetLink(text);
  139. try
  140. {
  141. switch (rule.url_action)
  142. {
  143. case UrlAction.Redirect:
  144. {
  145. var response = await new WebClientUtility
  146. {
  147. Proxy = ProxyNodesCore.RandomOne(),
  148. UserAgent = ProviderFakeUserAgent.RandomMobile,
  149. AllowAutoRedirect = false
  150. }.RequestAsync(url);
  151. if (response.ResponseMessage != null)
  152. {
  153. content = response.ResponseMessage.Headers.Location.ToString();
  154. //content = content.UrlDecode();
  155. }
  156. if (string.IsNullOrEmpty(content)) return null;
  157. }
  158. break;
  159. case UrlAction.Body:
  160. case UrlAction.JsonBody:
  161. {
  162. var client = new WebClientUtility
  163. {
  164. Proxy = ProxyNodesCore.RandomOne(),
  165. UserAgent = ProviderFakeUserAgent.RandomMobile,
  166. AllowAutoRedirect = true
  167. };
  168. if (!string.IsNullOrEmpty(rule.post))
  169. {
  170. string postData = rule.post;
  171. // 使用现有占位符处理逻辑
  172. if (!string.IsNullOrEmpty(rule.url_pattern))
  173. {
  174. var urlRegex = new Regex(rule.url_pattern);
  175. var urlMatch = urlRegex.Match(text);
  176. if (urlMatch.Success)
  177. {
  178. for (var i = 1; i < urlMatch.Groups.Count; i++)
  179. {
  180. string val = urlMatch.Groups[i].Value;
  181. string tempPrompt = string.Empty;
  182. ReplaceProcessing(val, i, rule.replacements, ref postData, ref tempPrompt);
  183. }
  184. }
  185. }
  186. client.Post(postData);
  187. }
  188. //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
  189. //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
  190. var response = await client.RequestAsync(url);
  191. content = response.Body();
  192. if (string.IsNullOrEmpty(content)) return null;
  193. }
  194. break;
  195. case UrlAction.None:
  196. //{
  197. // content = url;
  198. //}
  199. break;
  200. }
  201. }
  202. catch (Exception ex)
  203. {
  204. //Console.WriteLine($"{url}\t{rule.url_action}\t{ex.Message}");
  205. }
  206. if (!string.IsNullOrEmpty(rule.slice_pattern))
  207. {
  208. var regex = new Regex(rule.slice_pattern);
  209. var match = regex.Match(content);
  210. if (!match.Success) return null;
  211. content = match.Groups[1].Value;
  212. }
  213. if (rule.childs.Count > 0)
  214. {
  215. foreach (var sub_rule in rule.childs)
  216. {
  217. var e = await WorkEachRule(content, config, result, sub_rule);
  218. if (e != null) return e;
  219. }
  220. return null;
  221. }
  222. if (!string.IsNullOrEmpty(rule.body_pattern))
  223. {
  224. var regex = new Regex(rule.body_pattern);
  225. var match = regex.Match(content);
  226. if (!match.Success) return null;
  227. }
  228. var deeplink = rule.deeplink_template;
  229. var prompt_text = rule.prompt_text;
  230. try
  231. {
  232. var regex = new Regex(rule.pattern);
  233. var match = regex.Match(content);
  234. if (match.Success)
  235. {
  236. if (rule.resources.Count > 0)
  237. {
  238. foreach (var resource in rule.resources)
  239. {
  240. Dictionary<string, string> resResult = await ResourceProcessing(match, resource, rule.replacements);
  241. foreach (var e in resResult)
  242. {
  243. if (deeplink.Contains(e.Key))
  244. {
  245. deeplink = deeplink.Replace(e.Key, e.Value);
  246. }
  247. }
  248. }
  249. }
  250. if (match.Groups.Count > 1)
  251. {
  252. for (var i = 1; i < match.Groups.Count; i++)
  253. {
  254. string val = match.Groups[i].Value;
  255. switch (rule.plugin)
  256. {
  257. case "redu":
  258. string deeplink_url = await PluginDyParseAsync(text, val, result);
  259. if (!string.IsNullOrEmpty(deeplink_url))
  260. {
  261. result.itemName = prompt_text;
  262. result.deeplink_url = deeplink_url;
  263. result.success = true;
  264. return result;
  265. }
  266. break;
  267. }
  268. ReplaceProcessing(val, i, rule.replacements, ref deeplink, ref prompt_text);
  269. }
  270. if (rule.replace != null && rule.replace.Count > 0)
  271. {
  272. foreach (var r in rule.replace)
  273. {
  274. string key = r[0];
  275. if (string.IsNullOrEmpty(key)) continue;
  276. string val = string.Empty;
  277. if (r.Length > 1)
  278. {
  279. val = r[1];
  280. }
  281. deeplink = Regex.Replace(deeplink, key, val);
  282. }
  283. }
  284. deeplink = Regex.Replace(deeplink, @"\{\d+\}", string.Empty);
  285. prompt_text = Regex.Replace(prompt_text, @"\{\d+\}", string.Empty);
  286. if (!string.IsNullOrEmpty(deeplink))
  287. {
  288. result.deeplink_url = deeplink;
  289. result.itemName = prompt_text;
  290. result.success = true;
  291. return result;
  292. }
  293. }
  294. else
  295. {
  296. result.deeplink_url = deeplink;
  297. result.itemName = prompt_text;
  298. result.success = true;
  299. return result;
  300. }
  301. }
  302. }
  303. catch (Exception ex)
  304. {
  305. Console.WriteLine($"Error processing pattern '{rule.pattern}': {ex.Message}");
  306. }
  307. return null;
  308. }
  309. /// <summary>
  310. /// 占位符的处理
  311. /// </summary>
  312. /// <param name="word"></param>
  313. /// <param name="i"></param>
  314. /// <param name="deeplink"></param>
  315. /// <param name="prompt_text"></param>
  316. private static void ReplaceProcessing(string word, int i, List<ReplacementRule> replacements, ref string deeplink, ref string prompt_text)
  317. {
  318. if (deeplink.Contains("{url:"))
  319. {
  320. string encodedUrl = HttpUtility.UrlEncode(word);
  321. deeplink = deeplink.Replace($"{{url:{i - 1}}}", encodedUrl);
  322. }
  323. if (prompt_text.Contains("{url:"))
  324. {
  325. string encodedUrl = HttpUtility.UrlEncode(word);
  326. prompt_text = prompt_text.Replace($"{{url:{i - 1}}}", encodedUrl);
  327. }
  328. if (deeplink.Contains("{decode:"))
  329. {
  330. string encodedUrl = HttpUtility.UrlDecode(word);
  331. deeplink = deeplink.Replace($"{{decode:{i - 1}}}", encodedUrl);
  332. }
  333. if (prompt_text.Contains("{decode:"))
  334. {
  335. string encodedUrl = HttpUtility.UrlDecode(word);
  336. prompt_text = prompt_text.Replace($"{{decode:{i - 1}}}", encodedUrl);
  337. }
  338. //两次url编码
  339. if (deeplink.Contains("{url2:"))
  340. {
  341. string encodedUrl = HttpUtility.UrlEncode(word);
  342. encodedUrl = HttpUtility.UrlEncode(encodedUrl);
  343. deeplink = deeplink.Replace($"{{url2:{i - 1}}}", encodedUrl);
  344. }
  345. if (prompt_text.Contains("{url2:"))
  346. {
  347. string encodedUrl = HttpUtility.UrlEncode(word);
  348. encodedUrl = HttpUtility.UrlEncode(encodedUrl);
  349. prompt_text = prompt_text.Replace($"{{url2:{i - 1}}}", encodedUrl);
  350. }
  351. //三次url解码
  352. if (deeplink.Contains("{url3:"))
  353. {
  354. string encodedUrl = HttpUtility.UrlEncode(word);
  355. encodedUrl = HttpUtility.UrlEncode(encodedUrl);
  356. deeplink = deeplink.Replace($"{{url3:{i - 1}}}", encodedUrl);
  357. }
  358. if (prompt_text.Contains("{url3:"))
  359. {
  360. string encodedUrl = HttpUtility.UrlEncode(word);
  361. encodedUrl = HttpUtility.UrlEncode(encodedUrl);
  362. prompt_text = prompt_text.Replace($"{{url3:{i - 1}}}", encodedUrl);
  363. }
  364. //atob
  365. if (deeplink.Contains("{atob:"))
  366. {
  367. string encodedUrl = HttpUtility.UrlDecode(word);
  368. deeplink = deeplink.Replace($"{{atob:{i - 1}}}", encodedUrl.FromBase64());
  369. }
  370. if (prompt_text.Contains("{atob:"))
  371. {
  372. string encodedUrl = HttpUtility.UrlDecode(word);
  373. prompt_text = prompt_text.Replace($"{{atob:{i - 1}}}", encodedUrl.FromBase64());
  374. }
  375. //btoa
  376. if (deeplink.Contains("{btoa:"))
  377. {
  378. string encodedUrl = HttpUtility.UrlEncode(word);
  379. deeplink = deeplink.Replace($"{{btoa:{i - 1}}}", word.ToBase64());
  380. }
  381. if (prompt_text.Contains("{btoa:"))
  382. {
  383. string encodedUrl = HttpUtility.UrlEncode(word);
  384. prompt_text = prompt_text.Replace($"{{btoa:{i - 1}}}", word.ToBase64());
  385. }
  386. deeplink = deeplink.Replace($"{{{i - 1}}}", word);
  387. prompt_text = prompt_text.Replace($"{{{i - 1}}}", word);
  388. // 新增 <<>> 格式处理
  389. if (replacements != null)
  390. {
  391. deeplink = Regex.Replace(deeplink, @"<<(\w+):([^>]+)>>", match =>
  392. {
  393. var ruleName = match.Groups[1].Value;
  394. var value = match.Groups[2].Value;
  395. // 查找并应用替换规则
  396. var rule = replacements.FirstOrDefault(r => r.Name == ruleName);
  397. if (rule != null)
  398. {
  399. foreach (var r in rule.Rules)
  400. {
  401. if (r.When.Evaluate(value))
  402. {
  403. return r.Then;
  404. }
  405. }
  406. return rule.Default;
  407. }
  408. return value;
  409. });
  410. prompt_text = Regex.Replace(prompt_text, @"<<(\w+):([^>]+)>>", match =>
  411. {
  412. var ruleName = match.Groups[1].Value;
  413. var value = match.Groups[2].Value;
  414. // 查找并应用替换规则
  415. var rule = replacements.FirstOrDefault(r => r.Name == ruleName);
  416. if (rule != null)
  417. {
  418. foreach (var r in rule.Rules)
  419. {
  420. if (r.When.Evaluate(value))
  421. {
  422. return r.Then;
  423. }
  424. }
  425. return rule.Default;
  426. }
  427. return value;
  428. });
  429. }
  430. // 最后处理普通的索引替换
  431. deeplink = deeplink.Replace($"{{{i - 1}}}", word);
  432. prompt_text = prompt_text.Replace($"{{{i - 1}}}", word);
  433. }
  434. private static async Task<Dictionary<string, string>> ResourceProcessing(Match baseMatch, DeeplinkResources resource, List<ReplacementRule> replacements)
  435. {
  436. Dictionary<string, string> result = new Dictionary<string, string>();
  437. string url = resource.url_pattern;
  438. string prompt_text = string.Empty;
  439. for (var i = 1; i < baseMatch.Groups.Count; i++)
  440. {
  441. string val = baseMatch.Groups[i].Value;
  442. ReplaceProcessing(val, i, replacements, ref url, ref prompt_text);
  443. }
  444. string content = string.Empty;
  445. try
  446. {
  447. switch (resource.url_action)
  448. {
  449. case UrlAction.Redirect:
  450. {
  451. var response = await new WebClientUtility
  452. {
  453. Proxy = ProxyNodesCore.RandomOne(),
  454. UserAgent = ProviderFakeUserAgent.RandomMobile,
  455. AllowAutoRedirect = false
  456. }.RequestAsync(url);
  457. if (response.ResponseMessage != null)
  458. {
  459. content = response.ResponseMessage.Headers.Location.ToString();
  460. content = content.UrlDecode();
  461. }
  462. }
  463. break;
  464. case UrlAction.Body:
  465. case UrlAction.JsonBody:
  466. {
  467. //var response = await new WebClientUtility
  468. //{
  469. // Proxy = ProxyNodesCore.RandomOne(),
  470. // UserAgent = ProviderFakeUserAgent.RandomMobile,
  471. // AllowAutoRedirect = true
  472. //}.RequestAsync(url);
  473. var client = new WebClientUtility
  474. {
  475. Proxy = ProxyNodesCore.RandomOne(),
  476. UserAgent = ProviderFakeUserAgent.RandomMobile,
  477. AllowAutoRedirect = true
  478. };
  479. if (!string.IsNullOrEmpty(resource.post))
  480. {
  481. string postData = resource.post;
  482. // 处理POST数据中的占位符
  483. for (var i = 1; i < baseMatch.Groups.Count; i++)
  484. {
  485. string val = baseMatch.Groups[i].Value;
  486. ReplaceProcessing(val, i, replacements, ref postData, ref prompt_text);
  487. }
  488. client.Post(postData);
  489. }
  490. var response = await client.RequestAsync(url);
  491. content = response.Body();
  492. }
  493. break;
  494. case UrlAction.None:
  495. //{
  496. // content = url;
  497. //}
  498. break;
  499. }
  500. }
  501. catch (Exception ex)
  502. {
  503. //Console.WriteLine($"{url}\t{rule.url_action}\t{ex.Message}");
  504. }
  505. if (string.IsNullOrEmpty(content)) { return result; }
  506. try
  507. {
  508. JsonElement root = default;
  509. if (UrlAction.JsonBody.Equals(resource.url_action))
  510. {
  511. root = content.Convert2JsonElement();
  512. }
  513. for (int i = 0; i < resource.pattern.Count; i++)
  514. {
  515. string val = string.Empty;
  516. if (UrlAction.JsonBody.Equals(resource.url_action))
  517. {
  518. val = root.PathRead(resource.pattern[i], string.Empty);
  519. }
  520. else
  521. {
  522. var regex = new Regex(resource.pattern[i]);
  523. var match = regex.Match(content);
  524. if (match.Success)
  525. {
  526. val = match.Groups[1].Value;
  527. }
  528. }
  529. string key = $"{{{i}@{resource.name}}}";
  530. result.Add(key, val);
  531. }
  532. }
  533. catch (Exception ex) { }
  534. return result;
  535. }
  536. public static async Task<string> PluginDyParseAsync(string content, string matchText, DeeplinkParseDataDTO deeplinkResult, CancellationToken cancellationToken = default)
  537. {
  538. string ip = deeplinkResult.ip;
  539. string oaid = deeplinkResult.oaid;
  540. var result = DyUnionPlus.GetFormattedObject(content, ip, oaid);
  541. result.create_time = deeplinkResult.create_time;
  542. result.rawContent = content;
  543. bool IfExceptional = false;
  544. try
  545. {
  546. if (DyUnionPlus.ShouldIgnoreRequest(ip, oaid, out string reason))
  547. {
  548. result.success = false;
  549. result.message = "放弃转链";
  550. result.reason = reason;
  551. _ = TkLogCore.ParseLogAsync(result);
  552. return null;
  553. }
  554. var account = ReduPoolCore.GetOne();
  555. if (account == null)
  556. {
  557. result.success = false;
  558. result.message = "放弃转链";
  559. result.reason = "没有匹配账号";
  560. _ = TkLogCore.ParseLogAsync(result);
  561. return null;
  562. }
  563. var now = DateTime.Now;
  564. var ts2 = now - result.create_time;
  565. result.elapsedTime2 = (int)ts2.TotalMilliseconds;
  566. result = await DyUnionPlus.DyParseAsync(account, matchText, result, cancellationToken);
  567. switch (oaid)
  568. {
  569. case "3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2":
  570. case "6D5D56F3073844F2912B4552CEDF9E3BEC7D424979CC9C51C5461106F1915660":
  571. case "4CA55979100C4B5BAAA2AF4ABE15C360602e915cedae5786405419ccc9f4e3f8":
  572. break;
  573. default:
  574. result.deeplink_url = result.deeplink_url.Replace("snssdk1128://", "snssdk561124://");
  575. break;
  576. }
  577. var ts3 = DateTime.Now - now;
  578. result.elapsedTime3 = (int)ts3.TotalMilliseconds;
  579. }
  580. catch (Exception ex)
  581. {
  582. if (ex.Message.Contains("was canceled"))
  583. {
  584. result.success = false;
  585. result.message = "放弃转链";
  586. result.reason = "请求超时";
  587. }
  588. else
  589. {
  590. IfExceptional = true;
  591. _ = new LoggerLibrary("unionParse", "dy_error")
  592. .Info(ip, oaid)
  593. .Info(content)
  594. .Info(ex.Message, ex.StackTrace)
  595. .SaveAsync();
  596. NotifyCore.Notify(new NifyMessage
  597. {
  598. message = $"【转链异常DY】\n{content}\n\n{ex.Message}\n{ex.StackTrace}",
  599. priority = NifyMessagePriority.high,
  600. tags = ["red_circle"]
  601. });
  602. result.success = false;
  603. result.message = "内部错误";
  604. result.reason = "转链接口异常";
  605. }
  606. }
  607. _ = TkLogCore.ParseLogAsync(result);
  608. return result.deeplink_url;
  609. }
  610. }
  611. }