Finding my Lemmy Comment via API
I remembered a comment I had made quite a while ago I wanted to find. This was my journey.
What is Lemmy? My introduction became quite long and a personal history story, so I posted it separately as Lemmy, the open Reddit Alternative.
The comment I wanted to find contained recommendations for good isekai, as an answer to a frustrated post about the abundance of low-quality isekai. I wanted to publish it on this website as useful replication. But various aspects of how Lemmy works made it difficult but also interesting.
Searching Through Profile Comments
It’s a comment regarding anime. So maybe it was master my account switch/split and I posted it under my ani.social account?
Going through the pages of recent comments, I page-searched for the word isekai. And did not find the comment in question.
Then maybe it was before my account split under my feddit.de account. But the feddit.de frontend is dead, so I can’t access the respective profile page and profile comment list.
But Lemmy is federated - distributed and connected. Maybe I can open the feddit.de profile from ani.social - cross-instance? Adding @feddit.de
worked; Kissaki@feddit.de.
Going through that accounts comments and page-searching each paging-page did not yield results either though.
Could it be anywhere else? Maybe it was on Reddit?
I remembered that the Lemmy API is easily accessible on instances under /api/
.
Opening /api/
yields an empty page.
There is API documentation with the general API introduction and generated API reference docs. What was new to me was the introduction linking two alternative, more accessible, and interactively-useable API documentations provided by the community at lemmy.readme.io and mv-gh.github.io/lemmy_openapi_spec/.
There is a Search endpoint and a LocalUser endpoint. There is also Comment, but that seems to be for querying a specific comment.
To search for a specific users comments, you need the account ID rather than the username. So the first step is querying the account for the account ID.
The API URL path was not obvious to me from the reference docs. But the interactive readme.io docs allowed me to input the data to produce and see the correct URL. The mv-gh page seems to work similarly well.
The feddit.de backend still works, so while I can’t view the profile page and comments list directly, calling the API works fine.
Calling https://feddit.de/api/v3/user?username=Kissaki
yields the account ID as id
.
For the search, I knew I was searching for “isekai” content, so I searched for comments with that text, and created by the respective account, with https://feddit.de/api/v3/search?q=isekai&creator_id=303987&listing_type=All&type_=Comments
.
And indeed, the first result yielded the comment I was looking for. And I was able to copy my comment content from it.
Why did I not see it under the account comments?
I initially wondered whether looking at the feddit.de profile from ani.social would only show comments that have been federated to ani.social, which would only happen for comments in communities that were federated, which only happens once a user subscribes to such a community.
But inspecting the API result a bit more, the comment result record includes post information. Opening the post URL https://startrek.website/post/3851981
was inaccessible - “there was an error on the server”. I wondered if the post had been deleted.
More surprisingly, that post URL wasn’t even on the instance the community listed in the result record, which was lemmy.ml/c/anime
.
So searching on the frontend, https://lemmy.ml/search?q=isekai+harem&type=All&listingType=All&communityId=14719&page=1&sort=TopAll
, I was able to see the comment, rendered, there, as a search result.
But accessing the link to it https://lemmy.ml/post/8184473/5942488
also returns a “server error”.
I now assume the original post was deleted, while the comment remains in data storage.
Conclusion
I’m glad I was able to find the comment. Turns out it was quite the list of recommendations. I have now published it under Good Non-Harem Isekai Recommendations. (I had forgotten about the non-harem part of the inquiry.)
I’m also glad the API was easily accessible.