mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-21 23:23:09 +01:00
If we can't pull the robots information, don't break completely (#37)
This commit is contained in:
parent
32280c334b
commit
91ac0e2385
@ -40,9 +40,16 @@ var sitesRobotFile = new ConcurrentDictionary<string, RobotsFile>();
|
||||
await Parallel.ForEachAsync(Config.Instance.Sites,
|
||||
new ParallelOptions { MaxDegreeOfParallelism = Config.Instance.Sites.Length },
|
||||
async (site, _) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
sitesRobotFile[site.Host] = await robotsFileParser.FromUriAsync(new Uri($"http://{site.Host}/robots.txt"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine($"Ignoring {site.Host} because had issues fetching its robots data (is the site down?)");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
List<(string host, string tag)> sitesTags;
|
||||
@ -88,6 +95,11 @@ await Parallel.ForEachAsync(sitesTags, new ParallelOptions{MaxDegreeOfParallelis
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Not scraping {url} because I couldn't fetch robots data.");
|
||||
return;
|
||||
}
|
||||
|
||||
HttpResponseMessage? response = null;
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user