贴下百度博客自动加好友的简单代码示例!!(c#.net实现)

贴下百度博客自动加好友的简单代码示例!!(c#.net实现)

public static void BAIDU_F()
     {
         string c;
         string cookies = "BAIDUID=6AF8F4D56DFE7B89DF3A49890E46A6D2:FG=1; BDSTAT=zfrong2000";
         Match m;
         MatchCollection mColl;
         string url = "http://ren.baidu.com/uquery/?type=2&fn=0&word=&ln=10&sex1=0&sex2=0&sex3=0&age_from=0&age_to=0&marry=0&blood=0&zodiac=0&space_ok=0&baiduhi_ok=0&vocation=0&education=0&birth_province=&birth_city=&birth_home=&birth_other=&reside_province=%C9%CF%BA%A3&reside_city=&reside_home=&reside_other=&tag_school=&tag_book=&tag_music=&tag_movie=&tag_sport=&tag_person=&tag_other=&tag_brand=&tag_unit=&&pn={0}";
         string url2;
         for (int i = 6; i < 1000; i++)
         {
             c = Zfr.Common.Helper.GetPage(string.Format(url, i, i * 50), cookies, Encoding.GetEncoding("gb2312"));
             m = Regex.Match(c, @"http://pdc.baidu.com/uinfo/(.*?)&randin=(.*?)&t=", RegexOptions.IgnoreCase);
            if(m.Success)
            {
                url2 = m.Groups[0].Value;
                c = Zfr.Common.Helper.GetPage(string.Format(url2, 0), cookies, Encoding.GetEncoding("gb2312"));
                mColl = Regex.Matches(c, @"username: ""(.*?)"",", RegexOptions.IgnoreCase);
                foreach (Match m2 in mColl)
                {
                    Show(string.Format("FIND-->{0}/t{1}", i, m2.Groups[1].Value));
                    BAIDU_F_ADD(m2.Groups[1].Value, cookies);
                    System.Threading.Thread.Sleep(500);//
                }
             }
            c = null; mColl = null; m = null;
         }
         cookies = null; url = null; url2 = null;
     }
     static void BAIDU_F_ADD(string name,string cookies)
     {
         string refer = "http://frd.baidu.com/addfrd#tab=residence";

         string data = "tn=bmFriCommit&um=&word={0}&callback=procCallBack&ref=&spurl=http%3A%2F%2Ffrd.baidu.com%2Faddfrd&cascade_im=1";
         string data2 = "tn=bmFriCommit&callback=Friend.editCallback&dstun={0}&gns=&pp=0&desc=";

         string url = "http://frd.baidu.com/commit/friend.add";
         string url2 = "http://frd.baidu.com/commit/friend.edit";

         string rtn; Match m;
         rtn = Zfr.Common.Helper.PostForm(string.Format(url, name), string.Format(data, name), false, cookies, Encoding.GetEncoding("gbk"), string.Format(refer, name), null);
         m = Regex.Match(rtn,@"msg:""(.*?)""");
         if (m.Success)
             rtn = m.Groups[1].Value;
         Show(string.Format("ADD-->{0}/t{1}", name,rtn));
         rtn = Zfr.Common.Helper.PostForm(string.Format(url2, name), string.Format(data2, name), false, cookies, Encoding.GetEncoding("gbk"), string.Format(refer, name), null);
         m = Regex.Match(rtn, @"msg:""(.*?)""");
         if (m.Success)
             rtn = m.Groups[1].Value;
         Show(string.Format("EDIT-->{0}/t{1}", name, rtn));
         refer = null; data = null; data2 = null; url = null; url2 = null; rtn = null;
     }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值