This little experiment began with playing around with Reddit’s JSON response. After finding I could mine out the images pretty easily, I set up a simple JS loop to display ones I could grab. I didn’t want to bother sorting through albums or anything, so it’s simple single images. I did however run into a problem fairly quickly with Gfycat links – there are tons of them! So, I set up a quick API request to Gfycat when the JSON loop finds a Gfycat link. This way, I can grab the small gif file preview to drop into the display with the others from Reddit, but then also grab the actual MP4 for the lightbox display. Because Gfycat has a bunch of different subdomains for their media – this was the easiest way to grab the correct link.
Test it out and let me know what you think!