Esempio n. 1
0
 private void Parse(ParserInfo info)
 {
     if (Actions.ContainsKey(info.type))
     {
         ThreadsCount++;
         if (Actions[info.type](info) && ParsingSuccess != null)
         {
             ParsingSuccess(info.url, null);
         }
     }
 }
Esempio n. 2
0
        private static bool Parse2KLocal(ParserInfo info)
        {
            Uri test = new Uri(info.url);
            var host = test.Host;

            try
            {
                var dom = CQ.CreateFromUrl(info.url);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }
Esempio n. 3
0
        private static bool Parse2KGlobal(ParserInfo info)
        {
            Uri test = new Uri(info.url);
            var host = string.Format("{0}://{1}", test.Scheme, test.Host);

            try
            {
                var dom   = CQ.CreateFromUrl(info.url);
                var links = dom["h2 a"];

                foreach (var link in links)
                {
                    //urls.Add(host + link["href"]);
                    Parser.Add(new ParserInfo {
                        type = "local_2k", url = host + link["href"]
                    });
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 4
0
 public static void Add(ParserInfo info)
 {
     Instance.queue.Enqueue(info);
 }