Ejemplo n.º 1
0
        public override void Download(object obj)
        {
            AsynObj o = (AsynObj)obj;



            string content = DlTool.GetHtml(o.Url, DlConfig.useProxy);

            if (content == "")
            {
                return;
            }
            string[] contents = null;
            try
            {
                contents = content.Split(new string[] { "<td align=\"center\">" }, StringSplitOptions.RemoveEmptyEntries);
                content  = contents[1];
            }
            catch
            {
                Console.WriteLine("split error");
                Download(o);
            }

            if (o.Path != null)
            {
                DlTool.SaveFile(content, Path.Combine(o.Path, DlTool.ReplaceUrl(o.Url) + ".htm"));
            }
            RarbgSgDl sgDl    = new RarbgSgDl();
            AsynObj   asynObj = new AsynObj();

            asynObj.Path    = o.Path;
            asynObj.Content = content;
            ThreadPool.QueueUserWorkItem(sgDl.Download, asynObj);
        }
Ejemplo n.º 2
0
        private void work(object obj)
        {
            string          genreStr = "";
            MatchCollection genresMatches;
            AsynObj         o       = (AsynObj)obj;
            string          content = DlTool.GetHtml(o.Url, DlConfig.useProxy);

            o.SingleContent = content;
            string   dateString  = releaseDateRegex.Match(content).Value.Replace("\"releaseDate\">", "").Replace("</td></tr>", "");
            DateTime releaseDate = Convert.ToDateTime(dateString);
            string   url         = "https://rarbg.to/" + torrentRegex.Match(content).Value;
            Match    genres      = genresRegex.Match(content);
            string   path        = "";

            if (genres != null && genres.Value != "")
            {
                genresMatches = genresRegex1.Matches(genres.Value);
                foreach (Match m in genresMatches)
                {
                    genreStr += m.Value.Replace("search=", "").Replace("\"", "").ToLower().Replace("+", " ") + ",";
                }
            }
            if (check1(url.Substring(url.LastIndexOf('=') + 1).ToLower()))
            {
                path = Path.Combine(o.Path, genreStr + "$$" + url.Substring(url.LastIndexOf('=') + 1)).Replace("%22", "");
            }
            else if (!check2(url.Substring(url.LastIndexOf('=') + 1).ToLower()))
            {
                path = Path.Combine(o.Path, "notok", genreStr + "$$" + url.Substring(url.LastIndexOf('=') + 1)).Replace("%22", "");
            }
            else if (releaseDate.CompareTo(new DateTime(2014, 8, 1)) < 0)
            {
                if (genres != null && genres.Value != "")
                {
                    int res = check(genreStr.Substring(0, genreStr.Length - 1).Replace("%22", ""));
                    if (res == 1)
                    {
                        path = Path.Combine(o.Path, genreStr + "$$" + url.Substring(url.LastIndexOf('=') + 1)).Replace("%22", "");
                    }
                    else if (res == -1)
                    {
                        path = Path.Combine(o.Path, "notok", genreStr + "$$" + url.Substring(url.LastIndexOf('=') + 1)).Replace("%22", "");
                    }
                    else
                    {
                        path = Path.Combine(o.Path, "unknown", genreStr + "$$" + url.Substring(url.LastIndexOf('=') + 1)).Replace("%22", "");
                    }
                }
                else
                {
                    path = Path.Combine(o.Path, "unknown", url.Substring(url.LastIndexOf('=') + 1)).Replace("%22", "");
                }
            }
            else
            {
                path = Path.Combine(o.Path, "unknown", url.Substring(url.LastIndexOf('=') + 1)).Replace("%22", "");
            }
            path = path.Replace("%20", " ").Replace("%2C", " ");
            DlTool.downLoadFile(url, path, DlConfig.useProxy, content);
        }