Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created May 15, 2019 16:17
Show Gist options
  • Save luisenriquecorona/42b5bd607429a6824f7331eda4c645f7 to your computer and use it in GitHub Desktop.
Save luisenriquecorona/42b5bd607429a6824f7331eda4c645f7 to your computer and use it in GitHub Desktop.
We need to get its permalink value to get the list of comments. We can write a separate method for getting a list of comments for the given URL. We call this method getComments. The implementation of getComments is simple
let getComments = (link) => {
let response
try {
response = JSON.parse(request('GET',"https://www.
reddit.com/" + link).getBody('utf8'))
} catch(err) {
response = { message: "Something went wrong" ,
errorCode: err['statusCode'] }
}
return response
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment