|
|
@@ -1,4 +1,5 @@
|
|
|
-using dodohold.core;
|
|
|
+using COSXML.Network;
|
|
|
+using dodohold.core;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using System.Diagnostics;
|
|
|
using System.Text.RegularExpressions;
|
|
|
@@ -29,10 +30,10 @@ namespace molilian.core
|
|
|
{
|
|
|
//"wemeet" => await WemeetParseAsync(content, ip, oaid),
|
|
|
//"bdpan" => await PanParseAsync(content, ip, oaid),
|
|
|
- "jd" => await JdParseAsync(content, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId),
|
|
|
+ "jd" => await JdParseAsync(content, type, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId),
|
|
|
"ks" => await KsParseAsync(content, commerceType, ip, oaid, accountid),
|
|
|
"dy" => await DyParseAsync(content, commerceType, ip, oaid),
|
|
|
- "pdd" => await PddParseAsync(content, commerceType, ip, oaid, accountid),
|
|
|
+ "pdd" => await PddParseAsync(content, type, commerceType, ip, oaid, accountid),
|
|
|
"tb" => await TaobaoParseAsync(content, commerceType, ip, oaid, riskStrategy, launchScene, accountid),
|
|
|
_ => await DeeplinkParseCore.ParseAsync(content, channel, ip, oaid),
|
|
|
};
|
|
|
@@ -516,7 +517,7 @@ namespace molilian.core
|
|
|
}, code);
|
|
|
}
|
|
|
|
|
|
- public static async Task<APIResult> JdParseAsync(string content, int commerceType, string ip, string oaid,
|
|
|
+ public static async Task<APIResult> JdParseAsync(string content, string type, int commerceType, string ip, string oaid,
|
|
|
string riskStrategy = "", int launchScene = -1,
|
|
|
int accountid = 0, string clickId = "", CancellationToken cancellationToken = default)
|
|
|
{
|
|
|
@@ -530,9 +531,30 @@ namespace molilian.core
|
|
|
bool is_hide = false;
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
- content = content.UrlDecode();
|
|
|
-
|
|
|
+ switch (type)
|
|
|
+ {
|
|
|
+ case "goods":
|
|
|
+ string pattern = "\\/pages\\/gold\\/item\\/pages\\/detail\\/index[^?]*\\?.*?[&?]sku=(\\d+)";
|
|
|
+ Match match = Regex.Match(content, pattern);
|
|
|
+ if (match.Success)
|
|
|
+ {
|
|
|
+ string goods_id = match.Groups[1].Value; // 返回匹配的 URL
|
|
|
+ if (string.IsNullOrEmpty(goods_id))
|
|
|
+ {
|
|
|
+ result.success = false;
|
|
|
+ result.deeplink_url = string.Empty;
|
|
|
+ result.message = "放弃转链";
|
|
|
+ result.reason = "无效商品ID";
|
|
|
+ _ = TkLogCore.ParseLogAsync(result, is_hide);
|
|
|
+ return JdParseOutput(result);
|
|
|
+ }
|
|
|
+ content = $"https://item.jd.com/{goods_id}.html";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ content = content.UrlDecode();
|
|
|
+ break;
|
|
|
+ }
|
|
|
if (!string.IsNullOrEmpty(config.jd_blacklist_regular))
|
|
|
{
|
|
|
var blacklist = config.jd_blacklist_regular.Split('\n')
|
|
|
@@ -759,11 +781,37 @@ namespace molilian.core
|
|
|
}, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK);
|
|
|
}
|
|
|
|
|
|
- public static async Task<APIResult> PddParseAsync(string content, int commerceType, string ip, string oaid,
|
|
|
+ public static async Task<APIResult> PddParseAsync(string content, string type, int commerceType, string ip, string oaid,
|
|
|
int accountid = 0, CancellationToken cancellationToken = default)
|
|
|
{
|
|
|
var result = PddUnionPlus.GetFormattedObject(content, ip, oaid);
|
|
|
- content = content.UrlDecode();
|
|
|
+
|
|
|
+ switch (type)
|
|
|
+ {
|
|
|
+ case "goods":
|
|
|
+ string pattern = "/package_c\\/goods\\/goods\\.html[^?]*\\?.*?[&?]goods_id=(\\d+)/";
|
|
|
+ Match match = Regex.Match(content, pattern);
|
|
|
+ if (match.Success)
|
|
|
+ {
|
|
|
+ string goods_id = match.Groups[1].Value; // 返回匹配的 URL
|
|
|
+ if (string.IsNullOrEmpty(content))
|
|
|
+ {
|
|
|
+ result.success = false;
|
|
|
+ result.deeplink_url = string.Empty;
|
|
|
+ result.message = "放弃转链";
|
|
|
+ result.reason = "无效商品ID";
|
|
|
+ _ = TkLogCore.ParseLogAsync(result);
|
|
|
+ return PddParseOutput(result);
|
|
|
+ }
|
|
|
+ //https://mobile.yangkeduo.com/goods.html?_wv=41729&_wvx=10&goods_id=665746260825
|
|
|
+ content = $"https://mobile.yangkeduo.com/goods.html?goods_id={goods_id}";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ content = content.UrlDecode();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
result.rawContent = content;
|
|
|
bool IfExceptional = false;
|
|
|
try
|