Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reviews support #335

Open
wants to merge 9 commits into
base: v4
Choose a base branch
from

Conversation

3urobeat
Copy link
Contributor

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant