private void lay_thong_tin_user(FACEBOOK_USER ip_user, BackgroundWorker ip_wk) { try { FBCrawlerV2Entities v_model = new FBCrawlerV2Entities(); INFO v_info = new INFO(); //========= v_info.ID = ip_user.ID; v_info.LIVING = get_living(ip_user.ID.Trim()); v_info.CONTACT_INFO = get_contact_info(ip_user.ID.Trim()); v_info.EDUCATION = get_education(ip_user.ID.Trim()); //========= v_model.INFOes.Add(v_info); v_model.SaveChanges(); ip_wk.ReportProgress(1); } catch (Exception) { } }
private int getAllUser(HttpWebResponse ip_http_response) { string v_str_json = getJsonFromWebResponse(ip_http_response); string v_str_html = getHTMLFromJson(v_str_json); HtmlAgilityPack.HtmlDocument v_doc = new HtmlAgilityPack.HtmlDocument(); v_doc.LoadHtml(v_str_html); var findclasses = v_doc.DocumentNode.Descendants("li").Where(d => d.Attributes.Contains("class") && d.Attributes["class"].Value.Contains("fbProfileBrowserListItem")).ToList(); int v_count = 0; foreach (var item in findclasses) { try { FBCrawlerV2Entities v_model = new FBCrawlerV2Entities(); FACEBOOK_USER v_fb_user = new FACEBOOK_USER(); v_fb_user.NAME = item.Descendants("div").Where(d => d.Attributes.Contains("class") && d.Attributes["class"].Value.Contains("fsl fwb fcb")).First().InnerText; var v_user = item.Descendants("a").Where(d => d.Attributes.Contains("class") && d.Attributes["class"].Value.Contains("_8o _8t lfloat _ohe")).First(); v_fb_user.PROFILE_LINK = v_user.Attributes["href"].Value.ToString().Split('?')[0]; var v_str_contain_id = v_user.Attributes["data-hovercard"].Value.ToString(); v_fb_user.ID = GetSubStrings(v_str_contain_id, "id=", "&").First(); v_fb_user.GET_BY = m_id_admin; v_fb_user.GET_TIME = DateTime.Now; v_fb_user.LANGUAGE = detectLanguage(v_fb_user.NAME); v_fb_user.CHECKED = false; v_model.FACEBOOK_USER.Add(v_fb_user); v_model.SaveChanges(); v_count += 1; if (v_fb_user.LANGUAGE.Contains("vi")) { m_stk.Push(v_fb_user.ID); } } catch (Exception) { } } return(v_count); }