Call:
concurrentqueue<stringnew concurrentqueue<string>(); Grab_proxyip (proxyipqueue);
return Result:
Here is how to get the Proxy IP collection:
#regionProduction IP proxy ObjectPrivate voidGrab_proxyip (concurrentqueue<string>proxyipqueue) {HashSet<string> Proxyip =Newhashset<string>(); Httphelper http=NewHttphelper (); Httpitem para=NewHttpitem (); Para. Timeout= +*Ten; Para. Method="GET"; intCount =0; Para. URL="HTTP://WWW.XICIDAILI.COM/NN/1";//West ThornRetryfunc (() ={httpresult result=http. Gethtml (para); if(result.) StatusCode = =System.Net.HttpStatusCode.OK) {stringRegex =@"<td> (\d+\.\d+\.\d+\.\d+) </td>\s+<td> (\d+) </td>"; Match MSTR=Regex.match (result. Html, regex); while(MSTR. Success && Count < -) {Proxyip.add (MSTR. groups[1]. Value +":"+ MSTR. groups[2]. Value); MSTR=MSTR. NextMatch (); Count++; } return true; } Else { return false; } }, Ten); Count=0; Para. URL="HTTP://IP84.COM/DLGN";//IP BusRetryfunc (() ={httpresult result=http. Gethtml (para); if(result.) StatusCode = =System.Net.HttpStatusCode.OK) {stringRegex =@"<td> (\d+\.\d+\.\d+\.\d+) </td>\s+<td> (\d+) </td>"; Match MSTR=Regex.match (result. Html, regex); while(MSTR. Success && Count <Ten) {Proxyip.add (MSTR. groups[1]. Value +":"+ MSTR. groups[2]. Value); MSTR=MSTR. NextMatch (); Count++; } return true; } Else { return false; } }, Ten); Count=0; Para. URL="http://www.ip3366.net/free/?stype=1";//Cloud AgentRetryfunc (() ={httpresult result=http. Gethtml (para); if(result.) StatusCode = =System.Net.HttpStatusCode.OK) {stringRegex =@"<td> (\d+\.\d+\.\d+\.\d+) </td>\s+<td> (\d+) </td>"; Match MSTR=Regex.match (result. Html, regex); while(MSTR. Success && Count <Ten) {Proxyip.add (MSTR. groups[1]. Value +":"+ MSTR. groups[2]. Value); MSTR=MSTR. NextMatch (); Count++; } return true; } Else { return false; } }, Ten); Count=0; Para. URL="Http://www.iphai.com/free/ng";//IP SeaRetryfunc (() ={httpresult result=http. Gethtml (para); if(result.) StatusCode = =System.Net.HttpStatusCode.OK) {stringRegex =@"<td>\s+ (\d+\.\d+\.\d+\.\d+) \s+</td>\s+<td>\s+ (\d+) \s+</td>"; Match MSTR=Regex.match (result. Html, regex); while(MSTR. Success && Count <Ten) {Proxyip.add (MSTR. groups[1]. Value +":"+ MSTR. groups[2]. Value); MSTR=MSTR. NextMatch (); Count++; } return true; } Else { return false; } }, Ten); Count=0; Para. URL="http://www.66ip.cn/nmtq.php?getnum=10&isp=0&anonymoustype=3&start=&ports=&export=& Ipaddress=&area=1&proxytype=2&api=66ip";//66ipRetryfunc (() ={httpresult result=http. Gethtml (para); if(result.) StatusCode = =System.Net.HttpStatusCode.OK) {stringRegex =@"(\d+\.\d+\.\d+\.\d+):(\d+) <br/>"; Match MSTR=Regex.match (result. Html, regex); while(MSTR. Success && Count <Ten) {Proxyip.add (MSTR. groups[1]. Value +":"+ MSTR. groups[2]. Value); MSTR=MSTR. NextMatch (); Count++; } return true; } Else { return false; } }, Ten); foreach(varIteminchProxyip) {Proxyipqueue.enqueue (item); } } #endregion
C # proxy IP gets a common method