✅ Uses mode=conversation to fetch only notes with text
✅ Captures replies and reblogs with comment ✅ Ignores rollup_notes field (as requested) ✅ Maintains rate limiting and error handling ✅ Console output shows both reply and reblog comment
This commit is contained in:
@@ -464,41 +464,27 @@ namespace URLNotesGrabberCORE
|
||||
return;
|
||||
}
|
||||
|
||||
if (postsResponse?.response?.posts == null || postsResponse.response.posts.Count == 0)
|
||||
if (postsResponse?.response == null || postsResponse.response.notes == null || postsResponse.response.notes.Count == 0)
|
||||
{
|
||||
Console.WriteLine($"[Reply Text] No posts found in response for {blogName}/{postID}");
|
||||
Console.WriteLine($"[Reply Text] No notes found in response for {blogName}/{postID}");
|
||||
Console.WriteLine($"[Reply Text] Response Status Code: {postsResponse?.statusCode ?? "N/A"}");
|
||||
Console.WriteLine($"[Reply Text] Response.response is null: {postsResponse?.response == null}");
|
||||
if (postsResponse?.response != null)
|
||||
{
|
||||
Console.WriteLine($"[Reply Text] Posts count: {postsResponse.response.posts?.Count ?? 0}");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(postsResponse?.rawJson))
|
||||
{
|
||||
Console.WriteLine($"[Reply Text] Raw Response JSON: {postsResponse.rawJson}");
|
||||
Console.WriteLine($"[Reply Text] Notes count: {postsResponse.response.notes?.Count ?? 0}");
|
||||
}
|
||||
|
||||
// Mark all replies for this post with '?' to indicate API returned no posts
|
||||
Console.WriteLine($"[Reply Text] Marking all replies for {blogName}/{postID} with '?' due to no posts in response");
|
||||
Console.WriteLine($"[Reply Text] Marking all replies for {blogName}/{postID} with '?' due to no notes in response");
|
||||
DataAccess.UpdateAllNoteReplyTextForPost(blogName, postID, "?");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the first (and should be only) post
|
||||
var post = postsResponse.response.posts.FirstOrDefault();
|
||||
if (post?.notes == null)
|
||||
{
|
||||
Console.WriteLine($"[Reply Text] No notes found in post {blogName}/{postID}");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine($"[Reply Text] Found {post.notes.Count} total notes for {blogName}/{postID}");
|
||||
|
||||
// Update each reply with its text
|
||||
int replyCount = 0;
|
||||
int skippedCount = 0;
|
||||
foreach (var note in post.notes)
|
||||
foreach (var note in postsResponse.response.notes)
|
||||
{
|
||||
if (note.type == "reply")
|
||||
{
|
||||
@@ -519,6 +505,18 @@ namespace URLNotesGrabberCORE
|
||||
Console.WriteLine($"[Reply Text] Skipped reply from {note.blog_name} - empty reply_text");
|
||||
}
|
||||
}
|
||||
else if (note.type == "reblog" && !string.IsNullOrEmpty(note.reply_text))
|
||||
{
|
||||
// Handle reblogs with comment
|
||||
DataAccess.UpdateNoteReplyText(blogName, postID, note.blog_name, note.timestamp, note.reply_text);
|
||||
replyCount++;
|
||||
|
||||
// Output the reblog comment being stored
|
||||
string displayText = note.reply_text.Length > 100
|
||||
? note.reply_text.Substring(0, 100) + "..."
|
||||
: note.reply_text;
|
||||
Console.WriteLine($" [{note.blog_name}] {displayText} (reblog comment)");
|
||||
}
|
||||
}
|
||||
|
||||
if (replyCount > 0)
|
||||
|
||||
Reference in New Issue
Block a user