gj-boomlings-api 1.1.0 → 1.2.1
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 +92 -22
- package/functions/decURLSafeBase64.js +1 -1
- package/functions/dlLevel.js +72 -31
- package/functions/getLevelByID.js +1 -1
- package/functions/getMapPacks.js +1 -1
- package/misc/decodeLevel.js +56 -24
- package/misc/demonlist.js +16 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,45 +16,50 @@ So basically this function downloads the entire level and converts the response
|
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
18
|
const gd = require("gj-boomlings-api");
|
|
19
|
-
gd.dlLevel(
|
|
19
|
+
gd.dlLevel(42584142).then(console.log);
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Returns:
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
{
|
|
26
|
-
id:
|
|
27
|
-
name: '
|
|
28
|
-
description: '
|
|
29
|
-
creator: '
|
|
30
|
-
level_version:
|
|
26
|
+
id: 42584142,
|
|
27
|
+
name: 'Bloodlust',
|
|
28
|
+
description: 'Your thirst for blood continues? Very well, let the blood spill. Let the demons feed off your unfortunate soul...',
|
|
29
|
+
creator: 'Knobbelboy',
|
|
30
|
+
level_version: 3,
|
|
31
31
|
difficulty: 'Extreme Demon',
|
|
32
32
|
stars: 10,
|
|
33
|
-
downloads:
|
|
34
|
-
likes:
|
|
33
|
+
downloads: 18914789,
|
|
34
|
+
likes: 697155,
|
|
35
35
|
disliked: false,
|
|
36
36
|
length: 'XL',
|
|
37
|
-
password: '
|
|
37
|
+
password: '121296',
|
|
38
38
|
demon: true,
|
|
39
|
-
featured:
|
|
40
|
-
epic:
|
|
41
|
-
objects:
|
|
42
|
-
uploaded: '
|
|
43
|
-
updated: '
|
|
39
|
+
featured: true,
|
|
40
|
+
epic: true,
|
|
41
|
+
objects: 170739,
|
|
42
|
+
uploaded: '4 years',
|
|
43
|
+
updated: '6 months',
|
|
44
44
|
stars_requested: 10,
|
|
45
45
|
game_version: '2.1',
|
|
46
46
|
ldm: false,
|
|
47
|
-
copied:
|
|
47
|
+
copied: 25066306,
|
|
48
48
|
two_p: false,
|
|
49
49
|
coins: 0,
|
|
50
50
|
verified_coins: false,
|
|
51
51
|
song: {
|
|
52
|
-
name: '
|
|
53
|
-
id:
|
|
54
|
-
artist: '
|
|
55
|
-
artistId:
|
|
56
|
-
fileSize: '
|
|
57
|
-
link: '
|
|
52
|
+
name: 'At the Speed of Light',
|
|
53
|
+
id: 467339,
|
|
54
|
+
artist: 'Dimrain47',
|
|
55
|
+
artistId: 52,
|
|
56
|
+
fileSize: '9.56 MB',
|
|
57
|
+
link: 'https://geometrydashcontent.b-cdn.net/songs/467339.mp3'
|
|
58
|
+
},
|
|
59
|
+
pointercrate: {
|
|
60
|
+
position: 49,
|
|
61
|
+
publisher: 'knobbelboy',
|
|
62
|
+
verifier: 'knobbelboy'
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
```
|
|
@@ -102,9 +107,74 @@ gd.uploadComment("I love gj-boomlings-api!", 83925274, "gmdshxdow", "*********",
|
|
|
102
107
|
```
|
|
103
108
|
|
|
104
109
|
Posts a comment on the level with the ID of 83925274, with 99 percent, on gmdshxdow's behalf.
|
|
110
|
+
### getMapPacks(page)
|
|
111
|
+
|
|
112
|
+
This function gets the info about the map packs on a specified page (if left out, defaults to 1).
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
const gd = require("gj-boomlings-api");
|
|
116
|
+
gd.getMapPacks(7).then(console.log);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
[
|
|
123
|
+
{
|
|
124
|
+
name: 'Demon Pack 13',
|
|
125
|
+
id: 49,
|
|
126
|
+
levels: [ 764038, 897837, 848722 ],
|
|
127
|
+
stars: 10,
|
|
128
|
+
coins: 2,
|
|
129
|
+
difficulty: 'Hard Demon',
|
|
130
|
+
textColor: '#00FF00',
|
|
131
|
+
barColor: '#00FF00'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'Demon Pack 14',
|
|
135
|
+
id: 50,
|
|
136
|
+
levels: [ 840397, 413504, 839175 ],
|
|
137
|
+
stars: 10,
|
|
138
|
+
coins: 2,
|
|
139
|
+
difficulty: 'Hard Demon',
|
|
140
|
+
textColor: '#00FFFF',
|
|
141
|
+
barColor: '#00FFFF'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'Demon Pack 15',
|
|
145
|
+
id: 64,
|
|
146
|
+
levels: [ 1018758, 1326086, 1698428 ],
|
|
147
|
+
stars: 10,
|
|
148
|
+
coins: 2,
|
|
149
|
+
difficulty: 'Hard Demon',
|
|
150
|
+
textColor: '#FF0000',
|
|
151
|
+
barColor: '#FF0000'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'Demon Pack 16',
|
|
155
|
+
id: 65,
|
|
156
|
+
levels: [ 1668421, 1703546, 923264 ],
|
|
157
|
+
stars: 10,
|
|
158
|
+
coins: 2,
|
|
159
|
+
difficulty: 'Hard Demon',
|
|
160
|
+
textColor: '#FFFF00',
|
|
161
|
+
barColor: '#FFFF00'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'Demon Pack 17',
|
|
165
|
+
id: 66,
|
|
166
|
+
levels: [ 1650666, 1474319, 1777565 ],
|
|
167
|
+
stars: 10,
|
|
168
|
+
coins: 2,
|
|
169
|
+
difficulty: 'Hard Demon',
|
|
170
|
+
textColor: '#96FF96',
|
|
171
|
+
barColor: '#96FF96'
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
```
|
|
105
175
|
|
|
106
176
|
**Check out [docs](./docs/) for more info.**
|
|
107
177
|
|
|
108
178
|
---
|
|
109
179
|
|
|
110
|
-
Inspired by [GDBrowser](https://github.com/GDColon/GDBrowser/). Thanks to [Wireshark](https://www.wireshark.org/) and [
|
|
180
|
+
Inspired by [GDBrowser](https://github.com/GDColon/GDBrowser/). Thanks to [Wireshark](https://www.wireshark.org/) and [GD Docs](https://github.com/gd-programming/gd.docs/) for helping me in creating this package.
|
|
@@ -3,7 +3,7 @@ module.exports = {
|
|
|
3
3
|
function(string) {
|
|
4
4
|
const bs = require("js-base64");
|
|
5
5
|
if(!string || string == "") throw new Error("No string provided!")
|
|
6
|
-
let str = bs.decode(string.
|
|
6
|
+
let str = bs.decode(string.replaceAll("_", '/').replaceAll("-", '+'));
|
|
7
7
|
if(!bs.isValid(str)) throw new Error("The provided string is not encoded in Base64!")
|
|
8
8
|
return str;
|
|
9
9
|
}
|
package/functions/dlLevel.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
dlLevel:
|
|
3
3
|
async function(level) {
|
|
4
|
-
const bs = require("js-base64")
|
|
4
|
+
const bs = require("js-base64");
|
|
5
|
+
const zlib = require("zlib");
|
|
5
6
|
if(!level || level == "") throw new Error("Please provide a level ID.");
|
|
6
7
|
if(isNaN(level)) throw new Error("The level parameter should be a number.");
|
|
7
8
|
|
|
@@ -37,6 +38,7 @@ module.exports = {
|
|
|
37
38
|
let id = levelInfo[0].split("1:")[1];
|
|
38
39
|
let name = levelInfo[1].split("2:")[1];
|
|
39
40
|
let description = bs.decode(levelInfo[2].split("3:")[1])
|
|
41
|
+
let levelStr = levelInfo[3].split("4:")[1];
|
|
40
42
|
let version = levelInfo[4].split("5:")[1];
|
|
41
43
|
let difficulty = levelInfo[7].split("9:")[1];
|
|
42
44
|
let downloads = levelInfo[8].split("10:")[1];
|
|
@@ -47,7 +49,6 @@ module.exports = {
|
|
|
47
49
|
let stars = levelInfo[15].split("18:")[1];
|
|
48
50
|
let ftrd = levelInfo[16].split("19:")[1];
|
|
49
51
|
let epic = levelInfo[17].split("42:")[1];
|
|
50
|
-
let objects = levelInfo[18].split("45:")[1];
|
|
51
52
|
let length = levelInfo[19].split("15:")[1];
|
|
52
53
|
let copiedID = levelInfo[20].split("30:")[1];
|
|
53
54
|
let twoPlayer = levelInfo[21].split("31:")[1];
|
|
@@ -124,39 +125,79 @@ module.exports = {
|
|
|
124
125
|
"21": "2.1"
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
let objects;
|
|
129
|
+
|
|
130
|
+
zlib.unzip(Buffer.from(levelStr, "base64"), (err, buffer) => {
|
|
131
|
+
const raw_data = buffer.toString();
|
|
132
|
+
const objArray = raw_data.split(";");
|
|
133
|
+
objArray.shift();
|
|
134
|
+
objects = objArray.length - 1;
|
|
135
|
+
});
|
|
136
|
+
|
|
127
137
|
if(description == '') description = "(No description provided)";
|
|
128
138
|
|
|
129
139
|
const { getLevelByID } = require("./getLevelByID.js");
|
|
130
140
|
let basicInfoAboutLevel = await getLevelByID(id);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
141
|
+
let result = {
|
|
142
|
+
id: Number(id),
|
|
143
|
+
name: name,
|
|
144
|
+
description: description,
|
|
145
|
+
creator: basicInfoAboutLevel.creator,
|
|
146
|
+
level_version: Number(version),
|
|
147
|
+
difficulty: difficultyDecoding[difficulty],
|
|
148
|
+
stars: Number(stars),
|
|
149
|
+
downloads: Number(downloads),
|
|
150
|
+
likes: Number(likes),
|
|
151
|
+
disliked: disliked,
|
|
152
|
+
length: lengthDecoding[length],
|
|
153
|
+
password: password.replace("1", ""),
|
|
154
|
+
demon: demonBoolDecoding[demonBool],
|
|
155
|
+
featured: featured,
|
|
156
|
+
epic: demonBoolDecoding[epic],
|
|
157
|
+
objects: objects,
|
|
158
|
+
uploaded: uploaded,
|
|
159
|
+
updated: updated,
|
|
160
|
+
stars_requested: Number(starsRequested),
|
|
161
|
+
game_version: decodeGameVersion[gameVersion],
|
|
162
|
+
ldm: demonBoolDecoding[ldm],
|
|
163
|
+
copied: Number(copiedID),
|
|
164
|
+
two_p: demonBoolDecoding[twoPlayer],
|
|
165
|
+
coins: Number(coins),
|
|
166
|
+
verified_coins: verifiedCoins,
|
|
167
|
+
song: basicInfoAboutLevel.song,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if(basicInfoAboutLevel.pointercrate != undefined) {
|
|
171
|
+
result = {
|
|
172
|
+
id: Number(id),
|
|
173
|
+
name: name,
|
|
174
|
+
description: description,
|
|
175
|
+
creator: basicInfoAboutLevel.creator,
|
|
176
|
+
level_version: Number(version),
|
|
177
|
+
difficulty: difficultyDecoding[difficulty],
|
|
178
|
+
stars: Number(stars),
|
|
179
|
+
downloads: Number(downloads),
|
|
180
|
+
likes: Number(likes),
|
|
181
|
+
disliked: disliked,
|
|
182
|
+
length: lengthDecoding[length],
|
|
183
|
+
password: password.replace("1", ""),
|
|
184
|
+
demon: demonBoolDecoding[demonBool],
|
|
185
|
+
featured: featured,
|
|
186
|
+
epic: demonBoolDecoding[epic],
|
|
187
|
+
objects: objects,
|
|
188
|
+
uploaded: uploaded,
|
|
189
|
+
updated: updated,
|
|
190
|
+
stars_requested: Number(starsRequested),
|
|
191
|
+
game_version: decodeGameVersion[gameVersion],
|
|
192
|
+
ldm: demonBoolDecoding[ldm],
|
|
193
|
+
copied: Number(copiedID),
|
|
194
|
+
two_p: demonBoolDecoding[twoPlayer],
|
|
195
|
+
coins: Number(coins),
|
|
196
|
+
verified_coins: verifiedCoins,
|
|
197
|
+
song: basicInfoAboutLevel.song,
|
|
198
|
+
pointercrate: basicInfoAboutLevel.pointercrate
|
|
199
|
+
}
|
|
200
|
+
}
|
|
160
201
|
|
|
161
202
|
return result;
|
|
162
203
|
}
|
package/functions/getMapPacks.js
CHANGED
package/misc/decodeLevel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
decodeLevel:
|
|
3
|
-
function(level){
|
|
3
|
+
async function(level){
|
|
4
4
|
const bs = require("js-base64");
|
|
5
5
|
|
|
6
6
|
let spl = level.split(':');
|
|
@@ -134,30 +134,62 @@ module.exports = {
|
|
|
134
134
|
song = songinfo;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
137
|
+
let result;
|
|
138
|
+
const { demonlist } = require("./demonlist.js");
|
|
139
|
+
let dlist = await demonlist(name);
|
|
140
|
+
|
|
141
|
+
if(dlist != null) {
|
|
142
|
+
result = {
|
|
143
|
+
id: Number(id),
|
|
144
|
+
name: name,
|
|
145
|
+
description: bs.decode(desc),
|
|
146
|
+
creator: author,
|
|
147
|
+
level_version: Number(version),
|
|
148
|
+
difficulty: difficultyDecoding[difficulty],
|
|
149
|
+
stars: Number(stars),
|
|
150
|
+
downloads: Number(downloads),
|
|
151
|
+
likes: Number(likes),
|
|
152
|
+
disliked: disliked,
|
|
153
|
+
length: lengthDecoding[length],
|
|
154
|
+
demon: demonBoolDecoding[demonBool],
|
|
155
|
+
featured: featured,
|
|
156
|
+
epic: demonBoolDecoding[epic],
|
|
157
|
+
objects: Number(objs),
|
|
158
|
+
stars_requested: Number(starsRequested),
|
|
159
|
+
game_version: decodeGameVersion[gameVersion],
|
|
160
|
+
copied: Number(copiedID),
|
|
161
|
+
two_p: demonBoolDecoding[twoPlayer],
|
|
162
|
+
coins: Number(coins),
|
|
163
|
+
verified_coins: verifiedCoins,
|
|
164
|
+
song: song,
|
|
165
|
+
pointercrate: dlist
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
result = {
|
|
169
|
+
id: Number(id),
|
|
170
|
+
name: name,
|
|
171
|
+
description: bs.decode(desc),
|
|
172
|
+
creator: author,
|
|
173
|
+
level_version: Number(version),
|
|
174
|
+
difficulty: difficultyDecoding[difficulty],
|
|
175
|
+
stars: Number(stars),
|
|
176
|
+
downloads: Number(downloads),
|
|
177
|
+
likes: Number(likes),
|
|
178
|
+
disliked: disliked,
|
|
179
|
+
length: lengthDecoding[length],
|
|
180
|
+
demon: demonBoolDecoding[demonBool],
|
|
181
|
+
featured: featured,
|
|
182
|
+
epic: demonBoolDecoding[epic],
|
|
183
|
+
objects: Number(objs),
|
|
184
|
+
stars_requested: Number(starsRequested),
|
|
185
|
+
game_version: decodeGameVersion[gameVersion],
|
|
186
|
+
copied: Number(copiedID),
|
|
187
|
+
two_p: demonBoolDecoding[twoPlayer],
|
|
188
|
+
coins: Number(coins),
|
|
189
|
+
verified_coins: verifiedCoins,
|
|
190
|
+
song: song
|
|
160
191
|
}
|
|
192
|
+
}
|
|
161
193
|
|
|
162
194
|
return result;
|
|
163
195
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
demonlist:
|
|
3
|
+
async function(name) {
|
|
4
|
+
const axios = require("axios");
|
|
5
|
+
let r = await axios.get(`https://pointercrate.com/api/v2/demons/?name=${name}`);
|
|
6
|
+
if(r.data[0] == undefined) return null;
|
|
7
|
+
|
|
8
|
+
const res = {
|
|
9
|
+
"position": r.data[0].position,
|
|
10
|
+
"publisher": r.data[0].publisher.name,
|
|
11
|
+
"verifier": r.data[0].verifier.name,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gj-boomlings-api",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "A light-weight Geometry Dash API wrapper",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|