Return to Snippet

Revision: 58301
at July 6, 2012 18:19 by icinNet


Updated Code
public static string[] grabProxy(string source)
{
	// Credits: Soft2050
	var proxies = new List<string>();
	foreach (Match m in Regex.Matches(source, @"<td><span>([\s\S]*?)(\d+)</td>"))
	{
		string port = m.Groups[2].Value;
		string ip = m.Groups[1].Value;
		ip = Regex.Replace(ip, @"(<(div|span) style=""display:none"">\d+.*?>|<.*?>)", "").Trim();
		proxies.Add(string.Concat(ip, ":", port));
	}
	return proxies.ToArray();
}

Revision: 58300
at July 6, 2012 18:14 by icinNet


Initial Code
public static string[] grabProxy(string source)
        {
            // Credits: Soft2050
            var proxies = new List<string>();
            foreach (Match m in Regex.Matches(source, @"<td><span>([\s\S]*?)(\d+)</td>"))
            {
                string port = m.Groups[2].Value;
                string ip = m.Groups[1].Value;
                ip = Regex.Replace(ip, @"(<(div|span) style=""display:none"">\d+.*?>|<.*?>)", "").Trim();
                proxies.Add(string.Concat(ip, ":", port));
            }
            return proxies.ToArray();
        }

Initial URL
http://soft2050.in

Initial Description
A small snippet to parse out proxies from http://hidemyass.com/proxy-list/

Initial Title
HideMyAss Proxy Grabber

Initial Tags
ip, c#

Initial Language
C#