/// <addNewSearchResult> /// Add a new search result in a database. /// </summary> /// <param name="dis">Set Values in a DiscoverySearch Class Property and Pass the same Object of DiscoverySearch Class.(Domain.DiscoverySearch)</param> public void addNewSearchResult(Domain.Myfashion.Domain.DiscoverySearch dis) { //Creates a database connection and opens up a session using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { //Proceed action to save data. session.Save(dis); transaction.Commit(); } //End Transaction } //End session }
//public void ScraperHasTage(ref FacebookUser fbUser, string Hash, Guid BoardfbPageId) //{ // GlobusHttpHelper HttpHelper = fbUser.globusHttpHelper; // string KeyWord = Hash; // string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord)); // List<string> pageSouceSplit = new List<string>(); // string[] trendingArr = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "li data-topicid="); // string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "uiLikePageButton"); // foreach (var item in PagesLink) // { // pageSouceSplit.Add(item); // } // PagesLink = PagesLink.Skip(1).ToArray(); // foreach (var item_pageSouceSplit in pageSouceSplit) // { // try // { // if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) // { // continue; // } // Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); // fbfeed.Id = Guid.NewGuid(); // fbfeed.Isvisible = true; // fbfeed.Message = listContent["Message"]; // fbfeed.Image = listContent["PostImage"]; // fbfeed.Description = listContent["Title"]; // string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); // string d = splitdate[0].Trim(); // string t = splitdate[1].Trim(); // fbfeed.Createddate = Convert.ToDateTime(d + " " + t); // fbfeed.Feedid = listContent["PostId"]; // fbfeed.Type = listContent["Type"]; // fbfeed.Type = listContent["Link"]; // fbfeed.Fbpageprofileid = BoardfbPageId; // if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId)) // { // boardrepo.addBoardFbPageFeed(fbfeed); // } // // Please Write Code get Dictionary data // // // } // catch { }; // } // try // { // string ajaxpipe_token = Utils.getBetween(pageSource_Home, "\"ajaxpipe_token\":\"", "\""); // string[] data_c = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "data-cursor="); // string cursor = Utils.getBetween(data_c[4], "\"", "="); // if (cursor.Contains("data-dedupekey")) // { // cursor = "-" + cursor; // cursor = Utils.getBetween(cursor, "-", "\""); // } // string sectionid = Utils.getBetween(pageSource_Home, "section_id\\\":", ","); // string userid = Utils.getBetween(pageSource_Home, "USER_ID\":\"", "\""); // string feed_Id = "90842368"; // string pager_id = "u_ps_0_0_1n"; // for (int i = 2; i < 50; i++) // { // try // { // Thread.Sleep(30 * 1000); // List<string> pageSouceSplitPagination = new List<string>(); // if (string.IsNullOrEmpty(fbUser.username)) // { // break; // } // //GlobusLogHelper.log.Info("Please wait... Searching for data from Page :" + i + " with User Name : " + fbUser.username); // string req = "https://www.facebook.com/ajax/pagelet/generic.php/LitestandMoreStoriesPagelet?ajaxpipe=1&ajaxpipe_token=" + ajaxpipe_token + "&no_script_path=1&data=%7B%22cursor%22%3A%22" + cursor + "%22%2C%22preload_next_cursor%22%3Anull%2C%22pager_config%22%3A%22%7B%5C%22edge%5C%22%3Anull%2C%5C%22source_id%5C%22%3Anull%2C%5C%22section_id%5C%22%3A" + sectionid + "%2C%5C%22pause_at%5C%22%3Anull%2C%5C%22stream_id%5C%22%3Anull%2C%5C%22section_type%5C%22%3A1%2C%5C%22sizes%5C%22%3Anull%2C%5C%22most_recent%5C%22%3Afalse%2C%5C%22unread_session%5C%22%3Afalse%2C%5C%22continue_top_news_feed%5C%22%3Afalse%2C%5C%22ranking_model%5C%22%3Anull%2C%5C%22unread_only%5C%22%3Afalse%7D%22%2C%22pager_id%22%3A%22" + pager_id + "%22%2C%22scroll_count%22%3A1%2C%22start_unread_session%22%3Afalse%2C%22start_continue_top_news_feed%22%3Afalse%2C%22feed_stream_id%22%3A" + feed_Id + "%2C%22snapshot_time%22%3Anull%7D&__user="******"&__a=1&__dyn=7nm8RW8BgCBynzpQ9UoHaEWCueyrhEK49oKiWFaaBGeqrYw8popyujhElx2ubhHximmey8szoyfwgo&__req=jsonp_2&__rev=1583304&__adt=" + i + ""; // // string respReq = HttpHelper.getHtmlfromUrl(new Uri(req)); // respReq = respReq.Replace("\\", "").Replace("u003C", "<"); // string[] arrrespReq = System.Text.RegularExpressions.Regex.Split(respReq, "source_id"); // feed_Id = Utils.getBetween(respReq, "feed_stream_id", "snapshot_time"); // feed_Id = Utils.getBetween(feed_Id, "A", "u"); // string[] pager_id1 = System.Text.RegularExpressions.Regex.Split(respReq, "_4-u2 mbl "); // pager_id = Utils.getBetween(pager_id1[2], "id=\"", "\""); // data_c = System.Text.RegularExpressions.Regex.Split(respReq, "data-cursor="); // if (data_c.Length < 8) // { // cursor = Utils.getBetween(data_c[data_c.Length - 1], "\"", "="); // } // cursor = Utils.getBetween(data_c[8], "\"", "="); // if (cursor.Contains("data-dedupekey")) // { // cursor = "-" + cursor; // cursor = Utils.getBetween(cursor, "-", "\""); // } // string[] PagesLinkPagination = System.Text.RegularExpressions.Regex.Split(respReq, "<span>Suggested Post</span>"); // foreach (var item in PagesLinkPagination) // { // pageSouceSplitPagination.Add(item); // } // PagesLink = System.Text.RegularExpressions.Regex.Split(respReq, "uiLikePageButton"); // foreach (var item in PagesLink) // { // pageSouceSplitPagination.Add(item); // } // foreach (var item_pageSouceSplit in pageSouceSplit) // { // try // { // if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) // { // continue; // } // Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); // fbfeed.Id = Guid.NewGuid(); // fbfeed.Isvisible = true; // fbfeed.Message = listContent["Message"]; // fbfeed.Image = listContent["PostImage"]; // fbfeed.Description = listContent["Title"]; // string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); // string d = splitdate[0].Trim(); // string t = splitdate[1].Trim(); // fbfeed.Createddate = Convert.ToDateTime(d + " " + t); // fbfeed.Feedid = listContent["PostId"]; // fbfeed.Type = listContent["Type"]; // fbfeed.Type = listContent["Link"]; // fbfeed.Fbpageprofileid = BoardfbPageId; // if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId)) // { // boardrepo.addBoardFbPageFeed(fbfeed); // } // // Please Write Code get Dictionary data // // // } // catch { }; // } // } // catch (Exception ex) // { //GlobusLogHelper.log.Error(ex.StackTrace); // } // } // } // catch // { } //} //public Dictionary<string, string> ScrapHasTagPages(string Value) //{ // string redirectionHref = string.Empty; // string title = string.Empty; // List<string[]> Likedata = new List<string[]>(); // Dictionary<string, string> HasTagData = new Dictionary<string, string>(); // // foreach (var Value in Likepages) // { // try // { // redirectionHref = Utils.getBetween(Value, "href=\"", "\""); // string profileUrl = redirectionHref;//1 // if (redirectionHref.Contains("https://www.facebook.com")) // { // string[] Arr_Title = System.Text.RegularExpressions.Regex.Split(Value, "<span class=\"fwb fcg\""); // foreach (var valuetitle in Arr_Title) // { // try // { // // title = Utils.getBetween(valuetitle, "<a", "/a>"); // title = Utils.getBetween(valuetitle, "\">", "/a>"); // if (!title.Equals(string.Empty)) // { // title = Utils.getBetween(title, "\">", "<"); // if (!string.IsNullOrEmpty(title)) // { // break; // } // } // } // catch (Exception) // { // } // } // string profileName = title;//2 // string Message = Utils.getBetween(Value, "<p>", "<").Replace("@", "@").Replace("&", "&").Replace("u0025", "%");//7 // string[] timeDetails = Regex.Split(Value, "<abbr"); // string postedTime = string.Empty; // try // { // postedTime = Utils.getBetween(timeDetails[1], "=\"", "\""); // } // catch { }; // string postid = string.Empty; // try // { // postid = Utils.getBetween(timeDetails[0], "fbid=", "&"); // if (postid == "") // { // postid = Utils.getBetween(timeDetails[0], "/posts/", "\" target="); // } // } // catch // { // } // string[] DetailedInfo = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"_6m7\">"); // string detail = string.Empty; // try // { // detail = "-" + DetailedInfo[1];//8 // detail = Utils.getBetween(detail, "-", "</div>").Replace("&", "&").Replace("u0025", "%"); // if (detail.Contains("<a ")) // { // string GetVisitUrl = Utils.getBetween(detail, "\">", "</a>"); // detail = Utils.getBetween("$$$####" + detail, "$$$####", "<a href=") + "-" + GetVisitUrl; // } // } // catch // { }; // string[] ArrDetail = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"mbs _6m6\">"); // string Titles = string.Empty; // // string Url = Utils.getBetween(ArrDetail[0], "", ""); // try // { // Titles = Utils.getBetween(ArrDetail[1], ">", "</a>").Replace("@", "@").Replace("&", "&").Replace("u0025", "%");//6 // if (Titles.Contains("Sachin Tendulkar")) // { // } // } // catch { }; // string SiteRedirectionUrl = string.Empty; // try // { // SiteRedirectionUrl = Utils.getBetween(ArrDetail[1], "LinkshimAsyncLink.swap(this, "", ");"); // } // catch { }; // try // { // SiteRedirectionUrl = Uri.UnescapeDataString(SiteRedirectionUrl).Replace("\\u0025", "%").Replace("\\", "");//4 // } // catch { }; // string websiteUrl = string.Empty; // try // { // websiteUrl = Utils.getBetween(SiteRedirectionUrl, "//", "/"); // } // catch { }; // string redirectionImg = string.Empty; // try // { // string[] adImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"scaledImageFitWidth img\""); // redirectionImg = Utils.getBetween(adImg[1], "src=\"", "\"").Replace("&", "&"); // } // catch { }; // string[] profImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"_s0 5xib 5sq7 _rw img\""); // string profileImg = string.Empty; // try // { // profileImg = Utils.getBetween(profImg[0], "src=\"", "\"").Replace("&", "&"); // } // catch { }; // HasTagData.Add("Title", title); // HasTagData.Add("Time", postedTime); // HasTagData.Add("Type", "link"); // HasTagData.Add("Message", Message); // HasTagData.Add("Image", profileImg); // HasTagData.Add("PostImage", redirectionImg); // HasTagData.Add("PostId", postid); // HasTagData.Add("Link", SiteRedirectionUrl); // } // } // catch { }; // } // return HasTagData; //} public static List <Domain.Myfashion.Domain.DiscoverySearch> ScraperHasTage(string Hash) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string KeyWord = Hash; string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord)); List <string> pageSouceSplit = new List <string>(); string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "_4-u2 mbm _5jmm _5pat _5v3q _4-u8"); foreach (var item in PagesLink) { pageSouceSplit.Add(item); } PagesLink = PagesLink.Skip(1).ToArray(); List <Domain.Myfashion.Domain.DiscoverySearch> discSearchList = new List <Domain.Myfashion.Domain.DiscoverySearch>(); foreach (var item_pageSouceSplit in pageSouceSplit) { Domain.Myfashion.Domain.DiscoverySearch discSearchObj = new Domain.Myfashion.Domain.DiscoverySearch(); try { if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) { continue; } Dictionary <string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); discSearchObj.Id = Guid.NewGuid(); discSearchObj.Message = listContent["Message"]; //discSearchObj.Image = listContent["PostImage"]; //discSearchObj.Description = listContent["Title"]; string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); string d = splitdate[0].Trim(); string t = splitdate[1].Trim(); discSearchObj.CreatedTime = Convert.ToDateTime(d + " " + t); discSearchObj.MessageId = listContent["PostId"]; //discSearchObj.Type = listContent["Type"]; //discSearchObj.Link = listContent["Link"]; discSearchObj.FromId = listContent["FromId"]; discSearchObj.FromName = listContent["FromName"]; //discSearchObj.Fbpageprofileid = BoardfbPageId; discSearchList.Add(discSearchObj); } catch { }; } return(discSearchList); }
//public void ScraperHasTage(ref FacebookUser fbUser, string Hash, Guid BoardfbPageId) //{ // GlobusHttpHelper HttpHelper = fbUser.globusHttpHelper; // string KeyWord = Hash; // string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord)); // List<string> pageSouceSplit = new List<string>(); // string[] trendingArr = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "li data-topicid="); // string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "uiLikePageButton"); // foreach (var item in PagesLink) // { // pageSouceSplit.Add(item); // } // PagesLink = PagesLink.Skip(1).ToArray(); // foreach (var item_pageSouceSplit in pageSouceSplit) // { // try // { // if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) // { // continue; // } // Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); // fbfeed.Id = Guid.NewGuid(); // fbfeed.Isvisible = true; // fbfeed.Message = listContent["Message"]; // fbfeed.Image = listContent["PostImage"]; // fbfeed.Description = listContent["Title"]; // string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); // string d = splitdate[0].Trim(); // string t = splitdate[1].Trim(); // fbfeed.Createddate = Convert.ToDateTime(d + " " + t); // fbfeed.Feedid = listContent["PostId"]; // fbfeed.Type = listContent["Type"]; // fbfeed.Type = listContent["Link"]; // fbfeed.Fbpageprofileid = BoardfbPageId; // if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId)) // { // boardrepo.addBoardFbPageFeed(fbfeed); // } // // Please Write Code get Dictionary data // // // } // catch { }; // } // try // { // string ajaxpipe_token = Utils.getBetween(pageSource_Home, "\"ajaxpipe_token\":\"", "\""); // string[] data_c = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "data-cursor="); // string cursor = Utils.getBetween(data_c[4], "\"", "="); // if (cursor.Contains("data-dedupekey")) // { // cursor = "-" + cursor; // cursor = Utils.getBetween(cursor, "-", "\""); // } // string sectionid = Utils.getBetween(pageSource_Home, "section_id\\\":", ","); // string userid = Utils.getBetween(pageSource_Home, "USER_ID\":\"", "\""); // string feed_Id = "90842368"; // string pager_id = "u_ps_0_0_1n"; // for (int i = 2; i < 50; i++) // { // try // { // Thread.Sleep(30 * 1000); // List<string> pageSouceSplitPagination = new List<string>(); // if (string.IsNullOrEmpty(fbUser.username)) // { // break; // } // //GlobusLogHelper.log.Info("Please wait... Searching for data from Page :" + i + " with User Name : " + fbUser.username); // string req = "https://www.facebook.com/ajax/pagelet/generic.php/LitestandMoreStoriesPagelet?ajaxpipe=1&ajaxpipe_token=" + ajaxpipe_token + "&no_script_path=1&data=%7B%22cursor%22%3A%22" + cursor + "%22%2C%22preload_next_cursor%22%3Anull%2C%22pager_config%22%3A%22%7B%5C%22edge%5C%22%3Anull%2C%5C%22source_id%5C%22%3Anull%2C%5C%22section_id%5C%22%3A" + sectionid + "%2C%5C%22pause_at%5C%22%3Anull%2C%5C%22stream_id%5C%22%3Anull%2C%5C%22section_type%5C%22%3A1%2C%5C%22sizes%5C%22%3Anull%2C%5C%22most_recent%5C%22%3Afalse%2C%5C%22unread_session%5C%22%3Afalse%2C%5C%22continue_top_news_feed%5C%22%3Afalse%2C%5C%22ranking_model%5C%22%3Anull%2C%5C%22unread_only%5C%22%3Afalse%7D%22%2C%22pager_id%22%3A%22" + pager_id + "%22%2C%22scroll_count%22%3A1%2C%22start_unread_session%22%3Afalse%2C%22start_continue_top_news_feed%22%3Afalse%2C%22feed_stream_id%22%3A" + feed_Id + "%2C%22snapshot_time%22%3Anull%7D&__user="******"&__a=1&__dyn=7nm8RW8BgCBynzpQ9UoHaEWCueyrhEK49oKiWFaaBGeqrYw8popyujhElx2ubhHximmey8szoyfwgo&__req=jsonp_2&__rev=1583304&__adt=" + i + ""; // // string respReq = HttpHelper.getHtmlfromUrl(new Uri(req)); // respReq = respReq.Replace("\\", "").Replace("u003C", "<"); // string[] arrrespReq = System.Text.RegularExpressions.Regex.Split(respReq, "source_id"); // feed_Id = Utils.getBetween(respReq, "feed_stream_id", "snapshot_time"); // feed_Id = Utils.getBetween(feed_Id, "A", "u"); // string[] pager_id1 = System.Text.RegularExpressions.Regex.Split(respReq, "_4-u2 mbl "); // pager_id = Utils.getBetween(pager_id1[2], "id=\"", "\""); // data_c = System.Text.RegularExpressions.Regex.Split(respReq, "data-cursor="); // if (data_c.Length < 8) // { // cursor = Utils.getBetween(data_c[data_c.Length - 1], "\"", "="); // } // cursor = Utils.getBetween(data_c[8], "\"", "="); // if (cursor.Contains("data-dedupekey")) // { // cursor = "-" + cursor; // cursor = Utils.getBetween(cursor, "-", "\""); // } // string[] PagesLinkPagination = System.Text.RegularExpressions.Regex.Split(respReq, "<span>Suggested Post</span>"); // foreach (var item in PagesLinkPagination) // { // pageSouceSplitPagination.Add(item); // } // PagesLink = System.Text.RegularExpressions.Regex.Split(respReq, "uiLikePageButton"); // foreach (var item in PagesLink) // { // pageSouceSplitPagination.Add(item); // } // foreach (var item_pageSouceSplit in pageSouceSplit) // { // try // { // if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) // { // continue; // } // Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); // fbfeed.Id = Guid.NewGuid(); // fbfeed.Isvisible = true; // fbfeed.Message = listContent["Message"]; // fbfeed.Image = listContent["PostImage"]; // fbfeed.Description = listContent["Title"]; // string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); // string d = splitdate[0].Trim(); // string t = splitdate[1].Trim(); // fbfeed.Createddate = Convert.ToDateTime(d + " " + t); // fbfeed.Feedid = listContent["PostId"]; // fbfeed.Type = listContent["Type"]; // fbfeed.Type = listContent["Link"]; // fbfeed.Fbpageprofileid = BoardfbPageId; // if (!boardrepo.checkFacebookFeedExists(fbfeed.Feedid, BoardfbPageId)) // { // boardrepo.addBoardFbPageFeed(fbfeed); // } // // Please Write Code get Dictionary data // // // } // catch { }; // } // } // catch (Exception ex) // { //GlobusLogHelper.log.Error(ex.StackTrace); // } // } // } // catch // { } //} //public Dictionary<string, string> ScrapHasTagPages(string Value) //{ // string redirectionHref = string.Empty; // string title = string.Empty; // List<string[]> Likedata = new List<string[]>(); // Dictionary<string, string> HasTagData = new Dictionary<string, string>(); // // foreach (var Value in Likepages) // { // try // { // redirectionHref = Utils.getBetween(Value, "href=\"", "\""); // string profileUrl = redirectionHref;//1 // if (redirectionHref.Contains("https://www.facebook.com")) // { // string[] Arr_Title = System.Text.RegularExpressions.Regex.Split(Value, "<span class=\"fwb fcg\""); // foreach (var valuetitle in Arr_Title) // { // try // { // // title = Utils.getBetween(valuetitle, "<a", "/a>"); // title = Utils.getBetween(valuetitle, "\">", "/a>"); // if (!title.Equals(string.Empty)) // { // title = Utils.getBetween(title, "\">", "<"); // if (!string.IsNullOrEmpty(title)) // { // break; // } // } // } // catch (Exception) // { // } // } // string profileName = title;//2 // string Message = Utils.getBetween(Value, "<p>", "<").Replace("@", "@").Replace("&", "&").Replace("u0025", "%");//7 // string[] timeDetails = Regex.Split(Value, "<abbr"); // string postedTime = string.Empty; // try // { // postedTime = Utils.getBetween(timeDetails[1], "=\"", "\""); // } // catch { }; // string postid = string.Empty; // try // { // postid = Utils.getBetween(timeDetails[0], "fbid=", "&"); // if (postid == "") // { // postid = Utils.getBetween(timeDetails[0], "/posts/", "\" target="); // } // } // catch // { // } // string[] DetailedInfo = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"_6m7\">"); // string detail = string.Empty; // try // { // detail = "-" + DetailedInfo[1];//8 // detail = Utils.getBetween(detail, "-", "</div>").Replace("&", "&").Replace("u0025", "%"); // if (detail.Contains("<a ")) // { // string GetVisitUrl = Utils.getBetween(detail, "\">", "</a>"); // detail = Utils.getBetween("$$$####" + detail, "$$$####", "<a href=") + "-" + GetVisitUrl; // } // } // catch // { }; // string[] ArrDetail = System.Text.RegularExpressions.Regex.Split(Value, "<div class=\"mbs _6m6\">"); // string Titles = string.Empty; // // string Url = Utils.getBetween(ArrDetail[0], "", ""); // try // { // Titles = Utils.getBetween(ArrDetail[1], ">", "</a>").Replace("@", "@").Replace("&", "&").Replace("u0025", "%");//6 // if (Titles.Contains("Sachin Tendulkar")) // { // } // } // catch { }; // string SiteRedirectionUrl = string.Empty; // try // { // SiteRedirectionUrl = Utils.getBetween(ArrDetail[1], "LinkshimAsyncLink.swap(this, "", ");"); // } // catch { }; // try // { // SiteRedirectionUrl = Uri.UnescapeDataString(SiteRedirectionUrl).Replace("\\u0025", "%").Replace("\\", "");//4 // } // catch { }; // string websiteUrl = string.Empty; // try // { // websiteUrl = Utils.getBetween(SiteRedirectionUrl, "//", "/"); // } // catch { }; // string redirectionImg = string.Empty; // try // { // string[] adImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"scaledImageFitWidth img\""); // redirectionImg = Utils.getBetween(adImg[1], "src=\"", "\"").Replace("&", "&"); // } // catch { }; // string[] profImg = System.Text.RegularExpressions.Regex.Split(Value, "<img class=\"_s0 5xib 5sq7 _rw img\""); // string profileImg = string.Empty; // try // { // profileImg = Utils.getBetween(profImg[0], "src=\"", "\"").Replace("&", "&"); // } // catch { }; // HasTagData.Add("Title", title); // HasTagData.Add("Time", postedTime); // HasTagData.Add("Type", "link"); // HasTagData.Add("Message", Message); // HasTagData.Add("Image", profileImg); // HasTagData.Add("PostImage", redirectionImg); // HasTagData.Add("PostId", postid); // HasTagData.Add("Link", SiteRedirectionUrl); // } // } // catch { }; // } // return HasTagData; //} public static List<Domain.Myfashion.Domain.DiscoverySearch> ScraperHasTage(string Hash) { GlobusHttpHelper HttpHelper = new GlobusHttpHelper(); string KeyWord = Hash; string pageSource_Home = HttpHelper.getHtmlfromUrl(new Uri("https://www.facebook.com/hashtag/" + KeyWord)); List<string> pageSouceSplit = new List<string>(); string[] PagesLink = System.Text.RegularExpressions.Regex.Split(pageSource_Home, "_4-u2 mbm _5jmm _5pat _5v3q _4-u8"); foreach (var item in PagesLink) { pageSouceSplit.Add(item); } PagesLink = PagesLink.Skip(1).ToArray(); List<Domain.Myfashion.Domain.DiscoverySearch> discSearchList = new List<Domain.Myfashion.Domain.DiscoverySearch>(); foreach (var item_pageSouceSplit in pageSouceSplit) { Domain.Myfashion.Domain.DiscoverySearch discSearchObj = new Domain.Myfashion.Domain.DiscoverySearch(); try { if (item_pageSouceSplit.Contains("<!DOCTYPE html>")) { continue; } Dictionary<string, string> listContent = ScrapHasTagPages(item_pageSouceSplit); // Domain.Socioboard.Domain.Boardfbfeeds fbfeed = new Domain.Socioboard.Domain.Boardfbfeeds(); discSearchObj.Id = Guid.NewGuid(); discSearchObj.Message = listContent["Message"]; //discSearchObj.Image = listContent["PostImage"]; //discSearchObj.Description = listContent["Title"]; string[] splitdate = System.Text.RegularExpressions.Regex.Split(listContent["Time"], "at"); string d = splitdate[0].Trim(); string t = splitdate[1].Trim(); discSearchObj.CreatedTime = Convert.ToDateTime(d + " " + t); discSearchObj.MessageId = listContent["PostId"]; //discSearchObj.Type = listContent["Type"]; //discSearchObj.Link = listContent["Link"]; discSearchObj.FromId = listContent["FromId"]; discSearchObj.FromName = listContent["FromName"]; //discSearchObj.Fbpageprofileid = BoardfbPageId; discSearchList.Add(discSearchObj); } catch { }; } return discSearchList; }
public void deleteSearchResult(Domain.Myfashion.Domain.DiscoverySearch dis) { throw new NotImplementedException(); }