/// <summary> /// Populate Missing RG Links / IMDb IDs using Post URLs /// </summary> public void Backfill_ReleaseBB_Links(RadProgressBar Bar = null, bool NewThread = true) { if (NewThread) { Thread newThread = new Thread(() => Backfill_ReleaseBB_Links(Bar, false)); // Function To Execute newThread.Name = "Populate Missing Actor Info"; newThread.IsBackground = true; newThread.Start(); } else { List <ReleaseBBMovies> pages = ReleaseBBMovies_ReturnSQLList(); if (Bar != null) { pro.SetupProgressBar(Bar, pages.Count); } // setup progress bar if passed in int i = 1; foreach (ReleaseBBMovies page in pages) { string html = ahk.Download_HTML(page.PostURL); List <string> links = rg.Regex_RGLinks(html); string IMDbID = imdb.IMDbFromHTML(html); string RGLinks = lst.List_To_String(links, "\n"); ReleaseBBMovies obj = new ReleaseBBMovies(); obj.PostURL = page.PostURL; obj.IMDbID = IMDbID; obj.RapidGator = RGLinks; ReleaseBBMovies_UpdateSQL_Links(obj); if (Bar != null) { pro.UpdateProgress(Bar, i + "/" + pages.Count); } i++; } } }
public bool RGP(int PageNum = 1) { string url = "http://rgporn.com/index.php?newsid=" + PageNum; //tel.Update(txtURL, url); string html = web.DownloadHTML(url); if (html == "") { return(false); } resultLines = xml.Parse_HTML_XML(html, "//body/div/div/div/div/table/tbody/tr/td/div/div/div/p"); // extract sections of text from html xml // extract tags string display = "TAGS: "; List <string> tags = new List <string>(); string Tags = ""; foreach (string line in resultLines) { if (line.Contains("=tags")) { string tag = line.Replace("<a", ""); tag = tag.Replace("</a>", ""); tag = ahk.StringSplit(tag, ">", 1); tag = tag.Trim(); tags.Add(tag); display = display + "\n" + tag; if (Tags != "") { Tags = Tags + "|" + tag; } if (Tags == "") { Tags = tag; } } } // extract title List <string> titleLines = xml.Parse_HTML_XML(html, "//body/div/div/div/div/table/tbody/tr/td/div/div/div"); // extract sections of text from html xml string title = lst.Return_List_Value(titleLines, 2); title = title.Replace("<h1 class=\"shead\">", ""); title = title.Replace("</h1>", ""); string imagehtml = ""; foreach (string ima in titleLines) { if (ima.Contains(".jpg")) { imagehtml = imagehtml + "\n" + ima; } } //ahk.MsgBox(title); List <string> links = rg.Regex_RGLinks(html); bool AllOnline = true; int onlineLinkCount = 0; string linkText = ""; foreach (string link in links) { RGInfo info = rg.RapidGatorCheckStatus(link); if (!info.FileOnline) { AllOnline = false; } else { onlineLinkCount++; } string wlink = link + "|" + info.FileSize; if (linkText != "") { linkText = linkText + "\n" + wlink; } if (linkText == "") { linkText = wlink; } } string linksMsg = onlineLinkCount + "/" + links.Count + " Links Online"; // Extract / Display Images From Page int downloaded = 0; if (AllOnline) { string SaveDir = ahk.AppDir() + "\\Posts\\RGP\\" + ahk.AddLeadingZeros(PageNum, 5).ToString(); ahk.FileCreateDir(SaveDir); ahk.Sleep(500); ahk.FileAppend(Tags, SaveDir + "\\Tags.txt"); ahk.FileAppend(title, SaveDir + "\\Title.txt"); ahk.FileAppend(linkText, SaveDir + "\\Links.txt"); downloaded = DownloadImages(imagehtml, SaveDir, ahk.AddLeadingZeros(PageNum, 5).ToString()); //tel.Update(txtResults, "Title: " + title + "\n\nTags: " + Tags + "\n\n" + linksMsg); } //ahk.MsgBox("Found " + links.Count + " Links\nDownloaded " + downloaded.ToString() + " + Images"); return(AllOnline); }
//_Parse.XML xml = new _Parse.XML(); //_AHK ahk = new _AHK(); //_Database.SQL sql = new _Database.SQL(); //_Lists lst = new _Lists(); //_Parse prs = new _Parse(); ////_Images img = new _Images(); //_TelerikLib.RadProgress pro = new _TelerikLib.RadProgress(); //_TelerikLib tel = new _TelerikLib(); ////_Apps.Chrome cr = new _Apps.Chrome(); //sharpAHK_Dev._Threads thr = new sharpAHK_Dev._Threads(); //_TelerikLib.RadTree tree = new _TelerikLib.RadTree(); //IAFD iafd = new IAFD(); //_Web.ADBSites.PBBForum pbb = new _Web.ADBSites.PBBForum(); //_Web.ADBSites.PRNWForum prnw = new _Web.ADBSites.PRNWForum(); #endregion public void Download_Site(int startPage = 1, int LastPage = 230, bool SkipExisting = true, RadProgressBar Bar = null, RadProgressBar Bar2 = null, bool NewThread = true) { _AHK ahk = new _AHK(); _Lists lst = new _Lists(); _Sites.RapidGator rg = new _Sites.RapidGator(); _TelerikLib.RadProgress pro = new _TelerikLib.RadProgress(); if (NewThread) { Thread newThread = new Thread(() => Download_Site(startPage, LastPage, SkipExisting, Bar, Bar2, false)); // Function To Execute newThread.IsBackground = true; newThread.Start(); } else { int pageNum = startPage; do { int postNum = 0; string html = ahk.Download_HTML("http://pornchil.com/page/" + pageNum + "/"); List <string> lines = lst.Text_To_List(html, true, true, false); if (Bar != null) { pro.SetupProgressBar(Bar, 10); } // # of posts/page foreach (string line in lines) { if (line.Contains("<h1 class=\"entry-title\"><a href=")) { PrnChill chill = new PrnChill(); //ahk.MsgBox(line); string Line = line.Replace("<h1 class=\"entry-title\"><a href=\"", ""); chill.PostURL = ahk.StringSplit(Line, "\"", 0); chill.PostName = ahk.StringSplit(Line, ">", 1); chill.PostName = ahk.StringSplit(chill.PostName, "<", 0); if (SkipExisting) { if (AlreadyParsed(chill.PostURL)) { continue; } // check to see if this post already has an entry, if so skip } if (Bar != null) { postNum++; pro.UpdateProgress(Bar, postNum + "/10"); } // # of posts remaining string postHTML = ahk.Download_HTML(chill.PostURL); List <string> links = rg.Regex_RGLinks(postHTML); if (links.Count > 0) { if (Bar != null) { pro.ProgressText(Bar, postNum + "/10 | Verifying Links"); } // # of posts remaining List <_Sites.RapidGator.RGInfo> checkedLinks = rg.RapidGator_BatchCheck(links, true, Bar2); // batch check list of rg links string rglinks = ""; int goodLinkCount = 0; foreach (_Sites.RapidGator.RGInfo link in checkedLinks) { if (rglinks == "") { rglinks = link.FileURL + "|" + link.FileSize; goodLinkCount++; } else { rglinks = rglinks + "\n" + link.FileURL + "|" + link.FileSize; goodLinkCount++; } } chill.Links = rglinks; // online rg links with filepath|filesize return chill.LinkCount = goodLinkCount; chill.LinkCheckDate = DateTime.Now.ToString(); } chill.InCollection = "false"; List <string> images = rg.JpgImageLinks(postHTML); if (Bar != null) { pro.ProgressText(Bar, postNum + "/10 | Downloading Images (" + images.Count + ")"); } // # of posts remaining if (images.Count > 0) { // create save dir string saveDir = ahk.AppDir() + "\\PrnChillPosts"; ahk.FileCreateDir(saveDir); saveDir = saveDir + "\\" + chill.PostName; ahk.FileCreateDir(saveDir); chill.ImageDir = saveDir; int imgNum = 1; foreach (string image in images) { ahk.Download_File(image, saveDir + "\\" + imgNum + ".jpg", true); imgNum++; } } PrnChill_UpdateInsert(chill); } } pageNum++; } while (pageNum <= LastPage); } }