using Api.Framework.Cps; using CsharpHttpHelper; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Web; using static Api.Framework.Tools.TBHelper; namespace Api.Framework.Tools { /// /// h5 /// public class h5Top { #region h5Top Code private string _cookies = string.Empty; private string Cookies { get { if (string.IsNullOrEmpty(_cookies)) { HttpHelper http = new HttpHelper(); string _m_h5_tk, t, reCookie = ""; var referer = "https://www.taobao.com"; var api = "com.taobao.redbull.getpassworddetail"; if (string.IsNullOrEmpty(_cookies)) { var tempUrl = $"https://api.m.taobao.com/h5/{api}/1.0/?appKey={appKey}&api={api}&v=1.0&t=&sign="; string cookies = http.GetHtml(new HttpItem() { URL = tempUrl }).Cookie; _cookies = HttpHelper.GetSmallCookie(cookies); } } return _cookies; } set { _cookies = value; } } const string appKey = "12574478"; public static string GetCookiesValue(string key, string cookies) { if (string.IsNullOrEmpty(cookies)) return string.Empty; string[] tempCookies = cookies.Split(';'); foreach (var item in tempCookies) { string[] tempCookie = item.Split('='); if (tempCookie.Length == 2) { if (tempCookie[0].Trim() == key) { return tempCookie[1].Split('_')[0]; } } } return string.Empty; } private static string GetbyteToString(byte[] data) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.Length; i++) { sb.Append(data[i].ToString("x2")); } return sb.ToString(); } private static string GetMD5String(string str) { MD5 md5 = MD5.Create(); byte[] data = Encoding.UTF8.GetBytes(str); byte[] data2 = md5.ComputeHash(data); return GetbyteToString(data2); //return BitConverter.ToString(data2).Replace("-", "").ToLower(); } public Dictionary M_GET(string api, object data, string version = "1.0") { int number = 3; Next: number--; string time = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000).ToString(); string mh5Tk = GetCookiesValue("_m_h5_tk", Cookies); mh5Tk = string.IsNullOrEmpty(mh5Tk) ? "f64aa152f943661f750e6212ebc98804_1481170439770" : mh5Tk; string json = (data.GetType() == typeof(string)) ? data.ToString() : HttpHelper.ObjectToJson(data).Replace("\\u0026", "&"); string temp_ = mh5Tk + "&" + time + "&" + appKey + "&" + json; string sign = GetMD5String(temp_); ; string send = HttpHelper.URLEncode(json); string temp = string.Format("http://api.m.taobao.com/h5/{5}/{4}/?v={4}&api={5}&appKey={0}&t={1}&callback=mtopjsonp1&type=jsonp&sign={2}&data={3}", appKey, time, sign, send, version, api); string html = string.Empty; //if (api == "mtop.taobao.baichuan.smb.get") if (api.StartsWith("mtop") || api == "mtop.alimama.union.xt.biz.quan.api.entry" || api == "mtop.taobao.sharepassword.querypassword") { //temp = $"https://h5api.m.taobao.com/h5/{api}/{version}/?jsv=2.4.0&appKey={appKey}&t={time}&sign={sign}&api={api}&v={version}&type=originaljson&dataType=jsonp&timeout=10000"; temp = $"https://h5api.m.taobao.com/h5/{api}/{version}/?jsv=2.4.0&appKey={appKey}&t={time}&sign={sign}&api={api}&v={version}&timeout=20000&AntiCreep=true&AntiFlood=true&type=jsonp&dataType=jsonp&callback=mtopjsonp2&data={send}"; //html = M_POST_HTML(temp, "data=" + send); html = M_GET_HTML(temp).Trim(); //Console.WriteLine(html); } else html = M_GET_HTML(temp).Trim(); //https://h5api.m.taobao.com/h5/mtop.taobao.baichuan.smb.get/1.0/?jsv=2.4.0&appKey=12574478&t=1580101872147&sign=0d0cd5819f67b6568a77de5867f151f9&api=mtop.taobao.baichuan.smb.get&v=1.0&type=originaljson&dataType=jsonp&timeout=10000 if (html.Contains("FAIL_SYS") || string.IsNullOrEmpty(html)) { //if(!html.Contains("非法请求")) _cookies = string.Empty; if (number >= 0) { //System.Threading.Thread.Sleep(10); goto Next; } } //Console.WriteLine(html); if (html.Contains("SUCCESS::")) { Dictionary json_rst = null; var reg = System.Text.RegularExpressions.Regex.Match(html, @"^mtopjsonp\d\((.*?)\)$", System.Text.RegularExpressions.RegexOptions.IgnoreCase); if (reg.Success) json_rst = HttpExtend.JsonToDictionary(reg.Groups[1].Value); else json_rst = HttpExtend.JsonToDictionary(html); if (json_rst != null && json_rst.ContainsKey("data")) return json_rst["data"] as Dictionary; } throw new Exception(html); } private string M_POST_HTML(string tempUrl, string data) { try { HttpItem item = new HttpItem() { URL = tempUrl,//URL 必需项 Method = "post",//URL 可选项 默认为Get IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写 Cookie = Cookies + ";random=" + new Random().Next(),//字符串Cookie 可选项 Postdata = data, Referer = tempUrl,//来源URL 可选项 Timeout = 3000,//连接超时时间 可选项默认为100000 ReadWriteTimeout = 3000,//写入Post数据超时时间 可选项默认为30000 UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值 ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值 Allowautoredirect = false,//是否根据301跳转 可选项 }; HttpHelper http = new HttpHelper(); HttpResult result = http.GetHtml(item); string html = result.Html; //Console.WriteLine(html); if (!string.IsNullOrEmpty(result.Cookie)) { this.Cookies = result.UpdateCookies(this.Cookies); } return html; } catch (Exception ex) { return string.Empty; } } private string M_GET_HTML(string tempUrl) { try { HttpItem item = new HttpItem() { URL = tempUrl,//URL 必需项 Method = "get",//URL 可选项 默认为Get IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写 Cookie = Cookies + ";random=" + new Random().Next(),//字符串Cookie 可选项 Referer = "http://m.taobao.com",//来源URL 可选项 Timeout = 3000,//连接超时时间 可选项默认为100000 ReadWriteTimeout = 3000,//写入Post数据超时时间 可选项默认为30000 UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值 ContentType = "text/html",//返回类型 可选项有默认值 Allowautoredirect = false,//是否根据301跳转 可选项 }; HttpHelper http = new HttpHelper(); HttpResult result = http.GetHtml(item); string html = result.Html; if (!string.IsNullOrEmpty(result.Cookie)) { this.Cookies = result.UpdateCookies(this.Cookies); } return html; } catch (Exception ex) { return string.Empty; } } #endregion /// /// 优惠券activityId /// public string activityId = string.Empty; public Dictionary CreateTaopass(string text, string url, string pic) { return M_GET("mtop.taobao.sharepassword.genpasswordh5", new { url = url, picUrl = pic, passwordType = "tao", sourceType = "other", title = text, bizId = "windvane" }, "1.0"); } public Dictionary GetMobileTaobao(string api, object data, string v, string method = "get") { var http = new HttpHelper(); var json = HttpHelper.ObjectToJson(data); HttpItem item = null; if (method == "get") item = http.GetItem($"https://api.m.taobao.com/gw/{api}/{v}/?data={HttpHelper.URLEncode(json, Encoding.UTF8)}"); else item = http.GetItem($"https://api.m.taobao.com/gw/{api}/{v}/", "", $"data={HttpHelper.URLEncode(json, Encoding.UTF8)}"); item.Timeout = 5000; item.ReadWriteTimeout = 5000; item.Header["x-appkey"] = "21380790"; item.Header["x-t"] = HttpExtend.GetTimeStamp(); item.Header["x-pv"] = "5.1"; item.Header["x-sign"] = HttpHelper.ToMD5(Guid.NewGuid().ToString()); item.Header["x-freatures"] = "27"; item.Header["x-location"] = "FE.tfaZtP%2C0p.2o9qse"; item.Header["x-ttid"] = "8Qde5G@taobao_android_6.8.0"; item.Header["x-utdid"] = "2848V9fDrPe03W8H3947j8d0"; item.Header["x-devid"] = "61C70me88jvMe9m9hq2V0QK0677fp5xqEreHzh8Gjt8r"; //if (Consumer != null && !string.IsNullOrEmpty(this.Consumer.Sid)) item.Header["x-sid"] = Consumer.Sid; //if (Consumer != null && !string.IsNullOrEmpty(this.Consumer.Userid)) item.Header["x-uid"] = Consumer.Userid; item.Header["x-uid"] = "0"; var res = http.GetHtml(item); //EventClient.OnEvent("", "h5 =" + res.Html); return HttpExtend.JsonToDictionary(res.Html); } /// /// 解析淘礼金链接 接口H5 /// 阿里妈妈H5接口:mtop.alimama.union.xt.en.api.entry /// https://acs.m.taobao.com/h5/mtop.alimama.union.xt.en.api.entry/1.0/?appKey=12574478&t=1613718293861&sign=0845fffdde5f8421366dde26a971bc26&api=mtop.alimama.union.xt.en.api.entry&v=1.0&data= {"floorId":"32447","variableMap":"{\"vegasCode\":\"S5834VQF\"}"} /// /// /// public Dictionary AnalysisTljUrl(string vegasCode) { try { string cookie = ""; HttpItem item = new HttpItem(); item.URL = "https://acs.m.taobao.com/h5/mtop.alimama.union.xt.en.api.entry/1.0/?jsv=2.3.16&appKey=12574478"; item.Method = "GET"; item.ContentType = "application/x-www-form-urlencoded"; item.Referer = "https://acs.m.taobao.com/h5/mtop.alimama.union.xt.en.api.entry/1.0/?jsv=2.3.16&appKey=12574478"; item.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36"; //item.Header["HOST"] = "acs.m.taobao.com"; item.Host = "acs.m.taobao.com"; item.Accept = "*/*"; item.Header["Accept-Language"] = "zh-cn"; var http = new HttpHelper(); var res = http.GetHtml(item);//这一步的目的是为了获取到_m_h5_tk,这东西是H5端参与sign计算的必要参数,需要跟cookie中的内容相匹配 cookie = res.Cookie; if (cookie.Contains("_m_h5_tk")) { var dataTmp = HttpUtility.UrlDecode($"%20%7B%22floorId%22%3A%2232447%22%2C%22variableMap%22%3A%22%7B%5C%22vegasCode%5C%22%3A%5C%22{vegasCode}%5C%22%7D%22%7D"); var t = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000).ToString(); var cookieArr = cookie.Split(new char[] { ';' }); //cookie2=1cd2e5c403c5dfca032b9747d2617e5a; _m_h5_tk=e1a4e7e0ff871e6513b53a27b72ea630_1613731324324; _m_h5_tk_enc=5c2329cb962340adafb08ff57e836860 var cookie2 = cookieArr.FirstOrDefault(f => f.Contains("cookie2=")); var _m_h5_tk = cookieArr.FirstOrDefault(f => f.Contains("_m_h5_tk=")); var _m_h5_tk_enc = cookieArr.FirstOrDefault(f => f.Contains("_m_h5_tk_enc=")); cookie = $"cookie2={getValue(cookie2, "cookie2")}; _m_h5_tk={getValue(_m_h5_tk, "_m_h5_tk")}; _m_h5_tk_enc={getValue(_m_h5_tk_enc, "_m_h5_tk_enc")}"; var mh5Tk = cookieArr.FirstOrDefault(p => p.Contains("_m_h5_tk") && !p.Contains("_m_h5_tk_enc")); mh5Tk = mh5Tk.Split(new char[] { '=' })[1].Split(new char[] { '_' })[0]; string temp_ = mh5Tk + "&" + t + "&" + "12574478" + "&" + dataTmp; string sign = HttpHelper.ToMD5(temp_).ToLower(); var url = $"https://acs.m.taobao.com/h5/mtop.alimama.union.xt.en.api.entry/1.0/?appKey=12574478&t={t}&sign={sign}&api=mtop.alimama.union.xt.en.api.entry&v=1.0&data=%20%7B%22floorId%22%3A%2232447%22%2C%22variableMap%22%3A%22%7B%5C%22vegasCode%5C%22%3A%5C%22{vegasCode}%5C%22%7D%22%7D"; item.URL = url; item.Referer = url; item.Cookie = cookie; var resHtml = http.GetHtml(item).Html; if (resHtml.Contains("SUCCESS::调用成功")) { var json = HttpExtend.JsonToDictionary(resHtml); return json; } } } catch (Exception ex) { } return null; } private static string getValue(string value, string str) { var reg = Regex.Match(value, str + "=([^;]+)"); if (reg.Success) return reg.Groups[1].Value; return value; } /// /// 通过淘口令获取商品连接 /// /// /// public string GetItemIdByTKL(string password, AlimamaApi api = null) { try { var result = GetPasswordDetail(password); if (result != null && result.Count != 0) { TbAnalysis analysis = new TbAnalysis(); var url = string.Empty; if (result.ContainsKey("url")) url = result["url"].ToString(); else if (result.ContainsKey("origin_url")) url = result["origin_url"].ToString(); if (!url.Contains("taolijin/")) { var item_id = string.Empty; if (url.Contains("uland.taobao")) { var reg = Regex.Match(result["url"].ToString(), @"activityId=(?<活动ID>[A-Za-z0-9]+)"); if (reg.Success) activityId = reg.Groups["活动ID"].Value; } else if (url.Contains("mo.m.tmall.com")) { var http = new HttpHelper(); var html = http.GetHtml(url).Html; var reg = Regex.Match(html, @"itemId: '(\d+)'"); if (reg.Success) { return reg.Groups[1].Value; } } if ((api != null)) { if (result.ContainsKey("picUrl") && !string.IsNullOrWhiteSpace(result["picUrl"]?.ToString())) { item_id = TBHelper.FindTBCouponByItemIdCache(result["picUrl"].ToString()); if (string.IsNullOrWhiteSpace(item_id)) { item_id = analysis.CouponByItemId(result["url"].ToString(), api); if (!string.IsNullOrWhiteSpace(item_id)) TBHelper.SetTBCouponByItemIdCache(result["picUrl"].ToString(), item_id); } else { } } else { item_id = analysis.CouponByItemId(result["url"].ToString(), api); } } else item_id = analysis.FindTbItemIdByStr(result["url"].ToString()); return item_id; } else { return AnalysisItemidByTljUrl(url); } } } catch (Exception ex) { } return string.Empty; } public string AnalysisItemidByTljUrl(string url) { if (url.Contains("taolijin/")) { //https://uland.taobao.com/taolijin/edetail?vegasCode=S5834VQF&type=qtz&union_lens=lensId%3ATAPI%401613722684%4021053dc7_0abe_1778b63dc58_e8c2%40015HKdubJ7xgHNR2jfxmRzMg&un=8a050443537b55c34c6e4bed9157ce66&share_crt_v=1&ut_sk=1.utdid_24551056_1613698636132.TaoPassword-Outside.taoketop&spm=a2159r.13376465.0.0&sp_tk=aHJ6TmN4aWI1Mmg=&bxsign=tcdCOtJHarTrAkacOE_s67gvWJ4eV4ohNoUxtwDdaYDGdQeOcF1Ns4VX1hadXKQHOB6mxPRxtTJhZQn-pWZBiBtZsWVVZJWNRkQHPNmMlgx3Do var reg = Regex.Match(url, @"vegasCode=(?[^&]+)"); if (reg.Success) { var vegasCode = reg.Groups["vegasCode"].Value; var result = AnalysisTljUrl(vegasCode); if (result != null && result.Count != 0) { if (result.ContainsKey("data")) { var data1 = result["data"] as Dictionary; if (data1.ContainsKey("resultList")) { var resultList = data1["resultList"] as ArrayList; if (resultList != null && resultList.Count != 0) { var item = resultList[0] as Dictionary; activityId = item.ContainsKey("couponActivityId") ? item["couponActivityId"].ToString() : string.Empty; return item.ContainsKey("itemId") ? item["itemId"].ToString() : string.Empty; } } } } } } return string.Empty; } /// /// 通过淘宝口令获取信息(返回字典) /// /// /// /// public Dictionary GetPasswordDetail(string password) { //for (int i = 0; i < 3; i++) //{ // try // { // Dictionary result = null; // try // { // TbAnalysis analysis = new TbAnalysis(); // result = M_GET("com.taobao.redbull.getpassworddetail", new { password = password }, "1.0"); // } // catch (Exception ex) // { } // if (result != null && result.Count != 0) // return result; // var _temp = TbTools.SendData("com.taobao.redbull.getpassworddetail", new { password = password }); // if (_temp != null && _temp.ok) // { // if (_temp.message.ToString().Contains("口令不存在")) return new Dictionary(); // return _temp.message as Dictionary; // } // } // catch (Exception ex) // { } // Thread.Sleep(100); //} //return new Dictionary(); for (int i = 0; i < 2; i++) { try { var result = GetMobileTaobao("mtop.taobao.sharepassword.querypassword", new { passwordContent = password }, "1.0"); if (result != null && result.Count != 0) { if (result.ContainsKey("data")) { var data = result["data"] as Dictionary; return data; } } } catch (Exception ex) { } Thread.Sleep(100); } return new Dictionary(); } private static Dictionary error_next = new Dictionary(); //#region 通过优惠券链接获取淘宝宝贝的id ///// ///// 通过优惠券链接获取淘宝宝贝的id ///// ///// //private string CouponByItemId(string url, AlimamaApi api) //{ // try // { // var itemId = FindTbItemIdByStr(url); // if (!string.IsNullOrEmpty(itemId)) return itemId; // if (url.Contains(@"uland.taobao.com/coupon"))//这是针对淘宝联盟有优惠券的接口.//https://uland.taobao.com/coupon/edetail // { // var coupon = api.CheckCoupon(url);//将返利接口转成淘宝宝贝接口 // if (coupon != null) return coupon.itemId; // } // else if (url.Contains(@"s.click.taobao.com"))//这是针对淘宝联盟没有全的接口.//https://s.click.taobao.com/t?e=m // { // var html = string.Empty; // //获得首次Location 地址 // bool first = false; // Next: // string location = GetLocation(url); // if (!string.IsNullOrWhiteSpace(location) && location.StartsWith("https://s.click.taobao.com/t?e=")) // { // var _location = GetLocation(location); // if (!string.IsNullOrEmpty(_location)) location = _location; // } // if (!string.IsNullOrEmpty(location))//跳转地址存在 // { // //if (location.Contains("uland.taobao.com/coupon/edetail?e=")) // if (location.Contains("uland.taobao.com/coupon/edetail?")) // { // string tempHtml = GetHTML(location); // tempHtml = HttpHelper.URLDecode(tempHtml); // var uland = Regex.Match(tempHtml, "&req_url=([^\"]+)"); // if (uland.Success) // { // var param_e = Regex.Match(uland.Groups[1].Value, "e=([^&]+)"); // if (!param_e.Success) return string.Empty; // var coupon = api.CheckCoupon(uland.Groups[1].Value); // if (coupon != null) // return coupon.itemId; // } // else // { // //"系统日志,分析地址失败:" + url;} // } // } // else if (location.Contains("uland.taobao.com")) // { // var _reg = Regex.Match(location, "itemId=(\\d+)", RegexOptions.IgnoreCase); // if (_reg.Success) // return _reg.Groups[1].Value; // } // else if (location.Contains("tu=")) // { // //获得二次访问地址 // string next = HttpHelper.URLDecode(location.Replace("http://s.click.taobao.com/t_js?tu=", "").Replace("https://s.click.taobao.com/t_js?tu=", "")); // html = HttpHelper.URLDecode(GetHTML(next, location)); // var reg = Regex.Match(html, @"(?:&|\?)itemId=(\d+)", RegexOptions.IgnoreCase); // if (reg.Success) // return reg.Groups[1].Value; // } // else // return FindTbItemIdByStr(GetHTML(location)); // } // else if (!string.IsNullOrEmpty(location) && !first) // { // url = location; // first = true; // goto Next; // } // #region // if (string.IsNullOrWhiteSpace(location)) // { // var _html = GetHTML(url); // var reg = Regex.Match(_html, "real_jump_address = '(?<真正的跳转地址>[^']+)"); // if (reg.Success) // { // var address = reg.Groups["真正的跳转地址"].Value; // //_html = GetHTML(HttpHelper.URLDecode(address).Replace("&", "&"), HttpHelper.URLDecode(url)); // _html = GetHTML(address.Replace("&", "&"), url); // itemId = FindTbItemIdByStr(_html); // if (!string.IsNullOrWhiteSpace(itemId)) return itemId; // } // } // #endregion // } // else if (url.Contains("m.tb.cn")) // { // string tempHtml = GetHTML(url); // tempHtml = HttpHelper.URLDecode(tempHtml); // var reg = Regex.Match(tempHtml, "url = '(?<链接>.*?)';"); // if (reg.Success) // { // var _url = reg.Groups["链接"].Value; // _url = HttpHelper.URLDecode(_url); // itemId = FindTbItemIdByStr(_url); // if (!string.IsNullOrWhiteSpace(itemId)) return itemId; // } // } // else if (url.Contains("h5.m.taobao.com")) // { // var _url = HttpHelper.URLDecode(HttpHelper.URLDecode(url)); // itemId = FindTbItemIdByStr(_url); // if (!string.IsNullOrWhiteSpace(itemId)) return itemId; // } // else if (url.Contains("mo.m.tmall.com")) // { // string tempHtml = GetHTML(url); // itemId = FindTbItemIdByStr(tempHtml); // if (!string.IsNullOrWhiteSpace(itemId)) return itemId; // } // else if (url.Contains("uland.taobao")) // { // } // } // catch (Exception ex) // { } // return string.Empty; //} //private string GetLocation(string url) //{ // try // { // HttpHelper http = new HttpHelper(); // HttpItem item = new HttpItem() // { // URL = url, // Method = "get", // IsToLower = false, // Cookie = "", // Referer = "", // Postdata = "", // Timeout = 5000, // ReadWriteTimeout = 15000, // UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER", // ContentType = "application/x-www-form-urlencoded", // Allowautoredirect = false, // ProxyIp = "" // }; // HttpResult result = http.GetHtml(item); // return result.Header.Get("Location"); // } // catch (Exception ex) // { // //EventClient.OnEvent(this, $"Location:{url},{ex.Message},{ex.StackTrace}"); // } // return string.Empty; //} //private string GetHTML(string url, string rf = "", string postData = "") //{ // try // { // HttpHelper http = new HttpHelper(); // HttpItem item = new HttpItem() // { // URL = url, // Method = (postData == "" ? "get" : "post"), // Postdata = (postData == "" ? "" : postData), // IsToLower = false, // Referer = rf, // Timeout = 5000, // ReadWriteTimeout = 15000, // UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER", // ContentType = "application/x-www-form-urlencoded", // Allowautoredirect = true // }; // HttpResult result = http.GetHtml(item); // //var location = result.Header.Get("Location"); // return result.Html; // } // catch (Exception) // { } // return string.Empty; //} ///// ///// 查找宝贝Id的正则表达式 ///// //private string[] Reg_Item_Ids = { @"item[Ii]d=(?\d{5,})", @"item_id=(?\d{5,})", @"\?id=(?\d{5,})", @"&id=(?\d{5,})", @"/i(?\d{5,})", @"num[Ii]id=(?\d{5,})" }; ///// ///// 从字符串中获取淘宝宝贝id ///// ///// 要查找的字符串 ///// 返回查找到的宝贝id,未找到返回空,异常返回异常的信息 //public string FindTbItemIdByStr(string str) //{ // try // { // //获取淘宝天猫的宝贝id值 // for (int i = 0; i < Reg_Item_Ids.Length; i++) // { // var reg = Regex.Match(str, Reg_Item_Ids[i].ToString()); // if (reg.Success) // return reg.Groups["id"].Value; // } // return string.Empty; // } // catch (Exception ex) // { // return string.Empty; // } //} //#endregion } }