MarkNotFound

This commit is contained in:
jim
2025-11-24 11:58:55 -06:00
parent de51068d0a
commit fdfe85d118
3 changed files with 28 additions and 5 deletions
+3
View File
@@ -538,6 +538,9 @@ namespace URLNotesGrabberCORE
try
{
// Informative output when marking a post as NotFound
Console.WriteLine($"Marking post NotFound: {blogName}/{postID}");
connection.Open();
string sql = "UPDATE Posts SET NotFound = 1 WHERE BlogName = @BlogName AND PostID = @PostID";
+18
View File
@@ -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")