WPF 微信 MVVM 【续】修复部分用户无法获取列表
看过我WPF 微信 MVVM这篇文章的朋友,应该知道我里面提到了我有一个小号是无法获取列表的,始终也没找到原因。
前两天经过GitHub上h4dex大神的指导,知道了原因,是因为微信在登录以后,web微信采取了不同的域名来兼容各种用户。
下面是大神提供的js代码和C#代码

function () { var e = location.host, t = 'weixin.qq.com', o = 'file.wx.qq.com', n = 'webpush.weixin.qq.com'; e.indexOf('wx2.qq.com') > - 1 ? (t = 'weixin.qq.com', o = 'file2.wx.qq.com', n = 'webpush2.weixin.qq.com') : e.indexOf('qq.com') > - 1 ? (t = 'weixin.qq.com', o = 'file.wx.qq.com', n = 'webpush.weixin.qq.com') : e.indexOf('web1.wechat.com') > - 1 ? (t = 'wechat.com', o = 'file1.wechat.com', n = 'webpush1.wechat.com') : e.indexOf('web2.wechat.com') > - 1 ? (t = 'wechat.com', o = 'file2.wechat.com', n = 'webpush2.wechat.com') : e.indexOf('wechat.com') > - 1 ? (t = 'wechat.com', o = 'file.wechat.com', n = 'webpush.wechat.com') : e.indexOf('web1.wechatapp.com') > - 1 ? (t = 'wechatapp.com', o = 'file1.wechatapp.com', n = 'webpush1.wechatapp.com') : (t = 'wechatapp.com', o = 'file.wechatapp.com', n = 'webpush.wechatapp.com'); }

public object LoginCheck() { if(this.string_0 != null) { string[] strArray = new string[6]; strArray[0] = this.string_7; strArray[1] = this.string_0; strArray[2] = "&tip=0&r="; TimeSpan span = (TimeSpan)(DateTime.Now.ToUniversalTime() - new DateTime(0x7b2, 1, 1)); long totalMilliseconds = (long) span.TotalMilliseconds; strArray[3] = totalMilliseconds.ToString(); strArray[4] = "&_="; span = (TimeSpan)(DateTime.Now.ToUniversalTime() - new DateTime(0x7b2, 1, 1)); strArray[5] = ((long) span.TotalMilliseconds).ToString(); byte[] bytes = this.httpService_0.SendGetRequest(string.Concat(strArray)); string str2 = Encoding.UTF8.GetString(bytes); if(str2.Contains("=201")) { string s = str2.Split(new string[] { "'" }, StringSplitOptions.None)[1].Split(new char[] { ',' })[1]; byte[] buffer = Convert.FromBase64String(s); MemoryStream stream = new MemoryStream(buffer, 0, buffer.Length); stream.Write(buffer, 0, buffer.Length); return Image.FromStream(stream); } if(str2.Contains("=200")) { string str3 = str2.Split(new string[] { "\"" }, StringSplitOptions.None)[1]; string domain = CheckData.Getdomain(str3); if(domain.IndexOf("wx2.qq.com") > -1) { this.string_1 = "https://wx2.qq.com/"; this.string_2 = "https://wx2.qq.com"; this.string_4 = "https://file2.wx.qq.com"; this.string_3 = "https://webpush2.weixin.qq.com"; return str3; } if(domain.IndexOf("qq.com") > -1) { this.string_2 = "https://wx.qq.com"; this.string_4 = "https://file.wx.qq.com"; this.string_3 = "https://webpush.weixin.qq.com"; return str3; } if(domain.IndexOf("web1.wechat.com") > -1) { this.string_2 = "https://web.wechat.com"; this.string_4 = "https://file1.wechat.com"; this.string_3 = "https://webpush1.wechat.com"; return str3; } if(domain.IndexOf("web2.wechat.com") > -1) { this.string_2 = "https://web.wechat.com"; this.string_4 = "https://file2.wechat.com"; this.string_3 = "https://webpush2.wechat.com"; return str3; } if(domain.IndexOf("wechat.com") > -1) { this.string_2 = "https://web.wechat.com"; this.string_4 = "https://file.wechat.com"; this.string_3 = "https://webpush.wechat.com"; return str3; } if(domain.IndexOf("web1.wechatapp.com") > -1) { this.string_2 = "https://web.wechatapp.com"; this.string_4 = "https://file1.wechatapp.com"; this.string_3 = "https://webpush1.wechatapp.com"; return str3; } this.string_2 = "https://web.wechatapp.com"; this.string_4 = "https://file.wechatapp.com"; this.string_3 = "https://webpush.wechatapp.com"; return str3; } } return null; }
根据其方法,我进行了修改,可以实现登录以后的后续操作了。
如图,就是小号登录以后,可以获取列表了
修改后的代码已上传GitHub
作者:眾尋
出处:https://www.cnblogs.com/ZXdeveloper/p/6231935.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
分类:
WPF
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本