MarkNotFound
This commit is contained in:
@@ -71,6 +71,7 @@ namespace URLNotesGrabberCORE
|
||||
TraverseDirectory(settings.GetValue<string>("PathInput"), settings.GetValue<string>("PathOutputBlogs"), contains, blogNameToParse);
|
||||
|
||||
break;
|
||||
|
||||
case "-test":
|
||||
#region Manual test
|
||||
|
||||
@@ -80,6 +81,14 @@ namespace URLNotesGrabberCORE
|
||||
var response = APIAccess.GrabNotes(blogName, postID).GetAwaiter().GetResult();
|
||||
List<Tuple<string, string>> notes = new List<Tuple<string, string>>();
|
||||
|
||||
// If the API returned a 404 inside the JSON `meta` block, mark the post NotFound
|
||||
if (response?.meta != null && response.meta.status == 404)
|
||||
{
|
||||
Console.WriteLine($"ERROR: Post not found - {blogName}/{postID} (meta.status=404)");
|
||||
DataAccess.UpdatePostMarkNotFound(blogName, postID);
|
||||
break;
|
||||
}
|
||||
|
||||
// Check for API errors
|
||||
if (response.statusCode == "NotFound")
|
||||
{
|
||||
@@ -332,6 +341,15 @@ namespace URLNotesGrabberCORE
|
||||
|
||||
Console.WriteLine(post.Item1 + '\t' + post.Item2 + '\t' + DateTime.Now + "\t" + APICount);
|
||||
var response = APIAccess.GrabNotes(post.Item1, post.Item2, post.Item3.ToString()).GetAwaiter().GetResult();
|
||||
|
||||
// If the API returned a 404 inside the JSON `meta` block, mark the post NotFound and return
|
||||
if (response?.meta != null && response.meta.status == 404)
|
||||
{
|
||||
Console.WriteLine($"API returned 404 Not Found for {post.Item1}/{post.Item2} (meta.status=404)");
|
||||
DataAccess.UpdatePostMarkNotFound(post.Item1, post.Item2);
|
||||
Thread.Sleep(1000);
|
||||
return "NotFound";
|
||||
}
|
||||
List<Tuple<string, string>> notes = new List<Tuple<string, string>>();
|
||||
|
||||
if (response.statusCode == "NotFound")
|
||||
|
||||
Reference in New Issue
Block a user