Add reviews support
Hey, it's me again.
This PR adds support for scraping information from reviews, as well as posting & deleting comments, subscribing & unsubscribing to/from the comment section and voting on the review.
I have added a new class representing an existing review which scrapes various information from the DOM; the whole content is documented in this typedef.
It is sadly not easily possible to scrape more than the last 10 comments because the page navigator does not load when scraping.
If the first page always shows exactly 10 comments, one could calculate the amount of pages using the commentsAmount value. Requesting specific pages can be done using the ctp query parameter, like I've done in my other discussions PR. (That PR is still open and ready for review btw)
The functions already mentioned above are implemented in components/reviews.js, as usual.
I have not implemented support for posting reviews, as well as reporting existing reviews.
Test code for scraping info, posting a comment, subscribing to comments and voting funny on my Aperture Desk Job review:
community.getSteamReview("76561198260031749", "1902490", (err, res) => {
if (err) return console.log(err);
console.log(res); // Logs scraped info
res.comment("test", (err) => { if (err) console.log("Failed to comment: " + err); });
res.subscribe();
res.voteFunny((err) => { if (err) console.log("Failed to vote: " + err); });
});
Everything implemented has been tested and worked as expected for me - I hope I didn't miss anything.
Have a nice day :)
Why its not added yet!