MarkNotFound
This commit is contained in:
Vendored
+7
-5
@@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"args": [
|
"args": [
|
||||||
"-pn"
|
"-test 12h45m 724733451895455700"
|
||||||
], // <--- ADD OR MODIFY THIS LINE
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "C#: Launch Startup Project",
|
||||||
|
"type": "dotnet",
|
||||||
|
"request": "launch"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -538,6 +538,9 @@ namespace URLNotesGrabberCORE
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Informative output when marking a post as NotFound
|
||||||
|
Console.WriteLine($"Marking post NotFound: {blogName}/{postID}");
|
||||||
|
|
||||||
connection.Open();
|
connection.Open();
|
||||||
|
|
||||||
string sql = "UPDATE Posts SET NotFound = 1 WHERE BlogName = @BlogName AND PostID = @PostID";
|
string sql = "UPDATE Posts SET NotFound = 1 WHERE BlogName = @BlogName AND PostID = @PostID";
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ namespace URLNotesGrabberCORE
|
|||||||
TraverseDirectory(settings.GetValue<string>("PathInput"), settings.GetValue<string>("PathOutputBlogs"), contains, blogNameToParse);
|
TraverseDirectory(settings.GetValue<string>("PathInput"), settings.GetValue<string>("PathOutputBlogs"), contains, blogNameToParse);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "-test":
|
case "-test":
|
||||||
#region Manual test
|
#region Manual test
|
||||||
|
|
||||||
@@ -80,6 +81,14 @@ namespace URLNotesGrabberCORE
|
|||||||
var response = APIAccess.GrabNotes(blogName, postID).GetAwaiter().GetResult();
|
var response = APIAccess.GrabNotes(blogName, postID).GetAwaiter().GetResult();
|
||||||
List<Tuple<string, string>> notes = new List<Tuple<string, string>>();
|
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
|
// Check for API errors
|
||||||
if (response.statusCode == "NotFound")
|
if (response.statusCode == "NotFound")
|
||||||
{
|
{
|
||||||
@@ -332,6 +341,15 @@ namespace URLNotesGrabberCORE
|
|||||||
|
|
||||||
Console.WriteLine(post.Item1 + '\t' + post.Item2 + '\t' + DateTime.Now + "\t" + APICount);
|
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();
|
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>>();
|
List<Tuple<string, string>> notes = new List<Tuple<string, string>>();
|
||||||
|
|
||||||
if (response.statusCode == "NotFound")
|
if (response.statusCode == "NotFound")
|
||||||
|
|||||||
Reference in New Issue
Block a user