mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-14 15:00:07 +08:00
Rename sid to sharedFileId
This commit is contained in:
parent
f7d7cf0660
commit
f96d25ad52
@ -7,14 +7,14 @@ const ESharedfileType = require('../resources/ESharedfileType.js');
|
||||
|
||||
/**
|
||||
* Scrape a sharedfile's DOM to get all available information
|
||||
* @param {String} sid - ID of the sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {function} callback - First argument is null/Error, second is object containing all available information
|
||||
*/
|
||||
SteamCommunity.prototype.getSteamSharedfile = function(sid, callback) {
|
||||
SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
|
||||
|
||||
// Construct object holding all the data we can scrape
|
||||
let sharedfile = {
|
||||
id: sid,
|
||||
id: sharedFileId,
|
||||
type: null,
|
||||
appID: null,
|
||||
owner: null,
|
||||
@ -28,7 +28,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sid, callback) {
|
||||
|
||||
|
||||
// Get DOM of sharedfile
|
||||
this.httpRequestGet(`https://steamcommunity.com/sharedfiles/filedetails/?id=${sid}`, (err, res, body) => {
|
||||
this.httpRequestGet(`https://steamcommunity.com/sharedfiles/filedetails/?id=${sharedFileId}`, (err, res, body) => {
|
||||
try {
|
||||
|
||||
/* --------------------- Preprocess output --------------------- */
|
||||
@ -66,7 +66,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sid, callback) {
|
||||
/* --------------------- Find and map values --------------------- */
|
||||
|
||||
// Find appID in share button onclick event
|
||||
sharedfile.appID = Number($("#ShareItemBtn").attr()["onclick"].replace(`ShowSharePublishedFilePopup( '${sid}', '`, "").replace("' );", ""));
|
||||
sharedfile.appID = Number($("#ShareItemBtn").attr()["onclick"].replace(`ShowSharePublishedFilePopup( '${sharedFileId}', '`, "").replace("' );", ""));
|
||||
|
||||
|
||||
// Find fileSize if not guide
|
||||
|
@ -5,17 +5,17 @@ var SteamID = require('steamid');
|
||||
/**
|
||||
* Deletes a comment from a sharedfile's comment section
|
||||
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
|
||||
* @param {String} sid - ID of the sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} cid - ID of the comment to delete
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.deleteSharedfileComment = function(userID, sid, cid, callback) {
|
||||
SteamCommunity.prototype.deleteSharedfileComment = function(userID, sharedFileId, cid, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/delete/${userID.toString()}/${sid}/`,
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/delete/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"gidcomment": cid,
|
||||
"count": 10,
|
||||
@ -32,15 +32,15 @@ SteamCommunity.prototype.deleteSharedfileComment = function(userID, sid, cid, ca
|
||||
|
||||
/**
|
||||
* Favorites a sharedfile
|
||||
* @param {String} sid - ID of the sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} appid - ID of the app associated to this sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.favoriteSharedfile = function(sid, appid, callback) {
|
||||
SteamCommunity.prototype.favoriteSharedfile = function(sharedFileId, appid, callback) {
|
||||
this.httpRequestPost({
|
||||
"uri": "https://steamcommunity.com/sharedfiles/favorite",
|
||||
"form": {
|
||||
"id": sid,
|
||||
"id": sharedFileId,
|
||||
"appid": appid,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
@ -56,17 +56,17 @@ SteamCommunity.prototype.favoriteSharedfile = function(sid, appid, callback) {
|
||||
/**
|
||||
* Posts a comment to a sharedfile
|
||||
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
|
||||
* @param {String} sid - ID of the sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} message - Content of the comment to post
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.postSharedfileComment = function(userID, sid, message, callback) {
|
||||
SteamCommunity.prototype.postSharedfileComment = function(userID, sharedFileId, message, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/post/${userID.toString()}/${sid}/`,
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/post/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"comment": message,
|
||||
"count": 10,
|
||||
@ -84,16 +84,16 @@ SteamCommunity.prototype.postSharedfileComment = function(userID, sid, message,
|
||||
/**
|
||||
* Subscribes to a sharedfile's comment section. Note: Checkbox on webpage does not update
|
||||
* @param {SteamID | String} userID ID of the user associated to this sharedfile
|
||||
* @param {String} sid ID of the sharedfile
|
||||
* @param {String} sharedFileId ID of the sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.subscribeSharedfileComments = function(userID, sid, callback) {
|
||||
SteamCommunity.prototype.subscribeSharedfileComments = function(userID, sharedFileId, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/subscribe/${userID.toString()}/${sid}/`,
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/subscribe/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"count": 10,
|
||||
"sessionid": this.getSessionID()
|
||||
@ -109,15 +109,15 @@ SteamCommunity.prototype.subscribeSharedfileComments = function(userID, sid, cal
|
||||
|
||||
/**
|
||||
* Unfavorites a sharedfile
|
||||
* @param {String} sid - ID of the sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {String} appid - ID of the app associated to this sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.unfavoriteSharedfile = function(sid, appid, callback) {
|
||||
SteamCommunity.prototype.unfavoriteSharedfile = function(sharedFileId, appid, callback) {
|
||||
this.httpRequestPost({
|
||||
"uri": "https://steamcommunity.com/sharedfiles/unfavorite",
|
||||
"form": {
|
||||
"id": sid,
|
||||
"id": sharedFileId,
|
||||
"appid": appid,
|
||||
"sessionid": this.getSessionID()
|
||||
}
|
||||
@ -133,16 +133,16 @@ SteamCommunity.prototype.unfavoriteSharedfile = function(sid, appid, callback) {
|
||||
/**
|
||||
* Unsubscribes from a sharedfile's comment section. Note: Checkbox on webpage does not update
|
||||
* @param {SteamID | String} userID - ID of the user associated to this sharedfile
|
||||
* @param {String} sid - ID of the sharedfile
|
||||
* @param {String} sharedFileId - ID of the sharedfile
|
||||
* @param {function} callback - Takes only an Error object/null as the first argument
|
||||
*/
|
||||
SteamCommunity.prototype.unsubscribeSharedfileComments = function(userID, sid, callback) {
|
||||
SteamCommunity.prototype.unsubscribeSharedfileComments = function(userID, sharedFileId, callback) {
|
||||
if (typeof userID === "string") {
|
||||
userID = new SteamID(userID);
|
||||
}
|
||||
|
||||
this.httpRequestPost({
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/unsubscribe/${userID.toString()}/${sid}/`,
|
||||
"uri": `https://steamcommunity.com/comment/PublishedFile_Public/unsubscribe/${userID.toString()}/${sharedFileId}/`,
|
||||
"form": {
|
||||
"count": 10,
|
||||
"sessionid": this.getSessionID()
|
||||
|
Loading…
Reference in New Issue
Block a user