private WechatSearchInfo CreateSearchInfoWithAccountNode(string srcPageDir, PhMenuNode accountNode) { var aNewInfo = new WechatSearchInfo(); aNewInfo.Account = Regex.Match(accountNode.Name, @"(.*)/.*").Groups[1].Value; if (string.IsNullOrEmpty(aNewInfo.Account)) { aNewInfo.Account = Regex.Match(accountNode.Name, @"(.*)-.*").Groups[1].Value; } aNewInfo.StartFile = Path.Combine(srcPageDir, Regex.Match(accountNode.Url, @".*\.html").Value); if (accountNode.Childs.First(p => p.Name.Contains("通讯录")).Childs.Count(p => p.Name.Contains("好友列表")) > 0) { var friendNode = accountNode.Childs.First(p => p.Name.Contains("通讯录")).Childs.First(p => p.Name.Contains("好友列表")); aNewInfo.FriendsFiles = MakeFilesPath(srcPageDir, accountNode.Childs.First(p => p.Name.Contains("通讯录")), friendNode); } if (accountNode.Childs.Count(p => p.Name.Contains("群成员列表")) > 0) { var groupNode = accountNode.Childs.First(p => p.Name.Contains("群成员列表")); aNewInfo.GroupsFiles = MakeFilesPath(srcPageDir, accountNode, groupNode); } return(aNewInfo); }
public override WechatAccountInfo GetWechatInfoWithSearchInfo(WechatSearchInfo searchInfo) { var newAccountInfo = new WechatAccountInfo(); var startFileContent = File.ReadAllText(searchInfo.StartFile).ReplaceNoNeedSymbols(); var infoMatch = Regex.Match(startFileContent, @"帐号信息\(\d*\)</a></th></tr></table></div><table.{0,200}?<td>微信号(.{0,400}?" + searchInfo.Account + @".*?)</table>\s<div").Groups[1].Value; var rowMatch = Regex.Matches(infoMatch, @"<tr\S.*?>(.*?</table>)")[0].Groups[1].Value; newAccountInfo.Account = Regex.Match(rowMatch, @"</td><td>(.*?)</td><td .*?><div").Groups[1].Value; var matches = Regex.Matches(Regex.Match(rowMatch, @"<table.*?>(.*?)</table>").Groups[1].Value, @"<tr><td> .*?</td><td> (.*?)</td></tr>"); newAccountInfo.Name = matches[0].Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Id = matches[1].Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.BindQQ = matches[2].Groups[1].Value.FilterHtmlSpecialSymbols(); //newAccountInfo.Account = matches[3].Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Sex = matches[4].Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Description = matches[5].Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Remark = matches[6].Groups[1].Value.FilterHtmlSpecialSymbols(); //newAccountInfo.Account = matches[7].Groups[1].Value.FilterHtmlSpecialSymbols(); //newAccountInfo.Account = matches[8].Groups[1].Value.FilterHtmlSpecialSymbols(); //newAccountInfo.Account = matches[9].Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Email = matches[10].Groups[1].Value.FilterHtmlSpecialSymbols(); //newAccountInfo.Email = matches[11].Groups[1].Value.FilterHtmlSpecialSymbols(); //newAccountInfo.Email = matches[12].Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Mobile = matches[13].Groups[1].Value.FilterHtmlSpecialSymbols(); return(newAccountInfo); }
public override WechatAccountInfo GetWechatInfoWithSearchInfo(WechatSearchInfo searchInfo) { var newAccountInfo = new WechatAccountInfo(); var startFileContent = File.ReadAllText(searchInfo.StartFile); newAccountInfo.Account = Regex.Match(startFileContent, @"账号 <br/></td><td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Name = Regex.Match(startFileContent, @"昵称 <br/></td><td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); //newAccountInfo.pa = Regex.Match(startFileContent, @"密码 <br/></td><td>(.*) <br/></td>").Groups[1].Value; newAccountInfo.Email = Regex.Match(startFileContent, @"邮箱 <br/></td><td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Sex = Regex.Match(startFileContent, @"性别 <br/></td><td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); newAccountInfo.Location = Regex.Match(startFileContent, @"地址 <br/></td><td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); return(newAccountInfo); }
private WechatSearchInfo CreateSearchInfoWithAccountNode(string srcPageDir, PhMenuNode accountNode) { var aNewInfo = new WechatSearchInfo(); aNewInfo.Account = Regex.Match(accountNode.Name, @"账号:(.*)\(.*\)").Groups[1].Value; aNewInfo.StartFile = Path.Combine(srcPageDir, Regex.Match(accountNode.Url, @".*\.html").Value); var friendNode = accountNode.Childs.First(p => p.Name.Contains("好友统计")); var groupNode = accountNode.Childs.First(p => p.Name.Contains("群联系人")); aNewInfo.FriendsFiles = MakeFilesPath(srcPageDir, accountNode, friendNode); aNewInfo.GroupsFiles = MakeFilesPath(srcPageDir, accountNode, groupNode); return(aNewInfo); }
public List <WechatGroup> ExtractGroups(WechatSearchInfo wechatAccountinfo) { var allGroups = new List <WechatGroup>(); for (var i = 0; i < wechatAccountinfo.GroupsFiles.Count(); i++) { var aFile = wechatAccountinfo.GroupsFiles[i]; if (i == 0) { allGroups.AddRange(GetGroupsInOneFile(aFile, FileOrder.First)); } else if (i == wechatAccountinfo.FriendsFiles.Count() - 1) { allGroups.AddRange(GetGroupsInOneFile(aFile, FileOrder.Last)); } else { allGroups.AddRange(GetGroupsInOneFile(aFile, FileOrder.Normal)); } } return(allGroups); }
public abstract WechatAccountInfo GetWechatInfoWithSearchInfo(WechatSearchInfo searchInfo);