gj-boomlings-api 1.2.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 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(58825144).then(console.log); // returns "xo"
19
+ gd.dlLevel(42584142).then(console.log);
20
20
  ```
21
21
 
22
22
  Returns:
23
23
 
24
24
  ```
25
25
  {
26
- id: 58825144,
27
- name: 'xo',
28
- description: 'stream vertigo',
29
- creator: 'KrmaL',
30
- level_version: 2,
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: 2587512,
34
- likes: 106611,
33
+ downloads: 18914789,
34
+ likes: 697155,
35
35
  disliked: false,
36
36
  length: 'XL',
37
- password: '000007',
37
+ password: '121296',
38
38
  demon: true,
39
- featured: false,
40
- epic: false,
41
- objects: 37838,
42
- uploaded: '2 years',
43
- updated: '2 years',
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: 0,
47
+ copied: 25066306,
48
48
  two_p: false,
49
49
  coins: 0,
50
50
  verified_coins: false,
51
51
  song: {
52
- name: 'XO (Eden Cover & Remake)',
53
- id: 766165,
54
- artist: 'aaronmusslewhite',
55
- artistId: 2130,
56
- fileSize: '6.1 MB',
57
- link: 'http://audio.ngfiles.com/766000/766165_XO-Eden-Cover-amp-Remake.mp3'
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 [GDDocs](https://github.com/gd-programming/gd.docs/) for helping me in creating this package.
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.replace(/_/g, '/').replace(/-/g, '+'));
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
  }
@@ -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,6 +125,15 @@ 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");
@@ -144,7 +154,7 @@ module.exports = {
144
154
  demon: demonBoolDecoding[demonBool],
145
155
  featured: featured,
146
156
  epic: demonBoolDecoding[epic],
147
- objects: Number(objects),
157
+ objects: objects,
148
158
  uploaded: uploaded,
149
159
  updated: updated,
150
160
  stars_requested: Number(starsRequested),
@@ -156,6 +166,7 @@ module.exports = {
156
166
  verified_coins: verifiedCoins,
157
167
  song: basicInfoAboutLevel.song,
158
168
  }
169
+
159
170
  if(basicInfoAboutLevel.pointercrate != undefined) {
160
171
  result = {
161
172
  id: Number(id),
@@ -173,7 +184,7 @@ module.exports = {
173
184
  demon: demonBoolDecoding[demonBool],
174
185
  featured: featured,
175
186
  epic: demonBoolDecoding[epic],
176
- objects: Number(objects),
187
+ objects: objects,
177
188
  uploaded: uploaded,
178
189
  updated: updated,
179
190
  stars_requested: Number(starsRequested),
@@ -6,7 +6,7 @@ module.exports = {
6
6
  const { headers, server } = require("../config.json");
7
7
  const data = {
8
8
  secret: "Wmfd2893gb7",
9
- page: page - 1
9
+ page: Number(page) - 1
10
10
  }
11
11
 
12
12
  let res = await axios.post(server + "getGJMapPacks21.php", data, {
package/misc/demonlist.js CHANGED
@@ -3,7 +3,7 @@ module.exports = {
3
3
  async function(name) {
4
4
  const axios = require("axios");
5
5
  let r = await axios.get(`https://pointercrate.com/api/v2/demons/?name=${name}`);
6
- if(r.data == "[]") return null;
6
+ if(r.data[0] == undefined) return null;
7
7
 
8
8
  const res = {
9
9
  "position": r.data[0].position,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "1.2.0",
4
- "description": "A Node.js module that allows you to fetch boomlings.com easily",
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",