/// <summary> /// 获取淘宝客链接 /// </summary> /// <param name="itemurl">淘宝商品URL</param> /// <param name="adzonid">推广组ID</param> /// <param name="alimamacc">Cookie</param> /// <returns></returns> public static string GetTbkLink(string itemurl, string siteid, string adzoneid, CookieContainer alimamacc) { string tbkLink = ""; CookieCollection ccl = alimamacc.GetCookies(new Uri("http://alimama.com")); string tbtoken = ccl["_tb_token_"].Value; string url = "http://pub.alimama.com/urltrans/urltrans.json?adzoneid=" + adzoneid + "&promotionURL=" + System.Web.HttpUtility.UrlEncode(itemurl); TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1); string ticks = ts.Ticks.ToString().Substring(0, 13); url = "http://pub.alimama.com/urltrans/urltrans.json?siteid=" + siteid + "&adzoneid=" + adzoneid + "&promotionURL=" + System.Web.HttpUtility.UrlEncode(itemurl) + "&t=" + ticks + "&_tb_token_=" + tbtoken + "&_input_charset=utf-8"; string result = HttpHelper1.SendDataByGET(url, ref alimamacc); if (result.Contains("链接不支持转化")) { return("链接不支持转化"); } if (result.Contains("阿里妈妈")) { return("阿里妈妈登录失效"); } if (result.Contains("亲,访问受限了")) { Thread.Sleep(1 * 60 * 1000); GetTbkLink(itemurl, siteid, adzoneid, alimamacc); //访问受限,等待1分钟 } HttpHelper1.GetStringInTwoKeyword(result, ref tbkLink, "shortLinkUrl\":\"", "\"}", 0); return(tbkLink); }
public static string GetCouponInfo(string resulthtml, string itemurl, CookieContainer alimamacc, ref string tbkshortlink) { string pv_id = ""; HttpHelper1.GetStringInTwoKeyword(resulthtml, ref pv_id, "pvid\":\"", "\",\"", 0); string itemid = ""; HttpHelper1.GetStringInTwoKeyword(resulthtml, ref itemid, "auctionId\":", ",\"", 0); CookieCollection ccl = alimamacc.GetCookies(new Uri("http://alimama.com")); string tbtoken = ccl["_tb_token_"].Value; DEWeiboAccount deweiboaccount = WeiboHandler.GetOneAccount(); //高佣搜索,先查看是否有高佣商品链接 string url = "http://pub.alimama.com/common/code/getAuctionCode.json?auctionid=" + itemid + "&adzoneid=" + deweiboaccount.Adzoneid + "&siteid=" + deweiboaccount.Siteid + "&scenes=3&channel=tk_qqhd&t=" + HttpHelper1.GetTicks() + "&_tb_token_=" + tbtoken + "&pvid=" + pv_id; string result = HttpHelper1.SendDataByGET(url, ref alimamacc); if (result.Contains("参数错误")) { url = "http://pub.alimama.com/common/code/getAuctionCode.json?auctionid=" + itemid + "&adzoneid=" + deweiboaccount.Adzoneid + "&siteid=" + deweiboaccount.Siteid + "&scenes=1&t=" + HttpHelper1.GetTicks() + "&_tb_token_=" + tbtoken + "&pvid=" + pv_id + "&yxjh=-1"; result = HttpHelper1.SendDataByGET(url, ref alimamacc); } //正常搜索 string shorturl = ""; HttpHelper1.GetStringInTwoKeyword(result, ref shorturl, "couponShortLinkUrl\":\"", "\",\"qrCodeUrl", 0); HttpHelper1.GetStringInTwoKeyword(result, ref tbkshortlink, "shortLinkUrl\":\"", "\"", 0); return(shorturl); }
public static string AddItemToXuanpinku(string groupid, System.Collections.ArrayList itemids, ref CookieContainer alimamacc) { string result = ""; string url = "http://pub.alimama.com/favorites/item/batchAdd.json"; string tbtoken = Alimama.GetTbToken(alimamacc); string encodeids = ""; for (int i = 0; i < itemids.Count; i++) { if (i + 1 != itemids.Count) { encodeids += itemids[i] + "%2C"; } else { encodeids += itemids[i]; } } string poststr = "groupId=" + groupid + "&itemListStr=" + encodeids + "&t=" + HttpHelper1.GetTicks() + "&_tb_token_=" + tbtoken + "&pvid=10_118.145.0.220_431_1496130793991"; string refer = "http://pub.alimama.com/promo/search/index.htm?q=1&t=" + HttpHelper1.GetTicks(); result = HttpHelper1.SendDataByPost(url, poststr, refer, ref alimamacc); return(result); }
public static string GetBdShortUrl(string url) { string bdshorturl = ""; string bdshortpost = "url=" + url; CookieContainer cc = new CookieContainer(); string shorturlresult = HttpHelper1.SendDataByPost("http://dwz.cn/create.php", bdshortpost, "", ref cc); if (shorturlresult.Contains("0")) { JSONObject shorturljson = JSONConvert.DeserializeObject(shorturlresult); bdshorturl = shorturljson["tinyurl"].ToString(); return(bdshorturl); } while (shorturlresult.Contains("-1")) { Thread.Sleep(10 * 1000); shorturlresult = HttpHelper1.SendDataByPost("http://dwz.cn/create.php", bdshortpost, "", ref cc); JSONObject shorturljson = JSONConvert.DeserializeObject(shorturlresult); if (shorturljson.Count == 1) { continue; } bdshorturl = shorturljson["tinyurl"].ToString(); } return(bdshorturl); }
public static MblogData GetMblogsWithUrl(string url, ref CookieContainer weibocc) { string ss = ""; //string html = HttpHelper1.GetHttpsHtml(url, "", ref ss); CookieCollection ccl = weibocc.GetCookies(new Uri("http://weibo.com")); CookieCollection newccl = ccl; for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "weibo.cn"; } CookieContainer newcc = new CookieContainer(); weibocc.Add(new Uri("http://weibo.cn"), newccl); string html = HttpHelper1.SendDataByGET(url, ref weibocc); if (html.Length < 1000) { for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "sina.com.cn"; } newcc = new CookieContainer(); weibocc.Add(new Uri("http://sina.com.cn"), newccl); string ssourl1 = "http://login.sina.com.cn/sso/login.php?url=http%3A%2F%2Fm.weibo.cn%2F&_rand=" + HttpHelper1.GetTicks() + ".3493&gateway=1&service=sinawap&entry=sinawap&useticket=1&returntype=META&sudaref=&_client_version=0.6.23"; string ssoresult1 = HttpHelper1.SendDataByGET(ssourl1, ref weibocc); string ssourl2 = ""; HttpHelper1.GetStringInTwoKeyword(ssoresult1, ref ssourl2, "arrURL\":[\"", "\"]", 0); ssourl2 = ssourl2.Replace(@"\/", "/"); ssourl2 = ssourl2 + "&callback=sinaSSOController.doCrossDomainCallBack&scriptId=ssoscript0&client=ssologin.js(v1.4.19)&_=" + HttpHelper1.GetTicks(); string ssoresult2 = HttpHelper1.SendDataByGET(ssourl2, ref weibocc); ccl = weibocc.GetCookies(new Uri("http://sina.com.cn")); newccl = ccl; for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "weibo.cn"; } newcc = new CookieContainer(); weibocc.Add(new Uri("http://weibo.cn"), newccl); html = HttpHelper1.SendDataByGET(url, ref weibocc); } for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "weibo.com"; } weibocc.Add(newccl); if (html.Contains("")) { html = html.Replace("page\":null", "page\":1"); } MblogData mbloglist = Newtonsoft.Json.JsonConvert.DeserializeObject <MblogData>(html); return(mbloglist); }
public static string GetDailiIP() { string url = "http://dev.kuaidaili.com/api/getproxy/?orderid=988306037973723&num=1&area=北京&b_pcchrome=1&b_pcie=1&b_pcff=1&protocol=1&method=2&an_an=1&an_ha=1&sp1=1&sep=1"; CookieContainer cc = new CookieContainer(); string result = HttpHelper1.SendDataByGET(url, ref cc); return(result); }
/// <summary> /// 获取店铺热销单品数据 /// </summary> /// <param name="oriMemberId"></param> /// <param name="pv_id"></param> /// <param name="alimamacc"></param> /// <returns></returns> public static AlimamaShopHotData GetShopHotItem(string oriMemberId, string pv_id, CookieContainer alimamacc) { AlimamaShopHotData alimamashophot = new AlimamaShopHotData(); string url = "http://pub.alimama.com/shopdetail/hotProducts.json?sortField=_totalnum&oriMemberId=" + oriMemberId + "&t=" + HttpHelper1.GetTicks() + "&pvid=" + pv_id + "&_tb_token_=" + GetTbToken(alimamacc) + "&_input_charset=utf-8"; string result = HttpHelper1.SendDataByGET(url, ref alimamacc); alimamashophot = Newtonsoft.Json.JsonConvert.DeserializeObject <AlimamaShopHotData>(result); return(alimamashophot); }
/// <summary> /// 阿里妈妈搜索店铺 /// </summary> /// <param name="query"></param> /// <param name="pv_id"></param> /// <param name="alimamacc"></param> /// <returns></returns> public static AlimamaSearchShopData GetSearchData(string query, string pv_id, CookieContainer alimamacc) { AlimamaSearchShopData alimamasearchdata = new AlimamaSearchShopData(); string tbtoken = Alimama.GetTbToken(alimamacc); string url = "http://pub.alimama.com/shopsearch/shopList.json?spm=a2320.7388781.a214tr8.d006.QkMiw1&q=" + HttpUtility.UrlEncode(query) + "&toPage=1&perPagesize=40&t=" + HttpHelper1.GetTicks() + "&pvid=" + pv_id + "&_tb_token_=" + tbtoken + "&_input_charset=utf-8"; string result = HttpHelper1.SendDataByGET(url, ref alimamacc); alimamasearchdata = Newtonsoft.Json.JsonConvert.DeserializeObject <AlimamaSearchShopData>(result); return(alimamasearchdata); }
public static bool TestLogin(CookieContainer cc) { string url = "http://www.weibo.com/"; string strresult = HttpHelper1.SendDataByGET(url, ref cc); if (!strresult.Contains("我的首页")) { return(false); } return(true); }
public static SignalWeiboData GetSignalWeibo(string weibourl) { SignalWeiboData weibo = new SignalWeiboData(); CookieContainer weibocc = new CookieContainer(); string result = HttpHelper1.SendDataByGET(weibourl, ref weibocc); string weibojson = ""; HttpHelper1.GetStringInTwoKeyword(result, ref weibojson, "$render_data = [", "][0] || {};", 0); weibo = Newtonsoft.Json.JsonConvert.DeserializeObject <SignalWeiboData>(weibojson); return(weibo); }
public static bool ApplyCampaign(string campaignid, string keeperid, string pv_id, string refer, CookieContainer alimamacc) { //alimama_searchdata.Data.PageList[0].TkSpecialCampaignIdRateMap string url = "http://pub.alimama.com/pubauc/applyForCommonCampaign.json"; CookieCollection ccl = alimamacc.GetCookies(new Uri("http://alimama.com")); string tbtoken = ccl["_tb_token_"].Value; string poststr = "campId=" + campaignid + "&keeperid=" + keeperid + "&applyreason=%e5%be%ae%e5%8d%9a%e5%a4%a7%e5%8f%b7%e5%af%bc%e8%b4%ad%ef%bc%8cQQ%ef%bc%9a1145837517&t=" + HttpHelper1.GetTicks() + "&_tb_token_=" + tbtoken + "&pvid=" + pv_id; string resulthtml = HttpHelper1.SendDataByPost(url, poststr, refer, ref alimamacc); return(true); }
/// <summary> /// 删除指定微博 /// </summary> /// <param name="mid"></param> /// <param name="weibocc"></param> /// <returns></returns> public static bool DeleteWeibo(string mid, CookieContainer weibocc) { string url = "http://weibo.com/aj/mblog/del?ajwvr=6"; string poststr = "mid=" + mid; string result = HttpHelper1.SendDataByPost(url, poststr, "", ref weibocc); if (result.Contains("100000")) { return(true); } return(false); }
public static string GetWeiboShorturl(string url) { string shorturl = ""; string encodeurl = HttpUtility.UrlEncode(url); string poststring = "url=" + encodeurl + "&d=1"; string geturl = "http://api.t.sina.com.cn/short_url/shorten.json?source=2465536411&url_long=" + encodeurl; CookieContainer cc = new CookieContainer(); string json = HttpHelper1.SendDataByGET(geturl, ref cc); HttpHelper1.GetStringInTwoKeyword(json, ref shorturl, "url_short\":\"", "\"", 0); return(shorturl); }
public static CookieContainer Login(string username, string password) { string posturl = "https://login.taobao.com/member/login.jhtml?redirectURL=http%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1"; string poststr = "TPL_username="******"&TPL_password="******"&ncoSig=&ncoSessionid=&ncoToken=8bb84c14acdeac1ea8a25bd93ff9b3e8141bc70e&slideCodeShow=false&useMobile=false&lang=zh_CN&loginsite=0&newlogin=&TPL_redirect_url=http%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1&from=alimama&fc=default&style=mini&css_style=&keyLogin=false&qrLogin=true&newMini=false&newMini2=true&tid=&loginType=3&minititle=&minipara=&pstrong=&sign=&need_sign=&isIgnore=&full_redirect=true&sub_jump=&popid=&callback=&guf=¬_duplite_str=&need_user_id=&poy=&gvfdcname=&gvfdcre=&from_encoding=&sub=false&TPL_password_2=&loginASR=1&loginASRSuc=0&allp=&oslanguage=&sr=&osVer=&naviVer=&osACN=&osAV=&osPF=&miserHardInfo=&appkey=&bind_login=false&bind_token=&nickLoginLink=&mobileLoginLink=https%3A%2F%2Flogin.taobao.com%2Fmember%2Flogin.jhtml%3Fstyle%3Dmini%26newMini2%3Dtrue%26from%3Dalimama%26redirectURL%3Dhttp%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1%26full_redirect%3Dtrue%26disableQuickLogin%3Dtrue%26useMobile%3Dtrue"; CookieContainer cc = new CookieContainer(); string refer = "http://login.taobao.com/member/taobaoke/login.htm/is_login=1"; string result = HttpHelper1.SendDataByPost(posturl, poststr, refer, ref cc); string strurl = "https://www.alimama.com/membersvc/my.htm?domain=taobao&service=user_on_taobao&sign_account=a49f9f62502fc96517a626ea7e685eb4"; string resultstr = HttpHelper1.SendDataByGET(strurl, ref cc); bool isLogin = Alimama.TestLogin(cc); return(cc); }
public static WeiboComment GetComment(string mid, CookieContainer cc) { try { string commenturl = "http://weibo.com/aj/v6/comment/small?ajwvr=6&act=list&mid=" + mid + "&uid="; string result = HttpHelper1.SendDataByGET(commenturl, ref cc); WeiboComment comment = Newtonsoft.Json.JsonConvert.DeserializeObject <WeiboComment>(result); return(comment); } catch (Exception ex) { return(null); } }
/// <summary> /// 创建选品库 /// </summary> /// <param name="title">选品库名称</param> /// <param name="alimamacc"></param> /// <returns>选品库ID</returns> public static string CreatXuanpinku(string title, ref CookieContainer alimamacc) { string result = ""; string groupId = ""; string url = "http://pub.alimama.com/favorites/group/save.json"; string tbtoken = Alimama.GetTbToken(alimamacc); string encodetitle = HttpUtility.UrlEncode(title); string poststr = "groupTitle=" + encodetitle + "&groupType=1&t=" + HttpHelper1.GetTicks() + "&_tb_token_=" + tbtoken + "&pvid="; string refer = "http://pub.alimama.com/promo/search/index.htm?q=1&t=" + HttpHelper1.GetTicks(); result = HttpHelper1.SendDataByPost(url, poststr, refer, ref alimamacc); HttpHelper1.GetStringInTwoKeyword(result, ref groupId, "{\"data\":{\"data\":", "},\"", 0); return(groupId); }
public static string SendWeiboFromM(string weibotext, string picids, string refer, DEWeiboAccount deweiboaccount, CookieContainer weibocc) { string url = "https://m.weibo.cn/mblogDeal/addAMblog"; picids = picids.Replace("%20", "%2C"); refer = "https://m.weibo.cn/mblog"; CookieCollection ccl = weibocc.GetCookies(new Uri("http://weibo.com")); CookieCollection newccl = ccl; for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "sina.com.cn"; } CookieContainer newcc = new CookieContainer(); weibocc.Add(new Uri("http://sina.com.cn"), newccl); string ssourl1 = "http://login.sina.com.cn/sso/login.php?url=http%3A%2F%2Fm.weibo.cn%2F&_rand=" + HttpHelper1.GetTicks() + ".3493&gateway=1&service=sinawap&entry=sinawap&useticket=1&returntype=META&sudaref=&_client_version=0.6.23"; string ssoresult1 = HttpHelper1.SendDataByGET(ssourl1, ref weibocc); string ssourl2 = ""; HttpHelper1.GetStringInTwoKeyword(ssoresult1, ref ssourl2, "arrURL\":[\"", "\"]", 0); ssourl2 = ssourl2.Replace(@"\/", "/"); ssourl2 = ssourl2 + "&callback=sinaSSOController.doCrossDomainCallBack&scriptId=ssoscript0&client=ssologin.js(v1.4.19)&_=" + HttpHelper1.GetTicks(); string ssoresult2 = HttpHelper1.SendDataByGET(ssourl2, ref weibocc); ccl = weibocc.GetCookies(new Uri("http://sina.com.cn")); newccl = ccl; for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "weibo.cn"; } newcc = new CookieContainer(); weibocc.Add(new Uri("http://weibo.cn"), newccl); string poststr = "content=" + HttpUtility.UrlEncode(weibotext) + "&picId=" + picids + "&annotations=&st=" + deweiboaccount.St; string result = HttpHelper1.SendDataByPost(url, poststr, refer, ref weibocc); for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "weibo.com"; } weibocc.Add(newccl); return(result); }
public static bool TestLogin(string username, ref CookieContainer cc) { cc = InitWeiboCookie(username); if (cc == null) { return(false); } string url = "http://www.weibo.com/"; string strresult = HttpHelper1.SendDataByGET(url, ref cc); if (!strresult.Contains("我的首页")) { return(false); } return(true); }
/// <summary> /// 提交验证码验证 /// </summary> /// <param name="vcode">验证码</param> /// <param name="refer"></param> /// <param name="weibocc"></param> /// <returns></returns> public static string GetVcodeRetcode(string vcode, string refer, CookieContainer weibocc) { string retcode = ""; string yanzhengurl = "http://weibo.com/aj/pincode/verified?ajwvr=6"; string vcode_urlencode = HttpUtility.UrlEncode(vcode); string yanzhengpost = "secode=" + vcode_urlencode + "&type=rule"; string yanzhengresult = HttpHelper1.SendDataByPost(yanzhengurl, yanzhengpost, refer, ref weibocc); if (yanzhengresult.Contains("{\"code\":\"100000\"")) { //验证通过 HttpHelper1.GetStringInTwoKeyword(yanzhengresult, ref retcode, "retcode\":\"", "\"}}", 0); return(retcode); } return(retcode); }
public static bool TestLogin(CookieContainer cc) { bool isLogin = false; //验证登陆 string m_url = "https://www.alimama.com/getLogInfo.htm?callback=__jp0";//地址获取淘宝联盟选品库列表 string jsonlist = HttpHelper1.SendDataByGET(m_url, "https://www.alimama.com/index.htm", ref cc); if (jsonlist.Contains("success\":true"))//未登陆则打开登陆接口 { isLogin = true; } else { isLogin = false; } return(isLogin); }
public static bool TestLogin(string username, ref CookieContainer cc, ref string uid) { cc = InitWeiboCookie(username); if (cc == null) { return(false); } string url = "http://www.weibo.com/"; string strresult = HttpHelper1.SendDataByGET(url, ref cc); if (!strresult.Contains("我的首页")) { return(false); } HttpHelper1.GetStringInTwoKeyword(strresult, ref uid, "$CONFIG['uid']='", "';", 0); return(true); }
public static string secret = "a31cae562bc3de05e824ab9fa2d035b7"; //5cf839a91d5d86a953debf913f2702ec"; public static CookieContainer Login() { string alimamaAccount = File.ReadAllText("config/alimamaAccount.txt"); string posturl = "https://login.taobao.com/member/login.jhtml?redirectURL=http%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1"; posturl = "https://login.taobao.com/member/login.jhtml?redirectURL=http%3A%2F%2Fwww.alimama.com"; string poststr = alimamaAccount.Split(',')[0]; //string poststr = "TPL_username=13811277391&TPL_password=tianmin3216779236&ncoSig=&ncoSessionid=&ncoToken=b642ddda7d991ecd54929e776b8a2e5341006d8a&slideCodeShow=false&useMobile=false&lang=zh_CN&loginsite=0&newlogin=&TPL_redirect_url=http%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1&from=alimama&fc=default&style=mini&css_style=&keyLogin=false&qrLogin=true&newMini=false&newMini2=true&tid=&loginType=3&minititle=&minipara=&pstrong=&sign=&need_sign=&isIgnore=&full_redirect=true&sub_jump=&popid=&callback=&guf=¬_duplite_str=&need_user_id=&poy=&gvfdcname=10&gvfdcre=687474703A2F2F7075622E616C696D616D612E636F6D2F3F73706D3D61323139742E373636343535342E613231347472382E372E767753705056&from_encoding=&sub=&TPL_password_2=&loginASR=1&loginASRSuc=0&allp=&oslanguage=zh-CN&sr=1366*768&osVer=&naviVer=chrome%7C45.02454101&osACN=Mozilla&osAV=5.0+%28Windows+NT+10.0%3B+WOW64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F45.0.2454.101+Safari%2F537.36&osPF=Win32&miserHardInfo=&appkey=&bind_login=false&bind_token=&nickLoginLink=&mobileLoginLink=https%3A%2F%2Flogin.taobao.com%2Fmember%2Flogin.jhtml%3Fstyle%3Dmini%26newMini2%3Dtrue%26from%3Dalimama%26redirectURL%3Dhttp%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1%26full_redirect%3Dtrue%26disableQuickLogin%3Dtrue%26useMobile%3Dtrue&showAssistantLink=&um_token=HV01PAAZ0be2fcc8769100dc58abe2630034bd29&ua=086%23vM3XKrXlms3XZrm6XXXXXnN70qbE80hRLkSB0NsL1OUnpSiYiIEw6f6gR7nniPZRCkHFySiYyMA37aKh8rvRg5tgz5iLtsnmXmOsTmfmyvvgH3uVP21SbwmHvE9xT5d9mr3X1WwIyO37XA5qyQGU5O3aoIJQdBDUCa6EVk31X8XOwItTyRyYRMphdoGCyT62MqdHbWqua%2BsTo8fmXmzIwv1TU8scoOsJwp1TukjPe4B9wSaaSQ1Mmr3X1WwIyO37rLbeyQGU5O3aoIJQdBDUCa6EVk31X8XOwItTyRAYI1hhdoGCyT62MqdHbWqua%2BsTo8fmXmzIwv1TUfiidxsJwp1TukjPe4B9wSaaSQ1Mmr3X1WwIyO378ejyyQGU5O3aoIJQdBDUCa6EVk31X8XOwItTyRymkLlhdoGCyT62MqdHbWqua%2BsTo8fmXmzIwv1TUfP%2BLxsJwp1TukjPe4B9wSaaSQ1MXX3XuPVV0GgUXKRLFNlk9GA7eiSm%2FaHsXX3XuPV90GKZWJRLFNeWDsn7%2BEWJ%2FuHsmr3XuWwyyO37BgY%2FyQGU7m6ho4KLw0RUCRSmXXT%2B60BBmr3XuWwByO37B0%2BEyQGU7m6ho4KLw0RUC8fmXmDIBO1TUD53%2FvsJwp8ayePHSgGVwS6tX8X%2BRVRvX40kHPMmae5mQpf2kw8dfzhIGTuVPz%2FXX8X%2FHRhB02Ei7UIB%2BQMWoLclvM78agoqX8X36ceBBGnmXmxFTTomGUMgH3usA21Sbt9fiY4oIsPuP6ySvGnmXmOsTh3mGKbgH3uvMr1SbwmHvE9xT5d9UX3X35db22mMT2mS0xPD3MrrhdIT5M55X8XRLHVmXPOPX1jzy4WR1YmsWMPLPl2mXX8f11myUr3Xmux%2BBBg%2BX8X1f6ACBymIyr3XYXXX2THi6uRTCr3Xm0YzBBoVZ%2BfmXYCpi5QrXXXbF65eAbXXXjdckE0kgXXXFL7pib02XXXB7N5eNBXXXjbWrX3mnAqiH%2FWd8wmXPh4hHRZWnVSXsrcSIunchyXL3zb2PhuIj1yFnjZWnVSXsC4BiVfSuM9xm1rqmtcXX1ckZRxZY6XX%2B%2Fbti9yMa3rpjNXtjtavmNSWWR5fZcIif2blF3rT8tnHu63e6NuR6Nrg169f4LmsJ%2FCq1D%2FeRX4x%2FtWK%2FhOPXhgJWRnD4yZW1Cm9IcXC%2FVQ7hPSOkhaij1VhJRSH4yZW1CuKUu3lmXOt3jaQ6PWMmd8ERLmDs%2FZsJ%2FCGU2xEmmQd3%2F5QhYmvPPyJ%2BAn6ZyIssTc2s3VAhrQ%2BY13ga2CzY6XRsEQOIa81Wrc7O%2Fxe1MQ7%2Fwnw6EcnXNvRIjm4%2B984kTXQFrM9RmSVhzMxDDu36z8WsA7%2BI3v6J3xyia5DOw7SEr3XY9TaBrQkJGNTjwTOQX3X1221nNtIvN4o4zn9TQ%2FJhyVyZVCm96%2FtsL8wTwrmXmUZBW3X43WXfIAT9MIfn3Qw3JIJUX3Xugdbm2mgT2mS2vPDaXnp19o8nC9fXt5kUX3X35dbEXmqT2mSf7PD3MrrhdIT5M5qX8X36ceBBwSmXXT%2B60BBUr3Xmux%2BBBgqX8X36ceBB2fmXmzIwv1TU%2FYPV7sJwp1TukjPe4B9wSaaSQ1Mmr3X1WwIyO378Sj%2FyQGU5O3aoIJQdBDUCa6EVk3XX8X%2FHR6B0MET7UIB%2Bx0DpkAolruTago%3D"; CookieContainer cc = new CookieContainer(); string refer = "http://login.taobao.com/member/taobaoke/login.htm/is_login=1"; string result = HttpHelper1.SendDataByPost(posturl, poststr, refer, ref cc); string strurl = alimamaAccount.Split(',')[1]; //string strurl = "https://www.alimama.com/membersvc/my.htm?domain=taobao&service=user_on_taobao&sign_account=63f4941326712960165e9e278c31a7ad"; string resultstr = HttpHelper1.SendDataByGET(strurl, ref cc); //bool isLogin = Alimama.TestLogin(cc); return(cc); }
public static string GetTbkShortUrl(string tbkurl) { //tbkurl= "https://uland.taobao.com/coupon/edetail?activityId=cca299fffaee4c45bbfa541ac208dd16&pid=mm_122033678_24252915_81212616&itemId=547482547612&src=fklm_hltk&dx=1"; string url = "http://gw.api.taobao.com/router/rest"; ITopClient client = new DefaultTopClient(url, Alimama.appkey, Alimama.secret); TbkSpreadGetRequest req = new TbkSpreadGetRequest(); List <TbkSpreadGetRequest.TbkSpreadRequestDomain> list2 = new List <TbkSpreadGetRequest.TbkSpreadRequestDomain>(); TbkSpreadGetRequest.TbkSpreadRequestDomain obj3 = new TbkSpreadGetRequest.TbkSpreadRequestDomain(); list2.Add(obj3); obj3.Url = tbkurl; req.Requests_ = list2; TbkSpreadGetResponse rsp1 = client.Execute(req); string tbkshorturl = ""; HttpHelper1.GetStringInTwoKeyword(rsp1.Body, ref tbkshorturl, "<content>", "</content>", 0); return(tbkshorturl); }
public static string Comment(string mid, string ouid, string commentstr, string refer, CookieContainer weibocc, WebProxy proxy) { string commenturl = "http://weibo.com/aj/v6/comment/add?ajwvr=6&__rnd=" + HttpHelper1.GetTicks(); commentstr = System.Web.HttpUtility.UrlEncode(commentstr.Trim()); commentstr = commentstr.Trim().Replace("+", "%20"); string commentpoststr = "act=post&mid=" + mid + "&uid=" + ouid + "&forward=0&isroot=0&content=" + commentstr + "&location=&module=scommlist&group_source=&pdetail=&_t=0"; string commentresult = HttpHelper1.SendDataByPost(commenturl, commentpoststr, refer, ref weibocc, proxy); if (commentresult.Contains("{\"code\":\"100001\"")) { //Thread.Sleep(10 * 60 * 1000);//如果第一次评论就提示发布相同内容,则将线程停顿10分钟 return(commentresult);//如果第一次评论就报错,一般认为是mid为空,直接返回不处理 } if (commentresult.Contains("{\"code\":\"100027\"")) { //需要输入验证码 string retcode = ""; string vcode = ""; while (retcode == "") { while (vcode == "" || vcode == "IERROR" || vcode == "ERROR") { vcode = HttpHelper1.AutoGetVcode(weibocc); } retcode = WeiboHandler.GetVcodeRetcode(vcode, refer, weibocc); if (retcode == "") { vcode = ""; } }//拿到验证码,并验证通过,通不过死循环 commentpoststr = commentpoststr + "&retcode=" + retcode; commentresult = HttpHelper1.SendDataByPost(commenturl, commentpoststr, refer, ref weibocc, proxy);//再次发送评论 } return(commentresult); }
public static string GetTbkTaokouling(string tburl) { //tbkurl= "https://uland.taobao.com/coupon/edetail?activityId=cca299fffaee4c45bbfa541ac208dd16&pid=mm_122033678_24252915_81212616&itemId=547482547612&src=fklm_hltk&dx=1"; string url = "http://gw.api.taobao.com/router/rest"; ITopClient client = new DefaultTopClient(url, appkey, secret); WirelessShareTpwdCreateRequest req = new WirelessShareTpwdCreateRequest(); WirelessShareTpwdCreateRequest.GenPwdIsvParamDtoDomain obj1 = new WirelessShareTpwdCreateRequest.GenPwdIsvParamDtoDomain(); obj1.Ext = "{\"xx\":\"xx\"}"; obj1.Logo = "http://m.taobao.com/xxx.jpg"; obj1.Url = "http://m.taobao.com"; obj1.Text = "超值活动,惊喜活动多多"; obj1.UserId = 24234234234L; req.TpwdParam_ = obj1; WirelessShareTpwdCreateResponse rsp = client.Execute(req); string tbkshorturl = ""; HttpHelper1.GetStringInTwoKeyword(rsp.Body, ref tbkshorturl, "<content>", "</content>", 0); return(rsp.Body); }
/// <summary> /// 获取阿里妈妈搜索商品url内容 /// </summary> /// <param name="itemurl"></param> /// <param name="alimamacc"></param> /// <returns></returns> public static string SearchItem(string itemurl, CookieContainer alimamacc) { AlimamaSearchData alimama_searchdata = new AlimamaSearchData(); CookieCollection ccl = alimamacc.GetCookies(new Uri("http://alimama.com")); if (ccl["_tb_token_"] == null) { return("阿里妈妈未登录"); } string tbtoken = ccl["_tb_token_"].Value; string searchurl = "http://pub.alimama.com/items/search.json?queryType=2&q=" + HttpUtility.UrlEncode(itemurl) + "&auctionTag=&perPageSize=40&shopTag=&t=" + HttpHelper1.GetTicks() + "&_tb_token_=" + tbtoken + "&pvid=10_118.145.0.50_464_1484650244904&yxjh=-1"; string refer = "http://pub.alimama.com/promo/search/index.htm?queryType=2&q=" + HttpUtility.UrlEncode(itemurl); string resulthtml = HttpHelper1.SendDataByGET(searchurl, refer, ref alimamacc); //alimama_searchdata = Newtonsoft.Json.JsonConvert.DeserializeObject<AlimamaSearchData>(resulthtml); //string campaignstr = ""; //HttpHelper1.GetStringInTwoKeyword(resulthtml, ref campaignstr, "", "", 0); return(resulthtml); }
/// <summary> /// 发布单条微博 /// </summary> /// <param name="weibotext">微博正文</param> /// <param name="picids">图片ID,空格连接</param> /// <param name="refer">来源地址</param> /// <param name="weibocc">Cookie</param> /// <returns></returns> public static string SendWeibo(string weibotext, string picids, string refer, CookieContainer weibocc) { string ticks = HttpHelper1.GetTicks(); //PC端发布微博 string posturl = "http://www.weibo.com/aj/mblog/add?ajwvr=6&__rnd=" + ticks; string encodeweibotext = System.Web.HttpUtility.UrlEncode(weibotext); encodeweibotext = encodeweibotext.Replace("%250A", "%0A"); string poststr = "location=v6_content_home&text=" + encodeweibotext + "&appkey=&style_type=1&pic_id=" + picids + "&pdetail=&gif_ids=&rank=0&rankid=&module=stissue&pub_source=main_&pub_type=dialog&_t=0"; poststr = poststr.Replace("+", "%20"); //移动端发布微博 //string posturl = "http://m.weibo.cn/mblogDeal/addAMblog"; //string poststr = "content=" + System.Web.HttpUtility.UrlEncode(weibotext) + "&picId="+picids+"&annotations=&st=12283f"; string result = HttpHelper1.SendDataByPost(posturl, poststr, refer, ref weibocc); //判断是否发布成功 //{"code":"100000" return(result); }
public static string GetSTFromM(CookieContainer cc) { string url = "http://m.weibo.cn"; CookieCollection ccl = cc.GetCookies(new Uri("http://weibo.cn")); CookieCollection newccl = ccl; for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "weibo.cn"; } CookieContainer newcc = new CookieContainer(); newcc.Add(new Uri("http://weibo.cn"), newccl); string result = HttpHelper1.SendDataByGET(url, ref newcc); string st = ""; HttpHelper1.GetStringInTwoKeyword(result, ref st, "st\":\"", "\"", 0); for (int i = 0; i < newccl.Count; i++) { newccl[i].Domain = "weibo.com"; } return(st); }
public static CampainsData GetCampainByTBItemID(string itemid, string tbtoken, string pv_id, ref CookieContainer alimamacc, ref string keeperid) { string url = "http://pub.alimama.com/pubauc/getCommonCampaignByItemId.json?itemId=" + itemid + "&t=" + HttpHelper1.GetTicks() + "&_tb_token_=" + tbtoken + "&pvid=" + pv_id; string resulthtml = HttpHelper1.SendDataByGET(url, ref alimamacc); while (resulthtml.Contains("查询商品佣金出错")) { Thread.Sleep(30 * 1000); resulthtml = HttpHelper1.SendDataByGET(url, ref alimamacc); } if (resulthtml.Contains("为空")) { return(null); } else if (resulthtml.Contains("阿里妈妈"))//返回阿里妈妈首页,登录失效 { alimamacc = Alimama.Login(); resulthtml = HttpHelper1.SendDataByGET(url, ref alimamacc); } HttpHelper1.GetStringInTwoKeyword(resulthtml, ref keeperid, "ShopKeeperID\":", ",\"Properties", 0); CampainsData campains = Newtonsoft.Json.JsonConvert.DeserializeObject <CampainsData>(resulthtml); return(campains); }
/// <summary> /// 根据微博短地址获取淘宝真实地址及网页数据 /// </summary> /// <param name="weiboshorturl"></param> /// <param name="alimamacc"></param> /// <param name="tbrealurl"></param> /// <returns></returns> public static string GetItemResultWithWeiboShortUrl(string weiboshorturl, CookieContainer alimamacc, ref string tbrealurl) { string tbkurl = ""; if (weiboshorturl.Contains("s.click.taobao.com")) { tbkurl = weiboshorturl; goto buzhou3; } //一次跳转,微博短链接 -> 淘宝客短链接 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(weiboshorturl); req.AllowAutoRedirect = false; WebResponse rsp = req.GetResponse(); tbkurl = rsp.Headers["location"]; req.Abort(); rsp.Close(); rsp.Dispose(); //二次跳转,淘宝客短链接 -> 淘宝客长链接 req = (HttpWebRequest)HttpWebRequest.Create(tbkurl); if (tbkurl.Contains("uland.taobao.com")) { //string result1 = HttpHelper1.GetHttpsHtml(tbkurl, "", ref tbrealurl); return(tbkurl); } req.AllowAutoRedirect = false; req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"; rsp = req.GetResponse(); tbkurl = rsp.Headers["location"]; req.Abort(); rsp.Close(); rsp.Dispose(); buzhou3: //三次跳转,淘宝客长链接 -> 淘宝Item跳转地址 req = (HttpWebRequest)HttpWebRequest.Create(tbkurl); req.AllowAutoRedirect = false; req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"; rsp = req.GetResponse(); tbkurl = rsp.Headers["location"]; if (tbkurl == null) { tbkurl = rsp.ResponseUri.ToString(); } //释放资源 req.Abort(); rsp.Close(); rsp.Dispose(); //四次跳转,淘宝Item真实地址 string tu = tbkurl.Replace("https://s.click.taobao.com/t_js?tu=", ""); tu = HttpUtility.UrlDecode(tu); string result = HttpHelper1.GetHttpsHtml(tu, tbkurl, ref tbrealurl); return(result); }