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
}
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
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.