Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[SNIPPET]Grabbing proxies

Hey, so this is a function I've written today to use in something I was working on that required proxies. You just pass it the amount of pages you want it to go through(one page contains 50 proxies) and it will return you the list of proxies in IP:PORT format. Maybe it'll be useful for someone.

Code
static List<string> getProxies(int pages)
  {
    string p, t;
    List<string> _prox = new List<string>();
    WebClient wc = new WebClient() { Proxy = null };
    for (int x = 0; x < pages; x++)
    {
    MatchCollection matches = Regex.Matches(wc.DownloadString("http://hidemyass.com/proxy-list/" + x), @"<tr class="".*?""  ?rel="".*?"">([\s\S]+?)</tr>");
    foreach (Match m in matches)
    {
    t = m.Groups[1].Value;
    p = Regex.Match(t, @"<td>\s?([0-9]{3,7})</td>").Groups[1].Value;
    t = Regex.Match(t, "<td><span>(.+?)</span></td>", RegexOptions.IgnoreCase).Groups[1].Value;
    t = Regex.Replace(t, @"<(span|div) style=""display:none"">.+?</(span|div)>", "");
    t = Regex.Replace(t, "</?span[^>]*>", "");
    t = t + ":" + p;
    _prox.Add(t);
    }  
    }
    return _prox;
  }
I love you! I was about to make this for an register bot, but thank you :)
thanks for this!! i needed this a while ago but.. thanks
Its not working for me when I do:

Code
listBox1.Items.Add(getProxies(1));
They changed their source again since I posted this, this should be working now

(Jul 14, 2012 04:37 PM)Woozie Wrote:  If anyone is interested this one will work with the new source, it's in C# though.
[Image: IAOc]

Code
static List<string> GetProxy()
  {
    List<string> li = new List<string>();
    string src = new WebClient() { Proxy = null }.DownloadString("http://hidemyass.com/proxy-list/");
    foreach (Match m in Regex.Matches(src, @"<tr class="".*?""  rel=""\d+?"">([\s\S]+?)</style>([\s\S]+?)<td>\s(\d+)</td>"))
    {
    string ws = m.Groups[2].Value;
    foreach (Match _m in Regex.Matches(m.Groups[1].Value, @"\.(.+?)\{(.+?)\}"))
    {
    ws = ws.Replace(string.Format(@"class=""{0}""", _m.Groups[1].Value), string.Format(@"style=""{0}""", _m.Groups[2].Value));
    }
    ws = string.Format("{0}:{1}", Regex.Replace(ws, @"<(div|span) style=""display:none"">.*?</(div|span)>|<[^>]+?>|\s", ""), m.Groups[3].Value);
    li.Add(ws);
    }
    return li;
  }
(Jul 23, 2012 01:19 PM)Pussy Cat Wrote:  They changed their source again since I posted this, this should be working now

Thanks for the quick fix Woozie :). Gonna implement it into my bots


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by еlixirSep 9, 2022 06:31 AM 0 132 Sep 9, 2022 06:31 AM
Last Post: еlixir
[Python] by datguy.devNov 28, 2019 10:37 PM 4 298 Nov 28, 2019 10:37 PM
Last Post: Eternal Darkness
[C#] by gigajewDec 1, 2018 05:55 PM 3 250 Dec 1, 2018 05:55 PM
Last Post: gigajew