gj-boomlings-api 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -44
- package/config.json +1 -1
- package/docs/dlLevel.md +52 -0
- package/docs/getAccountPosts.md +71 -0
- package/docs/getCommentHistory.md +123 -0
- package/docs/getComments.md +113 -0
- package/docs/getDailyLevel.md +17 -0
- package/docs/getGauntlets.md +81 -0
- package/docs/getOfficialSongInfo.md +25 -0
- package/docs/getProfile.md +36 -0
- package/docs/getSongInfo.md +26 -0
- package/docs/getWeeklyDemon.md +17 -0
- package/docs/objects/acc_comment.md +19 -0
- package/docs/objects/comment.md +34 -0
- package/docs/objects/level.md +95 -0
- package/docs/objects/song.md +28 -0
- package/docs/objects/user.md +61 -0
- package/docs/reportLevel.md +19 -0
- package/docs/uploadAccountPost.md +27 -0
- package/functions/decURLSafeBase64.js +1 -1
- package/functions/dlLevel.js +7 -7
- package/functions/encURLSafeBase64.js +2 -2
- package/functions/getAccountPosts.js +147 -0
- package/functions/getCommentHistory.js +146 -0
- package/functions/getComments.js +106 -14
- package/functions/getGauntlets.js +55 -0
- package/functions/getOfficialSongInfo.js +1 -1
- package/functions/getProfile.js +4 -4
- package/functions/getSongInfo.js +3 -3
- package/functions/reportLevel.js +4 -4
- package/functions/uploadAccountPost.js +53 -0
- package/index.js +9 -3
- package/misc/decCommentFromHistory.js +31 -0
- package/misc/decodeAccountPost.js +18 -0
- package/misc/decodeGJComment.js +2 -8
- package/misc/decodeGJGauntlet.js +45 -0
- package/misc/officialsongs.json +0 -39
- package/package.json +1 -2
- package/functions/getLevelData.js +0 -30
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Level object
|
|
2
|
+
|
|
3
|
+
Used by ```dlLevel()```.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
```
|
|
7
|
+
{
|
|
8
|
+
id: 58825144,
|
|
9
|
+
name: 'xo',
|
|
10
|
+
description: 'stream vertigo',
|
|
11
|
+
creator: 'KrmaL',
|
|
12
|
+
level_version: 2,
|
|
13
|
+
difficulty: 'Extreme Demon',
|
|
14
|
+
stars: 10,
|
|
15
|
+
downloads: 2587512,
|
|
16
|
+
likes: 106611,
|
|
17
|
+
disliked: false,
|
|
18
|
+
length: 'XL',
|
|
19
|
+
password: '000007',
|
|
20
|
+
demon: true,
|
|
21
|
+
featured: false,
|
|
22
|
+
epic: false,
|
|
23
|
+
objects: 37838,
|
|
24
|
+
uploaded: '2 years',
|
|
25
|
+
updated: '2 years',
|
|
26
|
+
stars_requested: 10,
|
|
27
|
+
game_version: '2.1',
|
|
28
|
+
ldm: false,
|
|
29
|
+
copied: 0,
|
|
30
|
+
two_p: false,
|
|
31
|
+
coins: 0,
|
|
32
|
+
verified_coins: false,
|
|
33
|
+
song: {
|
|
34
|
+
name: 'XO (Eden Cover & Remake)',
|
|
35
|
+
id: 766165,
|
|
36
|
+
artist: 'aaronmusslewhite',
|
|
37
|
+
artistId: 2130,
|
|
38
|
+
fileSize: '6.1 MB',
|
|
39
|
+
link: 'http://audio.ngfiles.com/766000/766165_XO-Eden-Cover-amp-Remake.mp3'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Properties
|
|
45
|
+
```id``` - the level ID.
|
|
46
|
+
|
|
47
|
+
```name``` - the level name.
|
|
48
|
+
|
|
49
|
+
```description``` - the level description.
|
|
50
|
+
|
|
51
|
+
```creator``` - the level creator.
|
|
52
|
+
|
|
53
|
+
```level_version``` - the version of a level.
|
|
54
|
+
|
|
55
|
+
```difficulty``` - the level difficulty.
|
|
56
|
+
|
|
57
|
+
```stars``` - the amount of stars you get from beating the level.
|
|
58
|
+
|
|
59
|
+
```downloads``` - the amount of level downloads.
|
|
60
|
+
|
|
61
|
+
```likes``` - the amount of level likes.
|
|
62
|
+
|
|
63
|
+
```disliked``` - a boolean that shows if the level is disliked. Returns ```true``` if the like amount is negative, otherwise it's ```false```.
|
|
64
|
+
|
|
65
|
+
```length``` - the level length.
|
|
66
|
+
|
|
67
|
+
```password``` - the level password. It may return ```'Non-copyable'``` if the level is not copyable, or ```'1'``` if the level is free to copy.
|
|
68
|
+
|
|
69
|
+
```demon``` - a boolean that shows if the level is demon.
|
|
70
|
+
|
|
71
|
+
```featured``` - a boolean that shows if the level has been featured.
|
|
72
|
+
|
|
73
|
+
```epic``` - a boolean that shows if the level is epic-rated.
|
|
74
|
+
|
|
75
|
+
```objects``` - the amount of level objects. However, this property has a cap of 65535 objects (it's RobTop's problem).
|
|
76
|
+
|
|
77
|
+
```uploaded``` - when the level has been uploaded.
|
|
78
|
+
|
|
79
|
+
```updated``` - when the level has been last updated.
|
|
80
|
+
|
|
81
|
+
```stars_requested``` - basically how many stars the creator has requested. Returns ```0``` if no stars have been requested.
|
|
82
|
+
|
|
83
|
+
```game_version``` - the version required to play the level.
|
|
84
|
+
|
|
85
|
+
```ldm``` - a boolean that shows if the level has a "Low Detail Mode" checkbox.
|
|
86
|
+
|
|
87
|
+
```copied``` - the original level ID, that got copied. Returns ```0``` if the level is already original.
|
|
88
|
+
|
|
89
|
+
```two_p``` - a boolean that shows if the level is in the 2-player mode.
|
|
90
|
+
|
|
91
|
+
```coins``` - the amount of coins in the level.
|
|
92
|
+
|
|
93
|
+
```verified_coins``` - a boolean that shows if the coins are verified (silver coins).
|
|
94
|
+
|
|
95
|
+
```song``` - a [song object](./song.md).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Song object
|
|
2
|
+
|
|
3
|
+
Used by `getOfficialSongInfo()` and `getSongInfo()`.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
```
|
|
7
|
+
{
|
|
8
|
+
name: 'Dynamics',
|
|
9
|
+
id: 1099128,
|
|
10
|
+
artist: 'shikoshib',
|
|
11
|
+
artistId: 10001037,
|
|
12
|
+
fileSize: '5.74 MB',
|
|
13
|
+
link: 'https://audio.ngfiles.com/1099000/1099128_Dynamics.mp3?f1640426773'
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Properties
|
|
18
|
+
```name``` - the song name.
|
|
19
|
+
|
|
20
|
+
```id``` - the song ID.
|
|
21
|
+
|
|
22
|
+
```artist``` - the song artist.
|
|
23
|
+
|
|
24
|
+
```artistId``` - the artist's Newgrounds ID.
|
|
25
|
+
|
|
26
|
+
```fileSize``` - the size of the song in megabytes, rounded to two decimals.
|
|
27
|
+
|
|
28
|
+
```link``` - the link to a file of the song.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Level object
|
|
2
|
+
|
|
3
|
+
Used by ```getProfile()```.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
```
|
|
7
|
+
{
|
|
8
|
+
username: 'RobTop',
|
|
9
|
+
playerID: 16,
|
|
10
|
+
accountID: 71,
|
|
11
|
+
rank: 219796,
|
|
12
|
+
stars: 2375,
|
|
13
|
+
diamonds: 2170,
|
|
14
|
+
secretCoins: 3,
|
|
15
|
+
userCoins: 140,
|
|
16
|
+
demons: 5,
|
|
17
|
+
creatorPoints: 0,
|
|
18
|
+
messages: 'none',
|
|
19
|
+
friendRequests: 'none',
|
|
20
|
+
commentHistory: 'all',
|
|
21
|
+
mod: 'elder',
|
|
22
|
+
youtube: 'https://youtube.com/channel/UCz_yk8mDSAnxJq0ar66L4sw',
|
|
23
|
+
twitter: 'https://twitter.com/RobTopGames',
|
|
24
|
+
twitch: 'https://twitch.tv/robtopgames'
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Properties
|
|
29
|
+
```username``` - the player's username.
|
|
30
|
+
|
|
31
|
+
```playerID``` - the player ID.
|
|
32
|
+
|
|
33
|
+
```accountID``` - the account ID.
|
|
34
|
+
|
|
35
|
+
```rank``` - the user's position in the global leaderboard. Returns `0` if the player hasn't received it yet or if the player is banned on the leaderboard.
|
|
36
|
+
|
|
37
|
+
```stars``` - the amount of stars the player has.
|
|
38
|
+
|
|
39
|
+
```diamonds``` - the amount of diamonds the player has.
|
|
40
|
+
|
|
41
|
+
```secretCoins``` - the amount of secret (gold) coins the player has collected.
|
|
42
|
+
|
|
43
|
+
```userCoins``` - the amount of user (white) coins the player has collected.
|
|
44
|
+
|
|
45
|
+
```demons``` - the amount of demons the player has beaten.
|
|
46
|
+
|
|
47
|
+
```creatorPoints``` - the amount of creator points the player has.
|
|
48
|
+
|
|
49
|
+
```messages``` - a property that shows if you can send messages to the player. Returns `"none"` if the DMs are closed, `"friends"` if sending DMs is available to only friends, and `"all"` if everyone can send messages to the specified player.
|
|
50
|
+
|
|
51
|
+
```friendRequests``` - a property that shows if you can send friend requests to the player. Returns `"none"` if you can't or `"all"` if everyone can send friend requests to the specified player.
|
|
52
|
+
|
|
53
|
+
```commentHistory``` - a property that shows if you can view the player's comment history. Returns `"none"` if you can't, `"friends"` if viewing the comment history is available to only friends, and `"all"` if everyone can view the comment history.
|
|
54
|
+
|
|
55
|
+
```mod``` - a property that shows if the player is an in-game moderator. Returns `"none"` if not, `"mod"` if the player is a regular Mod (yellow badge), and `"elder"` if the player is an Elder Mod (orange badge).
|
|
56
|
+
|
|
57
|
+
```youtube``` - the link to the player's YouTube channel.
|
|
58
|
+
|
|
59
|
+
```twitter``` - the link to the player's Twitter account.
|
|
60
|
+
|
|
61
|
+
```twitch``` - the link to the player's Twitch channel.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# reportLevel()
|
|
2
|
+
|
|
3
|
+
Reports the level.
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
`level` - the level id.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
```js
|
|
10
|
+
const gd = require("gj-boomlings-api");
|
|
11
|
+
gd.reportLevel(54953085).then(console.log);
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Response
|
|
15
|
+
```js
|
|
16
|
+
1
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For some reason, the API always returns 1, even if you'll provide an invalid ID.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# uploadAccountPost()
|
|
2
|
+
|
|
3
|
+
Posts a comment to a profile.
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
`content` - the actual comment content.
|
|
7
|
+
|
|
8
|
+
`user` - the username or player ID.
|
|
9
|
+
|
|
10
|
+
`gjp` - the user's password.
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
```js
|
|
14
|
+
const gd = require("gj-boomlings-api");
|
|
15
|
+
gd.uploadAccountPost("i'm a furry", "colon", "*********").then(console.log);
|
|
16
|
+
// basically this function posts the "i'm a furry" message to Colon's profile
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Response
|
|
20
|
+
```js
|
|
21
|
+
1
|
|
22
|
+
```
|
|
23
|
+
Returns `1` if the comment was successfully posted.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
Fun fact: you can actually post comments with non-Latin characters (Cyrillic letters, Arabic letters, etc.), but I don't recommend you to use them, cuz they are often really buggy.
|
|
@@ -2,7 +2,7 @@ module.exports = {
|
|
|
2
2
|
decURLSafeBase64:
|
|
3
3
|
function(string) {
|
|
4
4
|
const bs = require("js-base64");
|
|
5
|
-
if(!string) throw new Error("No string provided!")
|
|
5
|
+
if(!string || string == "") throw new Error("No string provided!")
|
|
6
6
|
let str = bs.decode(string.replace(/_/g, '/').replace(/-/g, '+'));
|
|
7
7
|
if(!bs.isValid(str)) throw new Error("The provided string is not encoded in Base64!")
|
|
8
8
|
return str;
|
package/functions/dlLevel.js
CHANGED
|
@@ -2,10 +2,10 @@ module.exports = {
|
|
|
2
2
|
dlLevel:
|
|
3
3
|
async function(level) {
|
|
4
4
|
const bs = require("js-base64")
|
|
5
|
-
if(!level) throw new Error("Please provide a level ID.");
|
|
5
|
+
if(!level || level == "") throw new Error("Please provide a level ID.");
|
|
6
6
|
if(isNaN(level)) throw new Error("The level parameter should be a number.");
|
|
7
7
|
const axios = require("axios");
|
|
8
|
-
const { headers } = require("../config.json");
|
|
8
|
+
const { headers, server } = require("../config.json");
|
|
9
9
|
|
|
10
10
|
const XOR = require("../misc/xor.js");
|
|
11
11
|
let xor = new XOR()
|
|
@@ -14,11 +14,11 @@ module.exports = {
|
|
|
14
14
|
gameVersion: 21,
|
|
15
15
|
binaryVersion: 35,
|
|
16
16
|
gdw: 0,
|
|
17
|
-
levelID: level.trim(),
|
|
17
|
+
levelID: level.toString().trim(),
|
|
18
18
|
secret: "Wmfd2893gb7"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
let res = await axios.post('
|
|
21
|
+
let res = await axios.post(server + 'downloadGJLevel22.php', data, {
|
|
22
22
|
headers: headers
|
|
23
23
|
})
|
|
24
24
|
|
|
@@ -126,7 +126,7 @@ module.exports = {
|
|
|
126
126
|
str: split23.split(":8:")[0],
|
|
127
127
|
secret: "Wmfd2893gb7"
|
|
128
128
|
}
|
|
129
|
-
let auth = await axios.post("
|
|
129
|
+
let auth = await axios.post(server + "getGJUsers20.php", authData, {
|
|
130
130
|
headers: headers
|
|
131
131
|
})
|
|
132
132
|
let authname;
|
|
@@ -169,7 +169,7 @@ module.exports = {
|
|
|
169
169
|
try {
|
|
170
170
|
song = await getSongInfo(split26.split(":36:")[0]);
|
|
171
171
|
} catch(err) {
|
|
172
|
-
let songReq = await axios.post('
|
|
172
|
+
let songReq = await axios.post(server + 'getGJLevels21.php', {
|
|
173
173
|
gameVersion: 21,
|
|
174
174
|
binaryVersion: 35,
|
|
175
175
|
gdw: 0,
|
|
@@ -208,7 +208,7 @@ module.exports = {
|
|
|
208
208
|
const result = {
|
|
209
209
|
"id": Number(split1.split(":2:")[0]),
|
|
210
210
|
"name": split2.split(":3:")[0].toString(),
|
|
211
|
-
"description": desc,
|
|
211
|
+
"description": desc.trim(),
|
|
212
212
|
"creator": authname,
|
|
213
213
|
"level_version": Number(split4.split(":6:")[0]),
|
|
214
214
|
"difficulty": difficultyDecoding[split5.split(":10:")[0]].toString(),
|
|
@@ -2,8 +2,8 @@ module.exports = {
|
|
|
2
2
|
encURLSafeBase64:
|
|
3
3
|
function(string) {
|
|
4
4
|
const bs = require("js-base64");
|
|
5
|
-
if(!string) throw new Error("No string provided!")
|
|
6
|
-
let str = bs.encode(string).replace(
|
|
5
|
+
if(!string || string == "") throw new Error("No string provided!")
|
|
6
|
+
let str = bs.encode(string).replace(/\//g, '_').replace(/w+/g, '-');
|
|
7
7
|
return str;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
getAccountPosts:
|
|
3
|
+
async function(str, page = 1) {
|
|
4
|
+
if(!str || str == "") throw new Error("Please provide a user ID or name!");
|
|
5
|
+
const { decodeAccountPost } = require("../misc/decodeAccountPost.js");
|
|
6
|
+
const axios = require("axios");
|
|
7
|
+
const { headers, server } = require("../config.json");
|
|
8
|
+
|
|
9
|
+
const data = {
|
|
10
|
+
gameVersion: 21,
|
|
11
|
+
binaryVersion: 35,
|
|
12
|
+
gdw: 0,
|
|
13
|
+
str: str,
|
|
14
|
+
secret: "Wmfd2893gb7"
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let r = await axios.post(server + "getGJUsers20.php", data, {
|
|
18
|
+
headers: headers
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
if(r.data == -1) throw new Error("-1 This user is not found.")
|
|
22
|
+
let id = r.data.split(":16:")[1].split(":3:")[0];
|
|
23
|
+
if(Number(id) < 71 || id.includes(":")) id = r.data.split(":16:")[2].split(":3:")[0];
|
|
24
|
+
|
|
25
|
+
let ACdata = {
|
|
26
|
+
gameVersion: 21,
|
|
27
|
+
binaryVersion: 35,
|
|
28
|
+
gdw: 0,
|
|
29
|
+
accountID: id,
|
|
30
|
+
secret: "Wmfd2893gb7",
|
|
31
|
+
page: page - 1
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
let res = await axios.post(server + "getGJAccountComments20.php", ACdata, {
|
|
35
|
+
headers: headers
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
if(res.data == -1) throw new Error("-1 Not found.")
|
|
39
|
+
if(res.data.toLowerCase() == "error code: 1005") throw new Error("1005 error: Your IP address has been blocked from sending requests to a server. It's recommended to use locally (directly from a PC).")
|
|
40
|
+
if(res.data.startsWith("#")) throw new Error("Whoops! Couldn't find anything!");
|
|
41
|
+
|
|
42
|
+
let firstPost = res.data;
|
|
43
|
+
let secondPost;
|
|
44
|
+
let thirdPost;
|
|
45
|
+
let fourthPost;
|
|
46
|
+
let fifthPost;
|
|
47
|
+
let sixthPost;
|
|
48
|
+
let seventhPost;
|
|
49
|
+
let eighthPost;
|
|
50
|
+
let ninthPost;
|
|
51
|
+
let tenthPost;
|
|
52
|
+
|
|
53
|
+
let result = [decodeAccountPost(firstPost)]
|
|
54
|
+
|
|
55
|
+
if(res.data.split("|").length - 1 == 1) {
|
|
56
|
+
firstPost = res.data.split("|")[0];
|
|
57
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
58
|
+
result.push(decodeAccountPost(secondPost))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if(res.data.split("|").length - 1 == 2) {
|
|
62
|
+
firstPost = res.data.split("|")[0];
|
|
63
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
64
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
65
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if(res.data.split("|").length - 1 == 3) {
|
|
69
|
+
firstPost = res.data.split("|")[0];
|
|
70
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
71
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
72
|
+
fourthPost = res.data.split("|")[3].split("|")[0];
|
|
73
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost),decodeAccountPost(fourthPost))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if(res.data.split("|").length - 1 == 4) {
|
|
77
|
+
firstPost = res.data.split("|")[0];
|
|
78
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
79
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
80
|
+
fourthPost = res.data.split("|")[3].split("|")[0];
|
|
81
|
+
fifthPost = res.data.split("|")[4].split("|")[0];
|
|
82
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost),decodeAccountPost(fourthPost),decodeAccountPost(fifthPost))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if(res.data.split("|").length - 1 == 5) {
|
|
86
|
+
firstPost = res.data.split("|")[0];
|
|
87
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
88
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
89
|
+
fourthPost = res.data.split("|")[3].split("|")[0];
|
|
90
|
+
fifthPost = res.data.split("|")[4].split("|")[0];
|
|
91
|
+
sixthPost = res.data.split("|")[5].split("|")[0];
|
|
92
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost),decodeAccountPost(fourthPost),decodeAccountPost(fifthPost),decodeAccountPost(sixthPost))
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if(res.data.split("|").length - 1 == 6) {
|
|
96
|
+
firstPost = res.data.split("|")[0];
|
|
97
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
98
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
99
|
+
fourthPost = res.data.split("|")[3].split("|")[0];
|
|
100
|
+
fifthPost = res.data.split("|")[4].split("|")[0];
|
|
101
|
+
sixthPost = res.data.split("|")[5].split("|")[0];
|
|
102
|
+
seventhPost = res.data.split("|")[6].split("|")[0];
|
|
103
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost),decodeAccountPost(fourthPost),decodeAccountPost(fifthPost),decodeAccountPost(sixthPost),decodeAccountPost(seventhPost))
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if(res.data.split("|").length - 1 == 7) {
|
|
107
|
+
firstPost = res.data.split("|")[0];
|
|
108
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
109
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
110
|
+
fourthPost = res.data.split("|")[3].split("|")[0];
|
|
111
|
+
fifthPost = res.data.split("|")[4].split("|")[0];
|
|
112
|
+
sixthPost = res.data.split("|")[5].split("|")[0];
|
|
113
|
+
seventhPost = res.data.split("|")[6].split("|")[0];
|
|
114
|
+
eighthPost = res.data.split("|")[7].split("|")[0];
|
|
115
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost),decodeAccountPost(fourthPost),decodeAccountPost(fifthPost),decodeAccountPost(sixthPost),decodeAccountPost(seventhPost),decodeAccountPost(eighthPost))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if(res.data.split("|").length - 1 == 8) {
|
|
119
|
+
firstPost = res.data.split("|")[0];
|
|
120
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
121
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
122
|
+
fourthPost = res.data.split("|")[3].split("|")[0];
|
|
123
|
+
fifthPost = res.data.split("|")[4].split("|")[0];
|
|
124
|
+
sixthPost = res.data.split("|")[5].split("|")[0];
|
|
125
|
+
seventhPost = res.data.split("|")[6].split("|")[0];
|
|
126
|
+
eighthPost = res.data.split("|")[7].split("|")[0];
|
|
127
|
+
ninthPost = res.data.split("|")[8].split("|")[0];
|
|
128
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost),decodeAccountPost(fourthPost),decodeAccountPost(fifthPost),decodeAccountPost(sixthPost),decodeAccountPost(seventhPost),decodeAccountPost(eighthPost),decodeAccountPost(ninthPost))
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if(res.data.split("|").length - 1 == 9) {
|
|
132
|
+
firstPost = res.data.split("|")[0];
|
|
133
|
+
secondPost = res.data.split("|")[1].split("|")[0];
|
|
134
|
+
thirdPost = res.data.split("|")[2].split("|")[0];
|
|
135
|
+
fourthPost = res.data.split("|")[3].split("|")[0];
|
|
136
|
+
fifthPost = res.data.split("|")[4].split("|")[0];
|
|
137
|
+
sixthPost = res.data.split("|")[5].split("|")[0];
|
|
138
|
+
seventhPost = res.data.split("|")[6].split("|")[0];
|
|
139
|
+
eighthPost = res.data.split("|")[7].split("|")[0];
|
|
140
|
+
ninthPost = res.data.split("|")[8].split("|")[0];
|
|
141
|
+
tenthPost = res.data.split("|")[9].split("|")[0];
|
|
142
|
+
result.push(decodeAccountPost(secondPost),decodeAccountPost(thirdPost),decodeAccountPost(fourthPost),decodeAccountPost(fifthPost),decodeAccountPost(sixthPost),decodeAccountPost(seventhPost),decodeAccountPost(eighthPost),decodeAccountPost(ninthPost),decodeAccountPost(tenthPost))
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
getCommentHistory:
|
|
3
|
+
async function(str, page = 1, mode = 1) {
|
|
4
|
+
if(!str || str == "") throw new Error("Please provide a player ID or name!");
|
|
5
|
+
const axios = require("axios");
|
|
6
|
+
const {headers, server} = require("../config.json");
|
|
7
|
+
const {decCommentFromHistory} = require("../misc/decCommentFromHistory.js");
|
|
8
|
+
const {getProfile} = require("./getProfile.js");
|
|
9
|
+
|
|
10
|
+
const userData = {
|
|
11
|
+
gameVersion: 21,
|
|
12
|
+
binaryVersion: 35,
|
|
13
|
+
gdw: 0,
|
|
14
|
+
str: str,
|
|
15
|
+
secret: "Wmfd2893gb7"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let r = await axios.post(server + "getGJUsers20.php", userData, {
|
|
19
|
+
headers: headers
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
let id = r.data.split(":2:")[1].split(":13:")[0];
|
|
23
|
+
|
|
24
|
+
const user = await getProfile(id);
|
|
25
|
+
if(user.commentHistory != "all") throw new Error("Whoops! This user has disabled viewing his comment history!")
|
|
26
|
+
|
|
27
|
+
const CHData = {
|
|
28
|
+
gameVersion: 21,
|
|
29
|
+
binaryVersion: 35,
|
|
30
|
+
gdw: 0,
|
|
31
|
+
secret: "Wmfd2893gb7",
|
|
32
|
+
userID: id,
|
|
33
|
+
page: page - 1,
|
|
34
|
+
mode: 1
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let res = await axios.post(server + "getGJCommentHistory.php", CHData, {
|
|
38
|
+
headers: headers
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
let firstComment = res.data;
|
|
42
|
+
let secondComment;
|
|
43
|
+
let thirdComment;
|
|
44
|
+
let fourthComment;
|
|
45
|
+
let fifthComment;
|
|
46
|
+
let sixthComment;
|
|
47
|
+
let seventhComment;
|
|
48
|
+
let eighthComment;
|
|
49
|
+
let ninthComment;
|
|
50
|
+
let tenthComment;
|
|
51
|
+
|
|
52
|
+
let result = [decCommentFromHistory(firstComment)]
|
|
53
|
+
|
|
54
|
+
if(res.data.split("|").length - 1 == 1) {
|
|
55
|
+
firstComment = res.data.split("|")[0];
|
|
56
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
57
|
+
result.push(decCommentFromHistory(secondComment))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if(res.data.split("|").length - 1 == 2) {
|
|
61
|
+
firstComment = res.data.split("|")[0];
|
|
62
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
63
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
64
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if(res.data.split("|").length - 1 == 3) {
|
|
68
|
+
firstComment = res.data.split("|")[0];
|
|
69
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
70
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
71
|
+
fourthComment = res.data.split("|")[3].split("|")[0];
|
|
72
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment),decCommentFromHistory(fourthComment))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if(res.data.split("|").length - 1 == 4) {
|
|
76
|
+
firstComment = res.data.split("|")[0];
|
|
77
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
78
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
79
|
+
fourthComment = res.data.split("|")[3].split("|")[0];
|
|
80
|
+
fifthComment = res.data.split("|")[4].split("|")[0];
|
|
81
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment),decCommentFromHistory(fourthComment),decCommentFromHistory(fifthComment))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if(res.data.split("|").length - 1 == 5) {
|
|
85
|
+
firstComment = res.data.split("|")[0];
|
|
86
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
87
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
88
|
+
fourthComment = res.data.split("|")[3].split("|")[0];
|
|
89
|
+
fifthComment = res.data.split("|")[4].split("|")[0];
|
|
90
|
+
sixthComment = res.data.split("|")[5].split("|")[0];
|
|
91
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment),decCommentFromHistory(fourthComment),decCommentFromHistory(fifthComment),decCommentFromHistory(sixthComment))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if(res.data.split("|").length - 1 == 6) {
|
|
95
|
+
firstComment = res.data.split("|")[0];
|
|
96
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
97
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
98
|
+
fourthComment = res.data.split("|")[3].split("|")[0];
|
|
99
|
+
fifthComment = res.data.split("|")[4].split("|")[0];
|
|
100
|
+
sixthComment = res.data.split("|")[5].split("|")[0];
|
|
101
|
+
seventhComment = res.data.split("|")[6].split("|")[0];
|
|
102
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment),decCommentFromHistory(fourthComment),decCommentFromHistory(fifthComment),decCommentFromHistory(sixthComment),decCommentFromHistory(seventhComment))
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if(res.data.split("|").length - 1 == 7) {
|
|
106
|
+
firstComment = res.data.split("|")[0];
|
|
107
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
108
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
109
|
+
fourthComment = res.data.split("|")[3].split("|")[0];
|
|
110
|
+
fifthComment = res.data.split("|")[4].split("|")[0];
|
|
111
|
+
sixthComment = res.data.split("|")[5].split("|")[0];
|
|
112
|
+
seventhComment = res.data.split("|")[6].split("|")[0];
|
|
113
|
+
eighthComment = res.data.split("|")[7].split("|")[0];
|
|
114
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment),decCommentFromHistory(fourthComment),decCommentFromHistory(fifthComment),decCommentFromHistory(sixthComment),decCommentFromHistory(seventhComment),decCommentFromHistory(eighthComment))
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if(res.data.split("|").length - 1 == 8) {
|
|
118
|
+
firstComment = res.data.split("|")[0];
|
|
119
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
120
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
121
|
+
fourthComment = res.data.split("|")[3].split("|")[0];
|
|
122
|
+
fifthComment = res.data.split("|")[4].split("|")[0];
|
|
123
|
+
sixthComment = res.data.split("|")[5].split("|")[0];
|
|
124
|
+
seventhComment = res.data.split("|")[6].split("|")[0];
|
|
125
|
+
eighthComment = res.data.split("|")[7].split("|")[0];
|
|
126
|
+
ninthComment = res.data.split("|")[8].split("|")[0];
|
|
127
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment),decCommentFromHistory(fourthComment),decCommentFromHistory(fifthComment),decCommentFromHistory(sixthComment),decCommentFromHistory(seventhComment),decCommentFromHistory(eighthComment),decCommentFromHistory(ninthComment))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if(res.data.split("|").length - 1 == 9) {
|
|
131
|
+
firstComment = res.data.split("|")[0];
|
|
132
|
+
secondComment = res.data.split("|")[1].split("|")[0];
|
|
133
|
+
thirdComment = res.data.split("|")[2].split("|")[0];
|
|
134
|
+
fourthComment = res.data.split("|")[3].split("|")[0];
|
|
135
|
+
fifthComment = res.data.split("|")[4].split("|")[0];
|
|
136
|
+
sixthComment = res.data.split("|")[5].split("|")[0];
|
|
137
|
+
seventhComment = res.data.split("|")[6].split("|")[0];
|
|
138
|
+
eighthComment = res.data.split("|")[7].split("|")[0];
|
|
139
|
+
ninthComment = res.data.split("|")[8].split("|")[0];
|
|
140
|
+
tenthComment = res.data.split("|")[9].split("|")[0];
|
|
141
|
+
result.push(decCommentFromHistory(secondComment),decCommentFromHistory(thirdComment),decCommentFromHistory(fourthComment),decCommentFromHistory(fifthComment),decCommentFromHistory(sixthComment),decCommentFromHistory(seventhComment),decCommentFromHistory(eighthComment),decCommentFromHistory(ninthComment),decCommentFromHistory(tenthComment))
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
}
|