Exemple #1
0
        //https://youiv.tv/data/attachment/forum/201803/13/230458ayftyotraggsy7ts.jpg
        public override System.Collections.ArrayList alys(string content, string path, string vid, bool ifCheckHis)
        {
            His       his     = new His();
            ArrayList resList = new ArrayList();

            //if (!Path.GetFileNameWithoutExtension(path).StartsWith("[") || Path.GetFileNameWithoutExtension(path).StartsWith("[]"))
            if (!Path.GetFileNameWithoutExtension(path).StartsWith("["))
            {
                Tool.MoveFile("unknown", path);
                return(resList);
            }

            //string value = idRegex.Match(content).Value;
            //if (!String.IsNullOrEmpty(value))
            //{
            //    string torernt = idRegex.Match(content).Value.Split(new string[] { "target=\"_blank\"", "</a>" }, StringSplitOptions.RemoveEmptyEntries)[1];
            //    string id = idRegex1.Match(torernt.ToUpper().Replace("-", "")).Value;
            //    his.Vid = id;

            //}
            string[] strs = Path.GetFileNameWithoutExtension(path).Replace("[]", "").Split(new string[] { "[", "]" }, StringSplitOptions.None);
            if (strs.Length >= 2)
            {
                his.Vid = strs[1];
            }
            if (String.IsNullOrEmpty(his.Vid))
            {
                Tool.MoveFile("unknown", path);
                return(resList);
            }

            MatchCollection mc = picRegex.Matches(content);

            foreach (Match m in mc)
            {
                // zoomfile="./data/attachment/forum/201803/04/225623iycsyb3petgs9z7j.jpg"
                string picUrl = "https://youiv.tv" + m.Value.Replace("zoomfile=\".", "").Replace("\"", "");
                his.Html = "<img src=\"" + picUrl + "\"/><br>";
            }
            if (content.Contains("filter=typeid&amp;typeid=432\">[U-15写真]</a>"))
            {
                Tool.MoveFile("U-15", path);
                his.IsBlack = true;
                resList.Add(his);
                return(resList);
            }
            his.HisTimeSpan    = 999;
            his.IsCHeckHisSize = ifCheckHis;
            his.Name           = path.Split(new char[] { ']', '.' })[1];
            resList.Add(his);
            return(resList);
        }
        public override System.Collections.ArrayList alys(string content, string path, string vid, bool ifCheckHis)
        {
            ArrayList resList = new ArrayList();

            try
            {
                if (path.Contains("httpjavtorrent"))
                {
                    return(resList);
                }
                His his = new His();
                //<img src="//jtl.re/x/18/docp021.jpg" class="s-full">
                string imgUrl = "http:" + imgRegex.Match(content).Value.Replace("<img src=\"", "").Replace("\" class=\"s-full\">", "");

                his.Vid = Path.GetFileNameWithoutExtension(path.ToUpper()).Split(new string[] { "[", "]" }, StringSplitOptions.RemoveEmptyEntries)[0];
                MatchCollection sizeMc = sizeRegex.Matches(content);
                double          size   = 0;
                foreach (Match match in sizeMc)
                {
                    //class="dl-link DL" target="_blank">DL - 881.8 MB</a>
                    //class="dl-link HD" target="_blank">HD - 3.49 GB</a>

                    string sizeString = match.Value.Replace("class=\"dl-link DL\" target=\"_blank\">DL - ", "").Replace("class=\"dl-link HD\" target=\"_blank\">HD - ", "");
                    if (sizeString.Contains("MB"))
                    {
                        size = Convert.ToDouble(sizeString.Replace("MB</a>", "").Trim());
                    }
                    else
                    {
                        size = Convert.ToDouble(sizeString.Replace("GB</a>", "").Trim()) * 1024;
                    }
                }
                his.Size           = size;
                his.HisTimeSpan    = 999;
                his.Html           = "<img src=\"" + imgUrl + "\"/><br>";
                his.IsCHeckHisSize = ifCheckHis;
                his.Name           = path.Split(new char[] { ']', '.' })[1];
                resList.Add(his);
            } catch (Exception e)
            {
                Tool.MoveFile("error", path);
                Console.WriteLine("error  " + path);
            }
            return(resList);
        }
