Thema: Proxybase.de ProxyCrawler
-
08.08.2012, 18:47 #1
- Registriert seit
- 15.11.2011
- Beiträge
- 8.111
- Blog Entries
- 5
Thanked 9.410 Times in 3.246 PostsProxybase.de ProxyCrawler
Ich miste zurzeit meine VS-Projekte aus, und werde daher alles was meiner Meinung nach sinnvoll ist und public werden darf hier posten.
Die Funktion sammelt alle verfügbaren Proxys von der Seite ProxyBase.de | Proxyliste und Proxychecker in einem Array.
Das lohnt sich bei dieser Seite besonders, da deren Datenbank mehr als 3k Proxys enthält.
void Proxybase_DE(List<string> proxys) {
WebClient client = new WebClient();
int page = 0;
string src = "";
do {
src = client.DownloadString(string.Format("http://www.proxybase.de/index.php?start={0}", page));
MatchCollection matches = Regex.Matches(src, @">(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,6})");
if (matches.Count == 0)
break;
for (int i = 0; i < matches.Count; i++) {
string proxy = matches[i].Groups[1].Value;
if (!proxys.Contains(proxy)) {
proxys.Add(proxy);
}
}
page += 25;
} while (src.Contains("<div id='balken"));
}
Beispielaufruf:
List<string> proxys = new List<string>();
Proxybase_DE(proxys);
Im Anhang findet ihr noch ein Beispieltool, dass alle Proxys ausließt und anschließend in eine Textdatei schreibt (Format: IP: Port, 1 Proxy pro Zeile).
Pro Seite werden 25 Proxys gecrawled, es dauert bei 3k also logischerweise ein paar Minuten, bis der Crawler alle durch hat.
-
The Following 5 Users Say Thank You to DMW007 For This Useful Post:
Stichworte
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.