-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Fix sharedfiles scraping error when Steam returns non-English page, fix rejected request detection and improve type detection #316
base: master
Are you sure you want to change the base?
Changes from 4 commits
a39e77c
bdd7497
c520ab1
238c36d
dccab0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ var SteamID = require('steamid'); | |
|
||
var SteamCommunity = require('../index.js'); | ||
|
||
const Helpers = require('./helpers.js'); | ||
|
||
|
||
/** | ||
* Deletes a comment from a sharedfile's comment section | ||
|
@@ -20,14 +22,25 @@ SteamCommunity.prototype.deleteSharedFileComment = function(userID, sharedFileId | |
"form": { | ||
"gidcomment": cid, | ||
"count": 10, | ||
"json": 1, | ||
"sessionid": this.getSessionID() | ||
} | ||
}, | ||
"json": true | ||
}, function(err, response, body) { | ||
if (!callback) { | ||
return; | ||
} | ||
|
||
callback(err); | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
|
||
if (body.success) { | ||
callback(null); | ||
} else { | ||
callback(new Error(body.error)); | ||
} | ||
}, "steamcommunity"); | ||
}; | ||
|
||
|
@@ -45,7 +58,7 @@ SteamCommunity.prototype.favoriteSharedFile = function(sharedFileId, appid, call | |
"appid": appid, | ||
"sessionid": this.getSessionID() | ||
} | ||
}, function(err, response, body) { | ||
}, function(err, response, body) { // Steam does not seem to return any errors for this request | ||
if (!callback) { | ||
return; | ||
} | ||
|
@@ -71,14 +84,25 @@ SteamCommunity.prototype.postSharedFileComment = function(userID, sharedFileId, | |
"form": { | ||
"comment": message, | ||
"count": 10, | ||
"json": 1, | ||
"sessionid": this.getSessionID() | ||
} | ||
}, | ||
"json": true | ||
}, function(err, response, body) { | ||
if (!callback) { | ||
return; | ||
} | ||
|
||
callback(err); | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
|
||
if (body.success) { | ||
callback(null); | ||
} else { | ||
callback(new Error(body.error)); | ||
} | ||
Comment on lines
+101
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also tested; Steam returns the following: |
||
}, "steamcommunity"); | ||
}; | ||
|
||
|
@@ -97,14 +121,26 @@ SteamCommunity.prototype.subscribeSharedFileComments = function(userID, sharedFi | |
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/subscribe/${userID.toString()}/${sharedFileId}/`, | ||
"form": { | ||
"count": 10, | ||
"json": 1, | ||
"sessionid": this.getSessionID() | ||
} | ||
}, | ||
"json": true | ||
}, function(err, response, body) { // eslint-disable-line | ||
if (!callback) { | ||
return; | ||
} | ||
|
||
callback(err); | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
|
||
if (body.success && body.success != SteamCommunity.EResult.OK) { | ||
callback(Helpers.eresultError(body.success)); | ||
return; | ||
} | ||
|
||
callback(null); | ||
}, "steamcommunity"); | ||
}; | ||
|
||
|
@@ -122,7 +158,7 @@ SteamCommunity.prototype.unfavoriteSharedFile = function(sharedFileId, appid, ca | |
"appid": appid, | ||
"sessionid": this.getSessionID() | ||
} | ||
}, function(err, response, body) { | ||
}, function(err, response, body) { // Steam does not seem to return any errors for this request | ||
if (!callback) { | ||
return; | ||
} | ||
|
@@ -146,13 +182,25 @@ SteamCommunity.prototype.unsubscribeSharedFileComments = function(userID, shared | |
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/unsubscribe/${userID.toString()}/${sharedFileId}/`, | ||
"form": { | ||
"count": 10, | ||
"json": 1, | ||
"sessionid": this.getSessionID() | ||
} | ||
}, | ||
"json": true | ||
}, function(err, response, body) { // eslint-disable-line | ||
if (!callback) { | ||
return; | ||
} | ||
|
||
callback(err); | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
|
||
if (body.success && body.success != SteamCommunity.EResult.OK) { | ||
callback(Helpers.eresultError(body.success)); | ||
return; | ||
} | ||
|
||
callback(null); | ||
}, "steamcommunity"); | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this tested and confirmed working? Typically, when Steam returns a
success
key, it's an eresult and not a bool.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, Steam returns the following here:
{ success: false, error: 'There was a problem deleting this comment. Please try again.' }