public void getLikesData(string url, string name, int index, int size)// 친구 정보를 바탕으로 '좋아요를 누른 페이지' 정보 가져오는 중심 메소드 { string tempCode = ""; form1.taskText.Text += "Entering page class data gathering process for friend " + name + "...\r\n"; form1.taskText.Text += index.ToString() + "th friend of " + size.ToString() + " friends" + "\r\n\r\n"; Application.DoEvents(); string tag = "//body/div[@class='_li']/div/div/div/div[@id='mainContainer']/div[@id='contentCol']/div[@id='contentArea']/div[@class='_5h60']/div/div/div/div/div[@class='_3i9']/div/ul/li/div[@class='_3owb']/div/div/div/div"; gathering gather = new gathering(form1, form2); tempCode = gather.getHtml(url); HtmlAgilityPack.HtmlNodeCollection nameCol = null; HtmlAgilityPack.HtmlNodeCollection classCol = null; nameCol = parseTextFunc(tag + "/div[@class='fsl fwb fcb']", tempCode); classCol = parseTextFunc(tag + "/div[@class='fsm fwn fcg']", tempCode); getPageName(nameCol); getPageClass(classCol); //output(pageInfoList); form1.taskText.Text += "Complete gathering page Class data\r\n"; output(); form1.taskText.Text += "the number of gathered item = " + dictionary.Count.ToString() + "\r\n\r\n"; dataOut(); }
}// 자동 로그인 메소드 private void dowork(/*object sender, DoWorkEventArgs e*/) { frm.taskText.Text += "Entering friends list gathering process...\r\n\r\n"; Application.DoEvents(); string htmlCode = ""; gathering Gatherer = new gathering(frm, this); htmlCode = Gatherer.getHtml("https://m.facebook.com/profile.php?v=friends&ref=bookmarks"); handling hand = new handling(frm, this); //frm.parsedCode.Text = ""; hand.getFriendsData(htmlCode); // 친구 정보 파싱하기 this.dataList = hand.getList(); // 정보 리스트 가져오기 expectedTime = new TimeSpan(0, 0, dataList.Count * 15 + 15); expectedTimer.Text = expectedTime.ToString(); int tempCnt = 0; int achieve = dataList.Count; try { if (achieve > Int32.Parse(achieveLimit.Text)) { achieve = Int32.Parse(achieveLimit.Text); frm.taskText.Text += "Achieve Limit setted : " + achieve.ToString() + "\r\n\r\n"; } } catch (Exception) { frm.taskText.Text += "Achieve Limit setted : for all\r\n\r\n"; } foreach (personalData data in dataList) { if (tempCnt >= achieve) { break; } ++tempCnt; browser.Focus(); hand.getLikesData("https://facebook.com" + data.href + "&sk=likes", data.name, tempCnt, dataList.Count); // 좋아요 정보 파싱 } System.Diagnostics.Process.Start("cmd.exe", "/c " + Application.StartupPath + "//python//python.bat"); }