Created
May 15, 2019 16:17
-
-
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
This file contains hidden or 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
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