예제 #1
0
        public static ProxyList ParseString(string content)
        {
            var proxies = new ProxyList();

            var regex = new Regex(@"(\d+\.\d+\.\d+\.\d+)(?:\:|\s+)(\d+)");

            foreach (Match match in regex.Matches(content))
            {
                proxies.Add(new WebProxy(match.Groups[1].Value, int.Parse(match.Groups[2].Value)));
            }

            return(proxies);
        }
예제 #2
0
        public static async Task <ProxyList> ParseFreeProxyListAsync()
        {
            ProxyList proxies = new ProxyList();

            string content = await GetPageAsync("http://free-proxy-list.net/");

            var regex = new Regex(@"<td>(\d+\.\d+\.\d+\.\d+)</td><td>(\d+)</td>");

            foreach (Match match in regex.Matches(content))
            {
                proxies.Add(new WebProxy(match.Groups[1].Value, int.Parse(match.Groups[2].Value)));
            }

            return(proxies);
        }
예제 #3
0
        public static async Task <ProxyList> ParseHideMyIpAsync()
        {
            ProxyList proxies = new ProxyList();

            string content = await GetPageAsync("http://www.hide-my-ip.com/proxylist.shtml");

            var regex = new Regex(@"{""i"":""(\d+\.\d+\.\d+\.\d+)"",""p"":""(\d+)""");

            foreach (Match match in regex.Matches(content))
            {
                proxies.Add(new WebProxy(match.Groups[1].Value, int.Parse(match.Groups[2].Value)));
            }

            return(proxies);
        }
예제 #4
0
        public ProxyList Uniqued()
        {
            var result = new ProxyList();
            var urls   = new List <Uri>();

            foreach (WebProxy proxy in this)
            {
                if (!urls.Contains(proxy.Address))
                {
                    urls.Add(proxy.Address);
                    result.Add(proxy);
                }
            }

            return(result);
        }