I’m in the process of developing a bot. My intention is to scan all comments regardless of depth in a given community up to a certain date, so it receives only the comments made since the last request. I want to play nice so I’m also trying to do it on the less amount of queries possible.

The community I’m testing this is fairly small, it has 40 comments total, but the problem is that when I request comments without specifying max_depth, and sort ordered by New, I receive only 10 comments, if I try to specify page, or limit, I get an error {"error":"couldnt_get_comments"}.

If I don’t specify page or limit, and set an arbitrary number for max_depth, like 4, I get the 40 comments I’m expecting.

My question is: what’s the correct way to request comments? My intention is doing something similar to an user pressing “Comments” on front of a community, like calling the community URL with params ?dataType=Comment&page=1&sort=New

  • RoundSparrow
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    it has 40 comments total, but the problem is that when I request comments without specifying max_depth, and sort ordered by New, I receive only 10 comments, if I try to specify page, or limit, I get an error {“error”:“couldnt_get_comments”}.

    What values are you sending for limit and page? Are you sure they just aren’t out of range?

    without specifying max_depth

    I think max_depth has a default, but I don’t recall at the moment. Are the 10 comments you do get all trunk level comments, directly on the post?

    My intention is doing something similar to an user pressing “Comments” on front of a community, like calling the community URL

    From what I understand, depth only comes into play when you are viewing the comments of a specific post. If you are just listing comments across multiple posts in a community… they are presented flat. At least that is how lemmy-ui does it when I view comments for a community… which I assuming is using API /comment/list. Am I following what you are attempting?

    • fixmycode@feddit.clOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      What values are you sending for limit and page? Are you sure they just aren’t out of range?

      I believe I’ve borked it by setting page to 0, if I start with 1, I don’t receive the error, thanks for all the help.