parse_2.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. using dodohold.core;
  2. using System.Text.RegularExpressions;
  3. using System.Diagnostics;
  4. using System.Text.Json;
  5. using TencentCloud.Fmu.V20191213.Models;
  6. using System;
  7. namespace molilian.core
  8. {
  9. public partial class AlimamaPlus
  10. {
  11. public void UnionParse2(string content, ref TkDataDTO result)
  12. {
  13. if ("veapi".Equals(_api) && _api_id > 0)
  14. {
  15. var account = VeapiPoolCore.Get(_api_id);
  16. if (account != null)
  17. {
  18. var core = new VeapiPlus(account.name, account.key, account.sessionKey);
  19. core.UnionParse(content, ref result);
  20. return;
  21. }
  22. }
  23. UnionParse(content, ref result);
  24. }
  25. public async Task<TkDataDTO> UnionParse2Async(string content, TkDataDTO result)
  26. {
  27. if ("veapi".Equals(_api) && _api_id > 0)
  28. {
  29. var account = VeapiPoolCore.Get(_api_id);
  30. if (account != null)
  31. {
  32. var core = new VeapiPlus(account.name, account.key, account.sessionKey);
  33. result = await core.UnionParseAsync(content, result);
  34. return result;
  35. }
  36. }
  37. result = await UnionParseAsync(content, result);
  38. return result;
  39. }
  40. /// <summary>
  41. /// 提取url里面的id参数
  42. /// </summary>
  43. /// <param name="url"></param>
  44. /// <returns></returns>
  45. static string? ExtractItemId(string url)
  46. {
  47. Match match = Regex.Match(url, @"(?:\?|&)id=(\d+)");
  48. if (match.Success)
  49. {
  50. return match.Groups[1].Value;
  51. }
  52. return null;
  53. }
  54. /// <summary>
  55. /// 是否淘宝链接
  56. /// </summary>
  57. /// <param name="url"></param>
  58. /// <returns></returns>
  59. private static (bool, string) IsTaobaoUrl(string url)
  60. {
  61. if (url.Contains("//a.m.taobao.com/i"))
  62. {
  63. //第一种提取方法
  64. string itemId = url.GetContentPart("//a.m.taobao.com/i", ".htm");
  65. if (!string.IsNullOrEmpty(itemId))
  66. {
  67. string resultUrl = $"https://item.taobao.com/item.htm?id={itemId}";
  68. return (true, resultUrl);
  69. }
  70. }
  71. if (url.Contains("//item.taobao.com/item.htm?") ||
  72. url.Contains("//h5.m.taobao.com/awp/core/detail.htm?") ||
  73. url.Contains("//new.m.taobao.com/detail.htm?") ||
  74. url.Contains("//outfliggys.m.taobao.com/app/trip/rx-travel-detail") ||
  75. url.Contains("//detail.m.tmall.com/item.htm?") ||
  76. url.Contains("//tmallx.tmall.com/app/tmallx-src/goods-detail") ||
  77. url.Contains("//detail.tmall.com/item.htm?") ||
  78. url.Contains("//detail.tmall.hk/hk/item.htm?"))
  79. {
  80. string? itemId = ExtractItemId(url);
  81. if (!string.IsNullOrEmpty(itemId))
  82. {
  83. string resultUrl = $"https://item.taobao.com/item.htm?id={itemId}";
  84. return (true, resultUrl);
  85. }
  86. }
  87. return (false, url);
  88. }
  89. /// <summary>
  90. /// 排除已知的淘客链接
  91. /// </summary>
  92. /// <param name="url"></param>
  93. /// <returns></returns>
  94. static bool IsAffLink(string url)
  95. {
  96. if (!url.StartsWith("https://") || !url.StartsWith("https://")) url = "https://" + url;
  97. Uri uri = new(url);
  98. if (uri.Host.Equals("s.click.taobao.com", StringComparison.OrdinalIgnoreCase) ||
  99. uri.Host.Equals("uland.taobao.com", StringComparison.OrdinalIgnoreCase))
  100. {
  101. return true;
  102. }
  103. //if (uri.Host.Equals("m.tb.cn", StringComparison.OrdinalIgnoreCase) &&
  104. // uri.AbsolutePath.StartsWith("/h.") &&
  105. // string.IsNullOrEmpty(uri.Query) && // No query parameters
  106. // !url.Contains("?tk=")) // No "tk" parameter
  107. //{
  108. // return true;
  109. //}
  110. return false;
  111. }
  112. /// <summary>
  113. /// 判断淘客的¥羊角符号
  114. /// </summary>
  115. /// <param name="content"></param>
  116. /// <returns></returns>
  117. static bool ContainsSpecialFormat(string content)
  118. {
  119. // 使用正则表达式匹配内容中是否含有特定格式的字符串
  120. //string pattern = @"¥[a-zA-Z0-9\s]+¥";
  121. string pattern = @"[$¥🗝₴€₤£₳✔《💰🔑🎵✔️💲🔐📲]+[a-zA-Z0-9\s]+[$¥🗝₴€₤£₳✔《💰🔑🎵✔️💲🔐📲]*";
  122. return Regex.IsMatch(content, pattern);
  123. }
  124. /// <summary>
  125. /// 从http获取跳转的url
  126. /// </summary>
  127. /// <param name="url"></param>
  128. /// <returns></returns>
  129. (bool, string) GetDesiredUrl(string url)
  130. {
  131. string result;
  132. try
  133. {
  134. Uri uri = new(url);
  135. if (!uri.Host.Equals("m.tb.cn", StringComparison.OrdinalIgnoreCase)) return (false, "不是淘宝短网址");
  136. string desiredUrlPattern = "var url = '(.*?)'";
  137. WebClientUtility client = new()
  138. {
  139. Proxy = _proxy,
  140. UserAgent = Sayaka.Common.ProviderFakeUserAgent.RandomComputer
  141. };
  142. #if DEBUG
  143. client.Proxy = null;
  144. #else
  145. client.Timeout = TimeSpan.FromMilliseconds(3000);
  146. #endif
  147. var response = client.Request(url);
  148. var responseBody = response.Body();
  149. result = responseBody;
  150. if (response.Successed)
  151. {
  152. if (response.ResponseMessage.IsSuccessStatusCode)
  153. {
  154. Match match = Regex.Match(responseBody, desiredUrlPattern);
  155. if (match.Success)
  156. {
  157. result = match.Groups[1].Value; // 返回匹配的 URL
  158. if (string.IsNullOrEmpty(result)) return (false, "没有匹配的URL");
  159. return (true, result);
  160. }
  161. }
  162. else
  163. {
  164. result = $"{response.ResponseMessage.StatusCode}\n{responseBody}";
  165. }
  166. }
  167. else
  168. {
  169. throw response.ResponseException;
  170. }
  171. }
  172. catch (Exception ex)
  173. {
  174. result = $"{ex.Message}\n{ex.StackTrace}";
  175. }
  176. return (false, result);
  177. }
  178. private (bool, string, LinkTypeEnum, string) InternalTextProcessing(string content)
  179. {
  180. bool success;
  181. string result;
  182. LinkTypeEnum link_type = LinkTypeEnum.unknown;
  183. string url = GetLink(content);
  184. if (!string.IsNullOrEmpty(url))
  185. {
  186. //排除已知的淘客链接
  187. if (IsAffLink(url)) return (false, "排除淘客链接", LinkTypeEnum.other_aff, url);
  188. //直接提取
  189. (success, result) = IsTaobaoUrl(url);
  190. if (success) return (true, result, LinkTypeEnum.goods, result);
  191. //https://uland.taobao.com/coupon/edetail?af=4&e=%2B0aTAvEt16MoRnbUfHBdCarU9683KT3AsB67n92UtFJMmdsrkidbOWBzzpT26idJbwZX%2BHY%2B8QD9zJXNeOSc1euXSPKeLUBBWr02LqsxPV8Bf6pSMNy5GSw6iqMObXLLk3toOSlQXmUUcLJJYP0Uq5lvDADUDTeHRiuxU0i9W%2BtrC8Oh6piEfdwyUIuKQbeM8rUgQejRG616MoRnbUfHBdCarU9683KT3AsB67n92UtFv6uIFQszbmWWPZ8ka7%2BkV5xXydLt%2FcnuZ4%2BBFYnwwiUaCWC3TckcCwMW8xe3XqOGsb8uv9wbhxdkKJ0hxTrTkj7DNgliTXDluAYBRglsbQ%3D%3D&traceId=212cbaa417178512249145009e05a8&union_lens=lensId%3APUB%401717851219%402103c04a_0c89_18ff7e96612_9d39%40031w5YJSc7jl3U7gYjdvuCMM%40eyJmbG9vcklkIjo4NTAvEt16MoRnbUfHBdCarU9683JDaxNfPy83okP3kLScwCkGiuMcyC4PcynGV0YWlsX2h0bSIsInNyY0Zsb29ySWQiiOiiI4MDY3NCIsImNyZWF0aXZpdHlHcm91cElkIjowfQieie%3BtkScm%3AselectionPlaza_site_4358%3Bscm%3A1007.30148.329090.pub_search-item_c02df4bb-631f-4cc1-a9d5-abe802b8e134_&un=bfc196d23e155d289f2917200ca32a93&share_crt_v=1&un_site=0&ut_sk=1.utdid_null_1717851225204.TaoPassword-Outside.lianmeng-app&spm=a2159r.13376465.0.0&sp_tk=d2hLeFdDNHpKb3Y%3D&cpp=1&shareurl=true&short_name=h.gVx6mvI
  192. //从http获取跳转的url
  193. (success, result) = GetDesiredUrl(url);
  194. if (success)
  195. {
  196. //排除已知的淘客链接
  197. if (IsAffLink(result)) return (false, "排除淘客链接", LinkTypeEnum.other_aff, url);
  198. (success, result) = IsTaobaoUrl(result);
  199. if (success) return (true, result, LinkTypeEnum.goods, result);
  200. link_type = GetLinkType(result);
  201. }
  202. else
  203. {
  204. link_type = GetLinkType(url);
  205. }
  206. return (false, result, link_type, url);
  207. }
  208. //判断淘客的¥羊角符号
  209. if (ContainsSpecialFormat(content)) return (false, "排除淘口令", LinkTypeEnum.other_aff, null);
  210. return (false, "纯口令 没链接", link_type, null);
  211. }
  212. private LinkTypeEnum GetLinkType(string url)
  213. {
  214. if (string.IsNullOrEmpty(url)) return LinkTypeEnum.unknown;
  215. if (url.StartsWith("https://huodong.m.taobao.com/act/talent/live.html")) return LinkTypeEnum.live;
  216. if (url.StartsWith("https://web.m.taobao.com/app/tnode/web/index")) return LinkTypeEnum.video;
  217. string pattern = @"^https://shop\d+\.m\.taobao\.com";
  218. if (Regex.IsMatch(url, pattern))
  219. {
  220. return LinkTypeEnum.profile;
  221. }
  222. return LinkTypeEnum.unknown;
  223. }
  224. private void alimamaParse(string content, ref TkDataDTO result)
  225. {
  226. string t = $"{DateTime.Now.Convert2UnixTimestamp(true)}";
  227. Random random = new();
  228. double randomNumber = random.NextDouble();
  229. string randomString = randomNumber.ToString()[2..];
  230. string cna = _cookies.GetContentPart("cna=", ";");
  231. string firstFiveCharacters = cna[..Math.Min(5, cna.Length)];
  232. var variableMap = new
  233. {
  234. url = content,
  235. union_lens = $"b_pvid:a219t._portal_v2_tool_links_page_home_index_htm_{t}_{randomString}_{firstFiveCharacters}",
  236. lensScene = "PUB",
  237. spmB = "_portal_v2_tool_links_page_home_index_htm"
  238. }.Convert2Json(true).UrlEncode();
  239. variableMap = variableMap.Replace(" ", "%20");
  240. string url = "https://pub.alimama.com/openapi/param2/1/gateway.unionpub/xt.entry.json?" +
  241. $"t={t}&_tb_token_={_tb_token}&floorId={_floorId}&refpid={_refpid}&variableMap={variableMap}";
  242. var client = new WebClientUtility().SetContentType("application/json;charset=utf-8")
  243. .AddHeaders("X-Requested-With", "XMLHttpRequest")
  244. .AddHeaders("Cookie", _cookies);
  245. client.Proxy = _proxy;
  246. #if DEBUG
  247. client.Proxy = null;
  248. #endif
  249. if (!string.IsNullOrEmpty(_user_agent)) client.UserAgent = _user_agent;
  250. client.Timeout = TimeSpan.FromMilliseconds(1000);
  251. var response = client.Request(url);
  252. var body = string.Empty;
  253. try
  254. {
  255. if (!response.Successed)
  256. {
  257. result.channel = TkChannelEnum.tb;
  258. result.accountName = _accountName;
  259. result.link_type = LinkTypeEnum.unknown;
  260. result.success = false;
  261. result.message = "fail";
  262. if (response.ResponseException != null)
  263. {
  264. new LoggerLibrary("api_error", "fail")
  265. .Info(response.ResponseException.Message, response.ResponseException.StackTrace)
  266. .Save();
  267. throw response.ResponseException;
  268. }
  269. return;
  270. }
  271. body = response.Body();
  272. JsonElement root = body.Convert2JsonElement();
  273. bool success = root.Read<bool>("success", false);
  274. string message = root.Read("message", string.Empty);
  275. string info_message = root.PathRead("info.message", string.Empty);
  276. if (!string.IsNullOrEmpty(info_message)) message = info_message;
  277. string taoToken = root.PathRead("data.taoToken", string.Empty);
  278. string shortLinkurl = root.PathRead("data.shortLinkurl", string.Empty);
  279. string couponLinkTaoToken = root.PathRead("data.couponLinkTaoToken", string.Empty);
  280. string couponShortLinkUrl = root.PathRead("data.couponShortLinkUrl", string.Empty);
  281. decimal couponAmount = root.PathRead<decimal>("data.couponAmount", 0);
  282. string itemId = root.PathRead("data.itemId", string.Empty);
  283. string itemName = root.PathRead("data.itemName", string.Empty);
  284. decimal promotionPrice = root.PathRead<decimal>("data.promotionPrice", 0);
  285. string sellerNickName = root.PathRead("data.sellerNickName", string.Empty);
  286. string shopTitle = root.PathRead("data.shopTitle", string.Empty);
  287. string pic = root.PathRead("data.pic", string.Empty);
  288. string qrCodeUrl = root.PathRead("data.qrCodeUrl", string.Empty);
  289. if (response.ResponseMessage != null)
  290. {
  291. switch (response.ResponseMessage.StatusCode)
  292. {
  293. case System.Net.HttpStatusCode.OK:
  294. {
  295. if (couponAmount > 0 && !string.IsNullOrEmpty(couponLinkTaoToken) && !string.IsNullOrEmpty(couponShortLinkUrl))
  296. {
  297. taoToken = couponLinkTaoToken;
  298. shortLinkurl = couponShortLinkUrl;
  299. }
  300. string shortLink = GetLink(taoToken);
  301. content = ReplaceUrls(content, shortLink);
  302. }
  303. break;
  304. case System.Net.HttpStatusCode.Found:
  305. string location = response.ResponseMessage.Headers.Location.OriginalString;
  306. if (!string.IsNullOrEmpty(location) && location.Contains("www.alimama.com/member/login.htm"))
  307. {
  308. success = false;
  309. message = "nologin";
  310. }
  311. break;
  312. default:
  313. {
  314. success = false;
  315. message = "other";
  316. }
  317. break;
  318. }
  319. }
  320. if (!success)
  321. {
  322. shortLinkurl = GetLink(content);
  323. switch (message)
  324. {
  325. case "该链接不支持转化,请更换链接尝试":
  326. case "网络错误":
  327. break;
  328. default:
  329. var _headers = response.ResponseMessage.Headers;
  330. var headers = "";
  331. foreach (var h in _headers)
  332. {
  333. foreach (var Value in h.Value)
  334. {
  335. headers += $"{h.Key}: {Value}\n";
  336. }
  337. }
  338. new LoggerLibrary("api_error", "fail")
  339. .Info(message, content)
  340. .Info(headers, body)
  341. .Save();
  342. break;
  343. }
  344. }
  345. string deeplink_url = GetDeeplink(shortLinkurl);
  346. result.channel = TkChannelEnum.tb;
  347. result.accountName = _accountName;
  348. result.link_type = success ? LinkTypeEnum.goods : result.link_type;
  349. result.success = success;
  350. result.message = message;
  351. result.content = content;
  352. result.couponAmount = couponAmount;
  353. result.taoToken = taoToken;
  354. result.shortLinkurl = shortLinkurl;
  355. result.deeplink_url = deeplink_url;
  356. result.itemId = itemId;
  357. result.itemName = itemName;
  358. result.promotionPrice = promotionPrice;
  359. result.sellerNickName = sellerNickName;
  360. result.shopTitle = shopTitle;
  361. result.pic = pic;
  362. result.qrCodeUrl = qrCodeUrl;
  363. }
  364. catch
  365. {
  366. if (response.ResponseMessage?.StatusCode == System.Net.HttpStatusCode.OK)
  367. {
  368. if (body.Contains("<p>抱歉!页面无法访问……</p>"))
  369. {
  370. throw new APIException("抱歉!页面无法访问……");
  371. }
  372. }
  373. throw;
  374. }
  375. }
  376. private async Task<TkDataDTO> alimamaParseAsync(string content, TkDataDTO result)
  377. {
  378. string t = $"{DateTime.Now.Convert2UnixTimestamp(true)}";
  379. Random random = new();
  380. double randomNumber = random.NextDouble();
  381. string randomString = randomNumber.ToString()[2..];
  382. string cna = _cookies.GetContentPart("cna=", ";");
  383. string firstFiveCharacters = cna[..Math.Min(5, cna.Length)];
  384. var variableMap = new
  385. {
  386. url = content,
  387. union_lens = $"b_pvid:a219t._portal_v2_tool_links_page_home_index_htm_{t}_{randomString}_{firstFiveCharacters}",
  388. lensScene = "PUB",
  389. spmB = "_portal_v2_tool_links_page_home_index_htm"
  390. }.Convert2Json(true).UrlEncode();
  391. variableMap = variableMap.Replace(" ", "%20");
  392. string url = "https://pub.alimama.com/openapi/param2/1/gateway.unionpub/xt.entry.json?" +
  393. $"t={t}&_tb_token_={_tb_token}&floorId={_floorId}&refpid={_refpid}&variableMap={variableMap}";
  394. var client = new WebClientUtility().SetContentType("application/json;charset=utf-8")
  395. .AddHeaders("X-Requested-With", "XMLHttpRequest")
  396. .AddHeaders("Cookie", _cookies);
  397. client.Proxy = _proxy;
  398. if (!string.IsNullOrEmpty(_user_agent)) client.UserAgent = _user_agent;
  399. client.Timeout = TimeSpan.FromMilliseconds(1000);
  400. #if DEBUG
  401. client.Proxy = null;
  402. client.Timeout = TimeSpan.FromMilliseconds(10000);
  403. #endif
  404. var response = client.Request(url);
  405. var body = string.Empty;
  406. try
  407. {
  408. if (!response.Successed)
  409. {
  410. result.channel = TkChannelEnum.tb;
  411. result.accountName = _accountName;
  412. result.link_type = LinkTypeEnum.unknown;
  413. result.success = false;
  414. result.message = "fail";
  415. if (response.ResponseException != null)
  416. {
  417. new LoggerLibrary("api_error", "fail")
  418. .Info(response.ResponseException.Message, response.ResponseException.StackTrace)
  419. .Save();
  420. throw response.ResponseException;
  421. }
  422. return result;
  423. }
  424. body = response.Body();
  425. //{"code":601,"info":{"ok":false,"message":"nologin"}}
  426. JsonElement root = body.Convert2JsonElement();
  427. bool success = root.Read<bool>("success", false);
  428. string message = root.Read("message", string.Empty);
  429. string info_message = root.PathRead("info.message", string.Empty);
  430. if (!string.IsNullOrEmpty(info_message)) message = info_message;
  431. string taoToken = root.PathRead("data.taoToken", string.Empty);
  432. string shortLinkurl = root.PathRead("data.shortLinkurl", string.Empty);
  433. string couponLinkTaoToken = root.PathRead("data.couponLinkTaoToken", string.Empty);
  434. string couponShortLinkUrl = root.PathRead("data.couponShortLinkUrl", string.Empty);
  435. decimal couponAmount = root.PathRead<decimal>("data.couponAmount", 0);
  436. string couponEffectiveEndTime = root.PathRead("data.couponEffectiveEndTime", string.Empty);
  437. string couponEffectiveStartTime = root.PathRead("data.couponEffectiveStartTime", string.Empty);
  438. string itemId = root.PathRead("data.itemId", string.Empty);
  439. string itemName = root.PathRead("data.itemName", string.Empty);
  440. decimal promotionPrice = root.PathRead<decimal>("data.promotionPrice", 0);
  441. string sellerNickName = root.PathRead("data.sellerNickName", string.Empty);
  442. string shopTitle = root.PathRead("data.shopTitle", string.Empty);
  443. string pic = root.PathRead("data.pic", string.Empty);
  444. string qrCodeUrl = root.PathRead("data.qrCodeUrl", string.Empty);
  445. if (response.ResponseMessage != null)
  446. {
  447. switch (response.ResponseMessage.StatusCode)
  448. {
  449. case System.Net.HttpStatusCode.OK:
  450. {
  451. if (couponAmount > 0 && !string.IsNullOrEmpty(couponLinkTaoToken) && !string.IsNullOrEmpty(couponShortLinkUrl))
  452. {
  453. taoToken = couponLinkTaoToken;
  454. shortLinkurl = couponShortLinkUrl;
  455. }
  456. string shortLink = GetLink(taoToken);
  457. content = ReplaceUrls(content, shortLink);
  458. }
  459. break;
  460. case System.Net.HttpStatusCode.Found:
  461. string location = response.ResponseMessage.Headers.Location.OriginalString;
  462. if (!string.IsNullOrEmpty(location) && location.Contains("www.alimama.com/member/login.htm"))
  463. {
  464. success = false;
  465. message = "nologin";
  466. }
  467. break;
  468. default:
  469. {
  470. success = false;
  471. message = "other";
  472. }
  473. break;
  474. }
  475. }
  476. if (!success)
  477. {
  478. shortLinkurl = GetLink(content);
  479. switch (message)
  480. {
  481. case "该链接不支持转化,请更换链接尝试":
  482. case "网络错误":
  483. break;
  484. default:
  485. var _headers = response.ResponseMessage.Headers;
  486. var headers = "";
  487. foreach (var h in _headers)
  488. {
  489. foreach (var Value in h.Value)
  490. {
  491. headers += $"{h.Key}: {Value}\n";
  492. }
  493. }
  494. new LoggerLibrary("api_error", "fail")
  495. .Info(message, content)
  496. .Info(headers, body)
  497. .Save();
  498. break;
  499. }
  500. }
  501. string deeplink_url = GetDeeplink(shortLinkurl);
  502. result.channel = TkChannelEnum.tb;
  503. result.accountName = _accountName;
  504. result.link_type = success ? LinkTypeEnum.goods : result.link_type;
  505. result.success = success;
  506. result.message = message;
  507. result.content = content;
  508. result.couponAmount = couponAmount;
  509. result.couponEffectiveEndTime = couponEffectiveEndTime;
  510. result.couponEffectiveStartTime = couponEffectiveStartTime;
  511. result.taoToken = taoToken;
  512. result.shortLinkurl = shortLinkurl;
  513. result.deeplink_url = deeplink_url;
  514. result.itemId = itemId;
  515. result.itemName = success ? itemName : GetTitle(content);
  516. result.promotionPrice = promotionPrice;
  517. result.sellerNickName = sellerNickName;
  518. result.shopTitle = shopTitle;
  519. result.pic = pic;
  520. result.qrCodeUrl = qrCodeUrl;
  521. }
  522. catch
  523. {
  524. if (response.ResponseMessage?.StatusCode == System.Net.HttpStatusCode.OK)
  525. {
  526. if (body.Contains("<p>抱歉!页面无法访问……</p>"))
  527. {
  528. throw new APIException("抱歉!页面无法访问……");
  529. }
  530. }
  531. throw;
  532. }
  533. return result;
  534. }
  535. }
  536. }