Not exactly new to Lemmy, but my search-fu has been noobish at best.

Lemm.ee would be shutting down at the end of this month, and while I’ve already moved to a new instance, I’m yet to do any archiving on my posts and comments. Is there an automated way to save my posts and comments.

Ideally, I’d want the archive to be:

  • a full copy of all the posts including
    • the full OP text
      • any embedded images will be saved and included in the OP
      • outward links are left as is
    • all of the comments, including any deleted ones (deleted by the user and deleted by mods/admins)
  • a full copy of the comments including
    • the full OP text of the thread in which the comment is made
    • the full tree up to the top-level comment
    • optionally including any deleted comments in this tree

Is this already a thing? I don’t think I have the skills and the time to make one before June 23 (one week before the instance shuts down on June 30), so that is not an option. I doubt anyone can make it upon short notice either.

Is there any other method I can do this without resorting to manual saving? And if I have no choice other than to save each and every post and comment manually? How should I be doing it?

If anyone can suggest anywhere else I can crosspost this for better visibility, that will be welcome as well.

  • megane-kun@lemm.eeOP
    link
    fedilink
    English
    arrow-up
    4
    ·
    8 days ago

    Hmm, reading the /user API endpoint, I think I understand some words (but hardly). ‌Thanks!

    • asudox@lemmy.asudox.dev
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      edit-2
      7 days ago
      1. you create a function with a page parameter and call the /user endpoint with a bearer auth header. page argument should be 1 at first call.
      2. using some library (or I think requests already has deserialization of JSON) you convert the JSON into some pythonic data type (e.g. dictionaries).
      3. exit the function when the length of posts and comments is 0.
      4. otherwise loop through the posts and comments arrays with a for loop
      5. on each iteration, serialize the dictionary to JSON and save it to some file
      6. increase the page counter by 1
      7. call the same function at the end of the function and pass in the page counter (which was increased by 1 previously). this is called recursion.
      • megane-kun@lemm.eeOP
        link
        fedilink
        English
        arrow-up
        4
        ·
        7 days ago

        Thanks!! I think can get started with this–like this weekend.

        But this makes me wonder, if it is as easy as it seems to be, why is this not already a thing?

        • asudox@lemmy.asudox.dev
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          7 days ago

          because nobody needed such a thing until now?

          I mean, as long as the bigger instances (that are also federated with lemm.ee, e.g. lemmy.world) stay, then your content is already “archived”. Unless you choose to delete your account explicitly (which probably some instances will ignore anyway), your content will stay.

          • megane-kun@lemm.eeOP
            link
            fedilink
            English
            arrow-up
            3
            ·
            7 days ago

            Good point. I am actually not so certain if my posts and comments will remain visible after lemm.ee goes, so I am thinking of doing this as a backup.