✅ 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
141 lines
3.7 KiB
C#
141 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace URLNotesGrabberCORE
|
|
{
|
|
internal class ResponseNotes
|
|
{
|
|
}
|
|
|
|
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
|
|
public class AvatarUrl
|
|
{
|
|
[JsonProperty("64")]
|
|
public string _64 { get; set; }
|
|
|
|
[JsonProperty("128")]
|
|
public string _128 { get; set; }
|
|
}
|
|
|
|
public class Links
|
|
{
|
|
public Next next { get; set; }
|
|
}
|
|
|
|
public class Meta
|
|
{
|
|
public int status { get; set; }
|
|
public string msg { get; set; }
|
|
}
|
|
|
|
public class Next
|
|
{
|
|
public string href { get; set; }
|
|
public string method { get; set; }
|
|
public QueryParams query_params { get; set; }
|
|
}
|
|
|
|
public class Note
|
|
{
|
|
public string type { get; set; }
|
|
public long timestamp { get; set; }
|
|
public string blog_name { get; set; }
|
|
public string blog_uuid { get; set; }
|
|
public string blog_url { get; set; }
|
|
public bool followed { get; set; }
|
|
public string avatar_shape { get; set; }
|
|
public AvatarUrl avatar_url { get; set; }
|
|
public string post_id { get; set; }
|
|
public string reblog_parent_blog_name { get; set; }
|
|
public string reply_text { get; set; }
|
|
}
|
|
|
|
public class QueryParams
|
|
{
|
|
public string mode { get; set; }
|
|
public string id { get; set; }
|
|
public string before_timestamp { get; set; }
|
|
public string before { get; set; }
|
|
public string after { get; set; }
|
|
}
|
|
|
|
public class Response
|
|
{
|
|
public List<Note> notes { get; set; }
|
|
public int total_notes { get; set; }
|
|
public bool is_subscribed { get; set; }
|
|
public bool can_subscribe { get; set; }
|
|
public bool can_hide_or_delete_notes { get; set; }
|
|
public bool conversational_notifications_enabled { get; set; }
|
|
public Links _links { get; set; }
|
|
}
|
|
|
|
public class Root
|
|
{
|
|
public Meta meta { get; set; }
|
|
[JsonConverter(typeof(EmptyArrayOrObjectConverter<Response>))]
|
|
public Response response { get; set; }
|
|
|
|
public string statusCode { get; set; }
|
|
|
|
public int retryInSeconds { get; set; }
|
|
|
|
public string rawJson { get; set; }
|
|
}
|
|
|
|
// Classes for Posts API endpoint (for reply_text)
|
|
public class PostsResponse
|
|
{
|
|
public List<Post> posts { get; set; }
|
|
}
|
|
|
|
public class Post
|
|
{
|
|
public long id { get; set; }
|
|
public List<NoteDetail> notes { get; set; }
|
|
}
|
|
|
|
public class NoteDetail
|
|
{
|
|
public long timestamp { get; set; }
|
|
public string type { get; set; }
|
|
public string blog_name { get; set; }
|
|
public string reply_text { get; set; }
|
|
}
|
|
|
|
public class PostsRoot
|
|
{
|
|
public Meta meta { get; set; }
|
|
[JsonConverter(typeof(EmptyArrayOrObjectConverter<PostsResponse>))]
|
|
public PostsResponse response { get; set; }
|
|
|
|
public string statusCode { get; set; }
|
|
|
|
public int retryInSeconds { get; set; }
|
|
|
|
public string rawJson { get; set; }
|
|
}
|
|
|
|
public class LikesResponse
|
|
{
|
|
public List<dynamic> liked_posts { get; set; }
|
|
public int liked_count { get; set; }
|
|
public Links _links { get; set; }
|
|
}
|
|
|
|
public class LikesRoot
|
|
{
|
|
public Meta meta { get; set; }
|
|
[JsonConverter(typeof(EmptyArrayOrObjectConverter<LikesResponse>))]
|
|
public LikesResponse response { get; set; }
|
|
|
|
public string statusCode { get; set; }
|
|
public int retryInSeconds { get; set; }
|
|
public string rawJson { get; set; }
|
|
}
|
|
}
|