Beispiel #1
0
        override protected IEnumerable <ServerInfo> FetchServers()
        {
            string             pageUrl         = "http://freess.org/";
            HtmlDocument       webpageDocument = new HtmlWeb().Load(pageUrl);
            HtmlNodeCollection contentNodes    = webpageDocument.DocumentNode.SelectNodes("//section[@id=\"portfolio-preview\"]//a[substring(@href, string-length(@href) - 3) = \".png\"]");

            return(from contentNode in contentNodes.AsParallel()
                   select ServerInfoParser.ReadFromImageUrl(
                       new Uri(new Uri(pageUrl), contentNode.Attributes["href"].Value.ToString()).ToString()
                       ));
        }
Beispiel #2
0
        override protected IEnumerable <ServerInfo> FetchServers()
        {
            HttpWebRequest     httpWebRequest  = (HttpWebRequest)WebRequest.Create("http://shadowsocks8.com/");
            HttpWebResponse    httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            Uri                baseUri         = httpWebResponse.ResponseUri;
            HtmlDocument       webpageDocument = new HtmlWeb().Load(baseUri.ToString());
            HtmlNodeCollection nodes           = webpageDocument.DocumentNode.SelectNodes("//*[@id=\"free\"]//img[contains(@src, \"server\")]");

            return((
                       from node in nodes.AsParallel()
                       select ServerInfoParser.ReadFromImageUrl(
                           new Uri(baseUri, node.Attributes["src"].Value.ToString()).ToString()
                           )
                       ).ToArray());
        }