Exemple #3
0
        public float GetTorrentSize(string p)
        {
            long  length      = 0;
            BDict torrentFile = null;
            BList b;

            try
            {
                torrentFile = BencodingUtils.DecodeFile(p) as BDict;
            }
            catch (Exception e)
            {
                Tool.MoveFile("decodeErr", p);
                return(0);
            }
            if (torrentFile == null)
            {
                Tool.MoveFile("decodeErr", p);
                return(0);
            }
            if ((torrentFile["info"] as BDict).ContainsKey("files"))
            {
                b = (BList)(torrentFile["info"] as BDict)["files"];



                for (int i = 0; i < b.Count; i++)
                {
                    BDict bd = (BDict)b[i];
                    length = length + ((BInt)bd["length"]).Value;
                }
            }
            else
            {
                length = ((BInt)(torrentFile["info"] as BDict)["length"]).Value;
            }
            return(length / 1024 / 1024);
        }
Exemple #4
0
        public void process(string directoryStr, IAnalysis ana, bool ifCheckHis)
        {
            Thread th = new Thread(curlCheck);

            th.Start();

            string    invalidHtmlHis = "<html><body>";
            string    invalidHTML    = "<html><body>";
            string    invalidHTML44x = "<html><body>";
            string    blackListHTML  = "<html><body>";
            ArrayList hisList        = new ArrayList();
            string    resultHTML     = "<html><body>";

            String[] path = Directory.GetFiles(directoryStr, "*", SearchOption.TopDirectoryOnly);
            foreach (String p in path)
            {
                Console.WriteLine(p);
                StreamReader sr      = new StreamReader(p);
                string       content = sr.ReadToEnd();

                sr.Close();
                string[] strs = Path.GetFileNameWithoutExtension(p).Split('_');
                string   vid  = "";
                if (strs.Length > 4)
                {
                    vid = strs[4];
                }
                ArrayList list = ana.alys(content, p, vid, ifCheckHis);
                foreach (His his in list)
                {
                    his.Vid = his.Vid.Replace("-", "").Replace("_", "");
                    if (his.IsBlack)
                    {
                        DBHelper.insertBLackList(his);
                        blackListHTML += his.Html;
                        continue;
                    }
                    if (filter.CheckBlackList(his))
                    {
                        blackListHTML += his.Html;
                        continue;
                    }
                    if (filter.checkValid(his))
                    {
                        his.Html += BaseAnalysis.getSearchHtml(his.Vid, his.Size, his.Name, true, his);
                        hisList.Add(his);
                    }
                    else
                    {
                        his.Html += BaseAnalysis.getSearchHtml(his.Vid, his.Size, his.Name, false, his);
                        if (his.FailReason == "file")
                        {
                            invalidHTML += his.Html;
                        }
                        else if (his.FailReason == "his")
                        {
                            invalidHtmlHis += his.Html;
                        }
                        else if (his.FailReason == "44x")
                        {
                            invalidHTML44x += his.Html;
                        }
                    }
                }
            }
            SortedDictionary <String, His> dic = new SortedDictionary <string, His>();

            foreach (His his in hisList)
            {
                if (!dic.Keys.Contains(his.Vid) || dic[his.Vid].Size < his.Size)
                {
                    dic.Remove(his.Vid);
                    dic.Add(his.Vid, his);
                }
            }
            foreach (His his in dic.Values)
            {
                resultHTML += his.Html;
                if (his.TorrentPath != "")
                {
                    Tool.MoveFile("result", his.TorrentPath);
                }
                if (his.HtmPath != "")
                {
                    Tool.MoveFile("result", his.HtmPath);
                }
            }
            resultHTML     += "</body></html>";
            invalidHTML    += "</body></html>";
            invalidHtmlHis += "</body></html>";
            blackListHTML  += "</body></html>";
            invalidHTML44x += "</body></html>";
            Tool.WriteFile(Path.Combine(directoryStr, "result.htm"), resultHTML);
            Tool.WriteFile(Path.Combine(directoryStr, "invalid.htm"), invalidHTML);
            Tool.WriteFile(Path.Combine(directoryStr, "invalidHis.htm"), invalidHtmlHis);
            Tool.WriteFile(Path.Combine(directoryStr, "blackList.htm"), blackListHTML);
            Tool.WriteFile(Path.Combine(directoryStr, "44x.htm"), invalidHTML44x);
        }