Ejemplo n.º 1
0
        public List <Gzh> Search(string sterm)
        {
            string       surl    = string.Format(SearchServerUrl, sterm);
            HtmlWeb      htmlweb = new HtmlWeb();
            HtmlDocument htmldoc = htmlweb.Load(surl);

            HtmlNodeCollection gzhNodeCol = htmldoc.DocumentNode.SelectNodes(".//div[@class='wx-rb bg-blue wx-rb_v1 _item']");

            List <Gzh> gzhCol = new List <Gzh>();

            foreach (HtmlNode gzhNode in gzhNodeCol)
            {
                Gzh gzh = new Gzh();
                gzh.GzhUrl  = gzhNode.GetAttributeValue("href", "").Replace("&amp;", "&");
                gzh.GzhName = gzhNode.SelectSingleNode("./div/h3").InnerText;
                gzh.WxhName = gzhNode.SelectSingleNode("./div/h4").InnerText;
                gzhCol.Add(gzh);
            }

            return(gzhCol);
        }
Ejemplo n.º 2
0
        public List<Gzh> Search(string sterm)
        {
            string surl = string.Format(SearchServerUrl, sterm);
            HtmlWeb htmlweb = new HtmlWeb();
            HtmlDocument htmldoc = htmlweb.Load(surl);

            HtmlNodeCollection gzhNodeCol = htmldoc.DocumentNode.SelectNodes(".//div[@class='wx-rb bg-blue wx-rb_v1 _item']");

            List<Gzh> gzhCol = new List<Gzh>();
            foreach (HtmlNode gzhNode in gzhNodeCol)
            {
                Gzh gzh=new Gzh();
                gzh.GzhUrl = gzhNode.GetAttributeValue("href", "").Replace("&amp;", "&");
                gzh.GzhName= gzhNode.SelectSingleNode("./div/h3").InnerText;
                gzh.WxhName= gzhNode.SelectSingleNode("./div/h4").InnerText;
                gzhCol.Add(gzh);
            }

            return gzhCol;
        }