现在的网络是一个营销的网络,那么为了获取更加精准的数据,发送精准的邮件来提供访问量是在所难免的,
下面我们就开始用C#来开发一个简单的工具来获取群的成员列表吧,工具的界面是这样的
这个地方是用的QQ的默认地址的登陆,快速登陆后要获取群的列表,然后对应的获取对应群的成员列表
需要用到的是webBrowser2控件
下面我们上代码
webBrowser2的URl 我们默认设置成 http://ui.ptlogin2.qq.com/cgi-bin/login?appid=3000801&s_url=http://qun.qq.com/air/这个就是登陆的
然后我们要获取群的成员
通过循环来获取每一页的成员类表
try
{
HtmlDocument doc = webBrowser2.Document;
string htm = doc.Body.InnerHtml.ToString();
htm = htm.ToLower();
int a = htm.IndexOf("<div class=groupmsg>");
int aa = htm.IndexOf("<div class=abstracttop></div>");
htm = htm.Substring(a, aa);
int b = htm.IndexOf("<ul class=undis id=nogroups>");
int bb = htm.IndexOf("</div></li></ul></div></li></ul>");
int uuuu=htm.Length;
htm = htm.Substring(b, bb-b);
#region
string title = htm;
int position = 0;//记录出现的位置
int count = 0; //统计出现的次数
do
{
position = title.IndexOf("rev=");
if (position >= 0) //如果未找到则返回-1
{
title = title.Substring(position+4);
count++;
}
} while (position>=0);
try
{
{
Random rd1 = new Random(); int g1 = rd1.Next();
string surl1 = "http://qun.qq.com/air/" + this.listBox2.SelectedItem.ToString().Trim() + "/addr/index/type/1/p/1?w=n&_=" + g1 + "";
this.webBrowser2.Url = new Uri(surl1);
doc1 = webBrowser2.Document;
string htm1 = doc1.Body.InnerHtml.ToString();
htm1 = htm1.ToLower();
int iIndex = 0;
int aaa = 0;
aaa = htm1.IndexOf("allpage");
string allpage = htm1.Substring(aaa + 9, 2);
try
{
aaa = Convert.ToInt32(allpage);
}
catch
{
allpage = htm1.Substring(aaa + 9, 1);
aaa = Convert.ToInt32(allpage);
}
for (int j = 1; j <= aaa; j++)
{
Random rd = new Random(); int g = rd.Next();
string surl = "http://qun.qq.com/air/" + this.listBox2.SelectedItem.ToString().Trim() + "/addr/index/type/1/p/" + j + "?w=n&_=" + g + "";
this.webBrowser2.Url = new Uri(surl);
UrlArray.Add(surl);
}
}
}
catch
{
throw;
}
}
QQ群:161552355,238975191,254802533,263481181
至于源代码可以去哥们的网站下载