public void DownloadingImage(int delay) { try { GloBoardPro.lstThread.Add(Thread.CurrentThread); Thread.CurrentThread.IsBackground = true; GloBoardPro.lstThread = GloBoardPro.lstThread.Distinct().ToList(); } catch { }; try { foreach (string itemImageTag in ClGlobul.ImageTagForScrap) { startDownloadingImage(itemImageTag, delay); Thread.Sleep(5000); } classsforlogger objclasssforlogger1 = new classsforlogger(); objclasssforlogger1.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Process Completed ]"); // AddTophotoLogger("[ " + DateTime.Now + " ] =>[Process completed."); } catch { } }
public void startDownloadingImage(string itemImageTag, int delay) { string pageSource = string.Empty; List <string> lstCountScrape = new List <string>(); if (stopScrapImageBool) { return; } //try //{ GlobDramProHttpHelper _GlobusHttpHelper = new GlobDramProHttpHelper(); try { pageSource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(mainUrl), ""); } catch { } string url = string.Empty; if (!string.IsNullOrEmpty(pageSource)) { if (itemImageTag.Contains("#")) { itemImageTag = itemImageTag.Replace("#", "%23"); url = mainUrl + "tag/" + itemImageTag.Replace("%23", string.Empty); } else { url = mainUrl + "n/" + itemImageTag.Replace("%23", string.Empty); } try { pageSource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(url), ""); } catch { } if (!string.IsNullOrEmpty(pageSource)) { // if (pageSource.Contains("<div class=\"mainimg_wrapper\">")) if (pageSource.Contains("class=\"username\"")) { try { // string[] arr = Regex.Split(pageSource, "<div class=\"mainimg_wrapper\">"); string[] arr = Regex.Split(pageSource, "class=\"username\""); if (arr.Length > 1) { arr = arr.Skip(1).ToArray(); foreach (var item in arr) { string websiteLink = ScrapUserName.getBetween(item, "<a href=\"", "\""); websiteLink = "http://websta.me/" + websiteLink; string imageLink = ScrapUserName.getBetween(item, "src=\"", "\""); string imageid = ScrapUserName.getBetween(item, ".2885-19/", "_a.jpg\">"); string FullName = ScrapUserName.getBetween(item, "\">", "</a>"); lstCountScrape.Add(imageLink); lstCountScrape = lstCountScrape.Distinct().ToList(); if (stopScrapImageBool) { return; } try { if (!string.IsNullOrEmpty(imageLink)) { duplicatlink.Add(imageLink, imageid); string CSVData = websiteLink.Replace(",", string.Empty) + "," + imageLink.Replace(",", string.Empty) + "," + imageid.Replace(",", string.Empty) + "," + FullName.Replace(",", string.Empty); GramBoardProFileHelper.ExportDataCSVFile(CSVHeader, CSVData, CSVPath); classsforlogger objclasssforlogger = new classsforlogger(); objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ websiteLink : " + websiteLink + " imageLink : " + imageLink + " imageid : " + imageid + " FullName : " + FullName); //frm_stagram objbbbFrmMain = (frm_stagram)Application.OpenForms["frm_stagram"]; //objbbbFrmMain.lstImageLogger.Items.Add("hey ram"); if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload) { return; } } } catch { } if (stopScrapImageBool) { return; } try { classsforlogger objclasssforlogger = new classsforlogger(); lock (_lockObject) { try { frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"]; if (!string.IsNullOrEmpty(objfrm_stagram.txtmaxDelayGetImageImage.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtmaxDelayGetImageImage.Text)) { mindelay = Convert.ToInt32(objfrm_stagram.txtmaxDelayGetImageImage.Text); } if (!string.IsNullOrEmpty(objfrm_stagram.txtminDelayGetImageImage.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtminDelayGetImageImage.Text)) { maxdelay = Convert.ToInt32(objfrm_stagram.txtminDelayGetImageImage.Text); } Random obj_rn = new Random(); int delay1 = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay1 = obj_rn.Next(mindelay, maxdelay); objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay1 + " Seconds ]"); Thread.Sleep(delay1 * 1000); } catch { } } //HashLogger.printLogger("[ " + DateTime.Now + " ] => [ " + imageId + " ]"); //HashLogger.printLogger("[ " + DateTime.Now + " ] => [ Delay for " + delay + " seconds ]"); objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ " + websiteLink + " ]"); //objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Delay for " + delay + " seconds ]"); //Thread.Sleep(delay * 1000); if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload) { return; } } catch { }; } } if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload) { return; } } catch { }; } } } classsforlogger objclasssforlogger1 = new classsforlogger(); objclasssforlogger1.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Process Completed ]"); }
public void startDownloadingImage(string itemImageTag, int delay) { string pageSource = string.Empty; List<string> lstCountScrape = new List<string>(); if (stopScrapImageBool) return; //try //{ GlobDramProHttpHelper _GlobusHttpHelper = new GlobDramProHttpHelper(); try { pageSource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(mainUrl),""); } catch { } string url = string.Empty; if (!string.IsNullOrEmpty(pageSource)) { if (itemImageTag.Contains("#")) { itemImageTag = itemImageTag.Replace("#", "%23"); url = mainUrl + "tag/" + itemImageTag.Replace("%23", string.Empty); } else { url = mainUrl + "n/" + itemImageTag.Replace("%23", string.Empty); } try { pageSource = _GlobusHttpHelper.getHtmlfromUrl(new Uri(url),""); } catch { } if (!string.IsNullOrEmpty(pageSource)) { // if (pageSource.Contains("<div class=\"mainimg_wrapper\">")) if (pageSource.Contains("class=\"username\"")) { try { // string[] arr = Regex.Split(pageSource, "<div class=\"mainimg_wrapper\">"); string[] arr = Regex.Split(pageSource, "class=\"username\""); if (arr.Length > 1) { arr = arr.Skip(1).ToArray(); foreach (var item in arr) { string websiteLink = ScrapUserName.getBetween(item, "<a href=\"", "\""); websiteLink = "http://websta.me/" + websiteLink; string imageLink = ScrapUserName.getBetween(item, "src=\"", "\""); string imageid = ScrapUserName.getBetween(item, ".2885-19/", "_a.jpg\">"); string FullName = ScrapUserName.getBetween(item, "\">", "</a>"); lstCountScrape.Add(imageLink); lstCountScrape = lstCountScrape.Distinct().ToList(); if (stopScrapImageBool) return; try { if (!string.IsNullOrEmpty(imageLink)) { duplicatlink.Add(imageLink, imageid); string CSVData = websiteLink.Replace(",", string.Empty) + "," + imageLink.Replace(",", string.Empty) + "," + imageid.Replace(",", string.Empty) + "," + FullName.Replace(",", string.Empty); GramBoardProFileHelper.ExportDataCSVFile(CSVHeader, CSVData, CSVPath); classsforlogger objclasssforlogger = new classsforlogger(); objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ websiteLink : " + websiteLink + " imageLink : " + imageLink + " imageid : " + imageid + " FullName : " + FullName); //frm_stagram objbbbFrmMain = (frm_stagram)Application.OpenForms["frm_stagram"]; //objbbbFrmMain.lstImageLogger.Items.Add("hey ram"); if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload) { return; } } } catch { } if (stopScrapImageBool) return; try { classsforlogger objclasssforlogger = new classsforlogger(); lock (_lockObject) { try { frm_stagram objfrm_stagram = (frm_stagram)Application.OpenForms["frm_stagram"]; if (!string.IsNullOrEmpty(objfrm_stagram.txtmaxDelayGetImageImage.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtmaxDelayGetImageImage.Text)) { mindelay = Convert.ToInt32(objfrm_stagram.txtmaxDelayGetImageImage.Text); } if (!string.IsNullOrEmpty(objfrm_stagram.txtminDelayGetImageImage.Text) && NumberHelper.ValidateNumber(objfrm_stagram.txtminDelayGetImageImage.Text)) { maxdelay = Convert.ToInt32(objfrm_stagram.txtminDelayGetImageImage.Text); } Random obj_rn = new Random(); int delay1 = RandomNumberGenerator.GenerateRandom(mindelay, maxdelay); delay1 = obj_rn.Next(mindelay, maxdelay); objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Delay For " + delay1 + " Seconds ]"); Thread.Sleep(delay1 * 1000); } catch { } } //HashLogger.printLogger("[ " + DateTime.Now + " ] => [ " + imageId + " ]"); //HashLogger.printLogger("[ " + DateTime.Now + " ] => [ Delay for " + delay + " seconds ]"); objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ " + websiteLink + " ]"); //objclasssforlogger.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Delay for " + delay + " seconds ]"); //Thread.Sleep(delay * 1000); if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload) { return; } } catch { }; } } if (lstCountScrape.Count >= ClGlobul.countNOOfFollowersandImageDownload) { return; } } catch { }; } } } classsforlogger objclasssforlogger1 = new classsforlogger(); objclasssforlogger1.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Process Completed ]"); }
public void DownloadingImage(int delay) { try { GloBoardPro.lstThread.Add(Thread.CurrentThread); Thread.CurrentThread.IsBackground = true; GloBoardPro.lstThread = GloBoardPro.lstThread.Distinct().ToList(); } catch { }; try { foreach (string itemImageTag in ClGlobul.ImageTagForScrap) { startDownloadingImage(itemImageTag,delay); Thread.Sleep(5000); } classsforlogger objclasssforlogger1 = new classsforlogger(); objclasssforlogger1.AddToImageTagLogger("[ " + DateTime.Now + " ] => [ Process Completed ]"); // AddTophotoLogger("[ " + DateTime.Now + " ] =>[Process completed."); } catch { } }