首页 > 数码科技 > Q宠大乐斗协议获取好友信息代码

Q宠大乐斗协议获取好友信息代码

栏目:数码科技

作者:B姐

热度:0

时间:2023-11-30 09:13:16

乐斗获取好友信息十分简单,只需要携带cookie访问 http://fight.pet.qq.com/cgi-bin/petpk?cmd=view&kind=1&sub=1就可以了

   比较难的是分析个参数的意义,需要多个好友相互对比

       服务器返回如下:

   {result:'0',msg:'',info:[{uin:'xxxxxxxx',flag:'0',yflag:'0',qqflag:'0',name:'乐斗菜菜', lilian:'19',enable:'1', factionid:'0'},{uin:'xxxxxxxx',flag:'0',yflag:'0',qqflag:'0',name:'乐斗小王子', lilian:'37',enable:'2', factionid:'10007'},{uin:'xxxxxxxx',flag:'0',yflag:'0',qqflag:'2',name:'Going_Down', lilian:'32',enable:'1', factionid:'235884'},................

   其中uin为好友的QQ号码 ,flag没去研究 yflag为会员黄钻等信息  name为网名    lilian为等级  enable为0则已经和他打斗过  1 没有打斗过  2他有拳套,没有打斗过

   factionid为帮派ID

    给出代码:

   获取好友

public Dictionary getAllFriend(){Dictionary entitys =new Dictionary();HttpHelper.Encoding = Encoding.GetEncoding("gb2312");string result = HttpHelper.GetHtml("http://fight.pet.qq.com/cgi-bin/petpk?cmd=view&kind=1&sub=1", user.Cookie);result = result.Replace("", "");if (result !=""){//历练导致少取到5个号码Regex r =new Regex("(uin:')(?[0-9]{5,11}?)(',flag:'[0-9]{1}',yflag:'[0-9]{1}',qqflag:')(?[0-9]{1}?)(',name:')"+"(?.+?)(',lilian:')(?[0-9]{1,2}?)(',enable:')(?[0-9]{1}?)(',factionid:')(?[0-9]{1,6}?)(')", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);MatchCollection m = r.Matches(result);for (int i =0; i < m.count;="">{try{QchongEntity entity =new QchongEntity();entity.UserName = m[i].Groups["qq"].Value;entity.Qqflag = Convert.ToInt32(m[i].Groups["qqflag"].Value);entity.NickName = m[i].Groups["name"].Value;entity.Liliang = m[i].Groups["lilian"].Value;entity.Factionid = m[i].Groups["factionid"].Value;entity.Enable = Convert.ToInt32(m[i].Groups["enable"].Value);entitys.Add(entity.UserName,entity);}catch (Exception){continue;}}}AllFriend = entitys;return entitys;}

Q宠大乐斗协议获取好友信息代码