Created
August 16, 2020 14:23
-
-
Save dguo/d2d6219548a5af6b18c8ef300bbf7f83 to your computer and use it in GitHub Desktop.
blog - Morning Joy - reddit-aww
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const got = require("got"); | |
async function getAwwPost() { | |
const response = await got( | |
"https://www.reddit.com/r/aww/top.json?t=day" | |
).json(); | |
for (const post of response.data.children) { | |
if (post.data.post_hint !== "image") { | |
continue; | |
} | |
const {title, url} = post.data; | |
return {title, url}; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment