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 full sharedfiles support #306

Merged
merged 23 commits into from
Jun 24, 2023
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6f97370
Add sharedfile comment support
3urobeat May 12, 2023
18011b3
Add sharedfile voting support
3urobeat May 12, 2023
d807f10
Add sharedfile subscribing support
3urobeat May 12, 2023
f09adc8
Add (disabled) sharedfile favorite support
3urobeat May 12, 2023
b55516f
Oops, wrong object name
3urobeat May 12, 2023
c92801d
Load sharedfiles component
3urobeat May 13, 2023
c864286
Add sharedfile type enum
3urobeat May 14, 2023
9ec5dcd
Add sharedfile class with fully working scraper
3urobeat May 14, 2023
d6b0fbd
Update non-object methods to take appid param
3urobeat May 14, 2023
ba27820
Misc
3urobeat May 14, 2023
350f628
Add sharedfile object methods
3urobeat May 14, 2023
c0be17c
Load CSteamSharedfile class
3urobeat May 14, 2023
8538589
Fix owner remaining null and wrong param
3urobeat May 14, 2023
81d8dc2
Use decodeSteamTime() helper instead of doing it manually
3urobeat May 14, 2023
897ad16
Formatting
3urobeat May 14, 2023
4723bd9
Improve resolveVanityURL() and move to helpers
3urobeat May 15, 2023
27d2daa
Remove steamid-resolver dep and use internal helper
3urobeat May 15, 2023
f7d7cf0
Remove support for up- & downvoting sharedfiles
3urobeat May 15, 2023
f96d25a
Rename sid to sharedFileId
3urobeat May 15, 2023
33bc8d8
Add support for determining up/downvote status
3urobeat May 28, 2023
e23fa02
Add support for reading numRatings of guides
3urobeat May 28, 2023
440b2f9
Add JsDoc
3urobeat May 29, 2023
e5fbddc
Merge branch 'master' into feature/steam-sharedfiles
3urobeat Jun 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add support for reading numRatings of guides
  • Loading branch information
3urobeat committed May 28, 2023
commit e23fa02c91efe792b6e0bf9e3ca37a35fc236e17
7 changes: 7 additions & 0 deletions classes/CSteamSharedfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
uniqueVisitorsCount: null,
favoritesCount: null,
upvoteCount: null,
guideNumRatings: null,
isUpvoted: null,
isDownvoted: null
};
Expand Down Expand Up @@ -105,6 +106,12 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
}


// Find numRatings if this is a guide as they use a different voting system
let numRatings = $(".ratingSection > .numRatings").text().replace(" ratings", "")

sharedfile.guideNumRatings = Number(numRatings) || null; // Set to null if not a guide or if the guide does not have enough ratings to show a value


// Determine if this account has already voted on this sharedfile
sharedfile.isUpvoted = String($(".workshopItemControlCtn > #VoteUpBtn")[0].attribs["class"]).includes("toggled"); // Check if upvote btn class contains "toggled"
sharedfile.isDownvoted = String($(".workshopItemControlCtn > #VoteDownBtn")[0].attribs["class"]).includes("toggled"); // Check if downvote btn class contains "toggled"
Expand Down