/// <summary> /// 点赞功能 /// </summary> /// <param name="wbLogin"></param> /// <param name="yOrN">是点赞,还是取消赞</param> /// <returns></returns> public int Like(WeiboLogin wbLogin, bool yOrN) { if (IsLike == yOrN) { return(-2); } try { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); //这个是点赞的接口 string url = "https://weibo.com/aj/v6/like/add?ajwvr=6&__rnd=" + (int)ts.TotalSeconds + "000"; //这个是评论的接口 //string url = "https://weibo.com/aj/v6/comment/add?ajwvr=6&__rnd=" + (int)ts.TotalSeconds + "000"; //这个是点赞的提交字符串 string postStr = "location=" + WBPage.Location + "&version=mini&qid=heart&mid=" + ID + "&loc=profile&cuslike=1&_t=0"; //这个是评论的提交字符串,转发把forward改成1 //string postStr = "act=post&mid=" + ID + "&uid=3166169725&forward=0&isroot=0&content=helloworld!&location=" + WBPage.Location + "&module=scommlist&group_source=&pdetail=1005056399610336&_t=0"; string responseStr = HttpHelper.Post(url, WBPage.Url, wbLogin.MyCookies, postStr); //System.Windows.Forms.MessageBox.Show(url); //System.Windows.Forms.MessageBox.Show(postStr); //System.Windows.Forms.MessageBox.Show(responseStr); ResponseJson responseJson = JsonConvert.DeserializeObject <ResponseJson>(responseStr); return(responseJson.data.isDel); } catch { return(-1); } }
/// <summary> /// 点赞功能 /// </summary> /// <param name="wbLogin"></param> /// <param name="yOrN">是点赞,还是取消赞</param> /// <returns></returns> public int Like(WeiboLogin wbLogin, bool yOrN) { if (IsLike == yOrN) { return(-2); } try { string url = "http://weibo.com/aj/v6/like/add?ajwvr=6"; string postStr = "location=" + WBPage.Location + "&version=mini&qid=heart&mid=" + ID + "&loc=profile"; string responseStr = HttpHelper.Post(url, WBPage.Url, wbLogin.MyCookies, postStr); ResponseJson responseJson = JsonConvert.DeserializeObject <ResponseJson>(responseStr); return(responseJson.data.isDel); } catch { return(-1); } }