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 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 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 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); }
/// <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); }
/// <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 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%23vM3XKrXlms3X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nVSXsC4BiVfSuM9xm1rqmtcXX1ckZRxZY6XX%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 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); }
/// <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); }