I really hate both reddit.com and its mobile app, and was looking for an alternative. I just wanted something minimalistic and lightweight. Apollo, Slide, Narwhal, Comment, BaconReader, photon-reddit... I tried everything I could find and none of them felt nice to use. So, I thought I could make own, how hard can that be? Fetch some data from the API and display it.
Oh, how wrong I was.
First of all, the documentation, uh, leaves a lot to be desired. There's no response body example so I had to call each of them before using them. Some parameters are just left unacknowledged.
My biggest complaint is that there's no easy way to tell if the post is a text, image, GIF, video, embedded video, or embedded image.
is_self means it's a text.
is_video means it's a video, but not, since you also have to check
post_hint === 'rich:video' and
domain === 'v.redd.it'. But even if you know what kind of media it is, getting the media URL is in its self is a hurdle. Sometimes you have check
preview.images. Oh, and
And the inconsistency.
Sometimes nsfw items are marked as
over_18 and other times as
over18. Some key-values are missing depending on which endpoint you call, like
description from users missing when you search users by a query. Icon URLs are included in either
And finally, getting the next batch of items.
Reddit API only gives you a max 100 or so items for each API call. If you want to get the next batch of posts, you have you use the
after id provided by the previous call. Fine, it works. But, how do you get the next batch of comments in a comment section? Well, the API returns you all the comment ID of comments that weren't included in the first batch. You can get the content of each comment using their ids, but replies to those comments are missing. There's an endpoint that gives you the comment with the replies, but it's missing crucial information like who made them. And don't forget that the object that includes that list of comment ids are inside an array of totally different comment-objects.
There are API wrappers like Snoowrap but I am not willing to see any more response body from reddit.com.
So, my solution?
Create an API wrapper that does all the work for you and returns a clean response body without the fat. Still very much in progress though: https://github.com/pilcrowOnPaper/corsica.