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');
}

js

public object LoginCheck()
{
if(this.string_0 != null)
{
string[] strArray = new string[];
strArray[] = this.string_7;
strArray[] = this.string_0;
strArray[] = "&tip=0&r=";
TimeSpan span = (TimeSpan)(DateTime.Now.ToUniversalTime() - new DateTime(0x7b2, , ));
long totalMilliseconds = (long) span.TotalMilliseconds;
strArray[] = totalMilliseconds.ToString();
strArray[] = "&_=";
span = (TimeSpan)(DateTime.Now.ToUniversalTime() - new DateTime(0x7b2, , ));
strArray[] = ((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)[].Split(new char[] { ',' })[];
byte[] buffer = Convert.FromBase64String(s);
MemoryStream stream = new MemoryStream(buffer, , buffer.Length);
stream.Write(buffer, , buffer.Length);
return Image.FromStream(stream);
}
if(str2.Contains("=200"))
{
string str3 = str2.Split(new string[] { "\"" }, StringSplitOptions.None)[];
string domain = CheckData.Getdomain(str3);
if(domain.IndexOf("wx2.qq.com") > -)
{
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") > -)
{
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") > -)
{
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") > -)
{
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") > -)
{
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") > -)
{
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;
}

C#

根据其方法,我进行了修改,可以实现登录以后的后续操作了。

如图,就是小号登录以后,可以获取列表了

WPF 微信 MVVM 【续】修复部分用户无法获取列表

WPF 微信 MVVM 【续】修复部分用户无法获取列表

修改后的代码已上传GitHub

上一篇:Python列表去重


下一篇:Hdoj 1847.Good Luck in CET-4 Everybody! 题解