利用C#快速查出哪些QQ好友空间屏蔽了自己

我们经常会遇到以下情况吧:想点击好友空间看看他最近的动态,结果发现自己需要申请权限!别担心,本文将为大家介绍如何利用C#快速查出哪些QQ好友空间屏蔽了自己,需要的可以参考一下

大家好,我叫柠檬水,今天马上就要放假,突然想到自己以前的伙伴、同学,好像想到他们空间没怎么发过动态,难道是把我屏蔽了吗,好友又那么多,行吧,只能用c#写一个快速的知道哪些人屏蔽了自己。

首先我们整理逻辑,我们需要所有好友的QQ号,然后是一个通过qq号知道这个人是否空间屏蔽了自己的接口

qq号我倒是想到了腾讯官方提供的qq群里的某一个接口,后面的嘛,可以通过访问qq空间的那个接口嘛,嘿嘿,我真是太机智了 竟然我们逻辑都已经想好了,那么后面的事情就简单多了

首先我们进入qq群

进去后我们可以看到不仅是所有的QQ群有,连当前qq的所有好友也有 我们点击好友那个接口,打开所有的好友,直接复制就行了,其它的交给正则表达式吧!

然后我们登录QQ号,打开这个链接 http://user.qzone.qq.com/自己QQ号/infocenter 打开f12,刷新找到第一个接口,找到发送请求的cookie,现在c#获取cookie我还不会哦,写爬虫还是python好呢

现在我们有三个准备了,登录状态下的QQ号,cookie已经所以的qq好友 接下来看我的完整代码

using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Http; using System.Text; using System.Text.RegularExpressions; namespace ConsoleApp6 { class Program { static void Main(string[] args) { string url = "http://user.qzone.qq.com/<>/infocenter"; string txt = ""; StreamReader sr = new StreamReader(@"qq.txt");//里面装的是所以qq好友,直接将复制的写进去 while (!sr.EndOfStream) { string str = sr.ReadLine(); txt += str + "\n"; } sr.Close(); string regex1 = "name: \"(?.*?)\",";//获取QQ昵称 string regex2 = "uin: (?.*?)}";//获取QQ昵称 MatchCollection namelist = Regex.Matches(txt, regex1); MatchCollection qqlist = Regex.Matches(txt, regex2); if (namelist.Count != qqlist.Count) { Console.WriteLine("qq昵称与QQ号数目不匹配!"); return; } Dictionary dic = new Dictionary(); for (int i = 0; i >", item.Value); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); req.Method = "GET"; req.Accept = "text/html"; req.AllowAutoRedirect = true; req.Headers.Add("Encoding", Encoding.UTF8.ToString()); req.Headers.Add("cookie", cookie); req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"; HttpWebResponse res = (HttpWebResponse)req.GetResponse(); using (StreamReader reader = new StreamReader(res.GetResponseStream())) { string html = reader.ReadToEnd(); if (!string.IsNullOrEmpty(html)) { string filePath = System.IO.Directory.GetCurrentDirectory() + "\\" + item.Key + item.Value + ".txt"; using (StreamWriter sw = new StreamWriter(filePath)) { sw.Write(html); } Console.WriteLine(item.Key + item.Value +"Download OK!\n"); } } url = url.Replace(item.Value,"<>"); } Console.WriteLine("成功啦,去程序目录一个个看吧!"); } } } 

里面有说放qq号和cookie的注释,然后运行

如果里面有这句话的,唉

总体来说,其实可以直接得出结果的,但是,每一个好友难道不值得你一个一个看嘛,如果想用直接得出结果,可以联系我哦,其实后面加个判断就行了!

人生若只如初见,何事秋风悲画扇!

到此这篇关于利用C#快速查出哪些QQ好友空间屏蔽了自己的文章就介绍到这了,更多相关C#内容请搜索0133技术站以前的文章或继续浏览下面的相关文章希望大家以后多多支持0133技术站!

以上就是利用C#快速查出哪些QQ好友空间屏蔽了自己的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 其他教程