Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadyzpop authored and Shadyzpop committed Feb 1, 2017
1 parent 585617b commit c8a9af4
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions Internalx/~Other/Spider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,31 @@ public class Proxies
private int _ptype { set; get; }
#region Methods(Open)

public string[] ScrapeProxies(string[] urls)
public Task<string[]> ScrapeProxies(string[] urls)
{
List<string> data = new List<string>();
string pattern = @"\d{1,3}(\.\d{1,3}){3}:\d{1,5}";

using (HttpRequest req = new HttpRequest())
return Task.Run(() =>
{
req.UserAgent = HttpHelper.ChromeUserAgent();
req.IgnoreProtocolErrors = true;
req.AllowAutoRedirect = true;
foreach (var url in urls)
List<string> data = new List<string>();
string pattern = @"\d{1,3}(\.\d{1,3}){3}:\d{1,5}";
try
{
var res = req.Get(url);
MatchCollection proxies = Regex.Matches(res.ToString(), pattern);
foreach (var proxy in proxies)
data.Add(proxy.ToString());
using (HttpRequest req = new HttpRequest())
{
req.UserAgent = HttpHelper.ChromeUserAgent();
req.IgnoreProtocolErrors = true;
req.AllowAutoRedirect = true;
foreach (var url in urls)
{
var res = req.Get(url);
MatchCollection proxies = Regex.Matches(res.ToString(), pattern);
foreach (var proxy in proxies)
data.Add(proxy.ToString());
}
}
}
}
return data.ToArray();
catch { }
return data.ToArray();
});
}

public string[,] ProxyCheck(string proxy, string url, bool autoredirect, bool reconnect = false, int timeout = 0 , int ptype = 0)
Expand Down Expand Up @@ -234,13 +240,17 @@ public class Scrape
public string[] BlogSpotUrls(string url)
{
List<string> uris = new List<string>();
using (HttpRequest req = new HttpRequest())
try
{
var res = req.Get(url);
var purl = Html.HTMLparse(res.ToString(), "href", "source", "blogger:blog:plusone", "g:plusone", 1, 1);
foreach (var a in purl)
uris.Add(a);
using (HttpRequest req = new HttpRequest())
{
var res = req.Get(url);
var purl = Html.HTMLparse(res.ToString(), "href", "source", "blogger:blog:plusone", "g:plusone", 1, 1);
foreach (var a in purl)
uris.Add(a);
}
}
catch { }
return uris.ToArray();
}
#endregion
Expand Down

0 comments on commit c8a9af4

Please sign in to comment.