gj-boomlings-api 1.5.4 → 1.5.6

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.
@@ -4,4 +4,4 @@ module.exports={
4
4
  * @param {*} tab - The tab to get levels from.
5
5
  * @param {*} page - The page.
6
6
  */
7
- getTab:async function(tab,page=1){let validTabs={trending:3,recent:4,featured:6,magic:7,awarded:11,epic:16,"hall of fame":16};if(!validTabs[tab.toLowerCase()])throw new Error('Please provide a valid tab! Possible tabs: "trending", "recent", "featured", "magic", "awarded", "epic".');const{gjReq}=require("../misc/gjReq.js");const{gjWReq}=require("../misc/gjWReq.js");const{secret}=require("../config.json");let GJDecode=require("../misc/GJDecode.js");const{decodeLevelRes}=new GJDecode;const data={type:validTabs[tab.toLowerCase()],page:Number(page)-1,secret:secret};let res=await gjReq("getGJLevels21",data);if(res.data=="error code: 1005"){res=await gjWReq("getTab",`${tab}?page=${page}`);if(res.status==403)throw new Error(res.data.error);return res.data}let levels=res.data.split("#")[0].split("|");let creators=res.data.split("#")[1].split("|");let songs=res.data.split("#")[2].split(":");let result=[];let encCreators={};let encSongs={};creators.forEach(c=>{let playerID=c.split(":")[0];let username=c.split(":")[1];encCreators[playerID]=username});songs.forEach(s=>{let songId=s.split("~|~")[1];let songName=s.split("~|~")[3];let songArtistID=s.split("~|~")[5];let songArtist=s.split("~|~")[7];let size=s.split("~|~")[9];let link=s.split("~|~")[13];encSongs[songId]={name:songName,id:Number(songId),artist:songArtist,artistId:Number(songArtistID),fileSize:`${size} MB`,link:decodeURIComponent(link)}});for(const l of levels){let decLvl=decodeLevelRes(l);const{getOfficialSongInfo}=require("./getOfficialSongInfo.js");let lvl=decLvl.res;let officialSongID=Number(decLvl.officialSong);let songID=Number(decLvl.customSong);let playerId=decLvl.playerID;let song;if(officialSongID==0&&songID!=0||officialSongID!=0&&songID!=0)song=encSongs[songID.toString()];if(officialSongID!=0&&songID==0)song=getOfficialSongInfo(officialSongID+1);if(officialSongID==0&&songID==0)song=getOfficialSongInfo(1);lvl["creator"]=encCreators[playerId]!=undefined?encCreators[playerId]:"-";lvl["song"]=song;result.push(lvl)}return result}};
7
+ getTab:async function(tab,page=1){let validTabs={trending:3,recent:4,featured:6,magic:7,awarded:11,epic:16,"hall of fame":16};if(!validTabs[tab.toLowerCase()])throw new Error('Please provide a valid tab! Possible tabs: "trending", "recent", "featured", "magic", "awarded", "epic".');const{gjReq}=require("../misc/gjReq.js");const{gjWReq}=require("../misc/gjWReq.js");const{secret}=require("../config.json");let GJDecode=require("../misc/GJDecode.js");const{decodeLevelRes}=new GJDecode;const data={type:validTabs[tab.toLowerCase()],page:Number(page)-1,secret:secret};let res=await gjReq("getGJLevels21",data);if(res.data=="error code: 1005"){res=await gjWReq("getTab",`${tab}?page=${page}`);if(res.status==403)throw new Error(res.data.error);return res.data}let levels=res.data.split("#")[0].split("|");let creators=res.data.split("#")[1].split("|");let songs=res.data.split("#")[2].split("~:~");let result=[];let encCreators={};let encSongs={};creators.forEach(c=>{let playerID=c.split(":")[0];let username=c.split(":")[1];encCreators[playerID]=username});songs.forEach(s=>{let songId=s.split("~|~")[1];let songName=s.split("~|~")[3];let songArtistID=s.split("~|~")[5];let songArtist=s.split("~|~")[7];let size=s.split("~|~")[9];let link=s.split("~|~")[13];encSongs[songId]={name:songName,id:Number(songId),artist:songArtist,artistId:Number(songArtistID),fileSize:`${size} MB`,link:decodeURIComponent(link)}});for(const l of levels){let decLvl=decodeLevelRes(l);const{getOfficialSongInfo}=require("./getOfficialSongInfo.js");let lvl=decLvl.res;let officialSongID=Number(decLvl.officialSong);let songID=Number(decLvl.customSong);let playerId=decLvl.playerID;let song;if(officialSongID==0&&songID!=0||officialSongID!=0&&songID!=0)song=encSongs[songID.toString()];if(officialSongID!=0&&songID==0)song=getOfficialSongInfo(officialSongID+1);if(officialSongID==0&&songID==0)song=getOfficialSongInfo(1);lvl["creator"]=encCreators[playerId]!=undefined?encCreators[playerId]:"-";lvl["song"]=song;result.push(lvl)}return result}};
@@ -35,7 +35,7 @@ module.exports = {
35
35
 
36
36
  let levels = res.data.split("#")[0].split("|");
37
37
  let creators = res.data.split("#")[1].split("|");
38
- let songs = res.data.split("#")[2].split(":");
38
+ let songs = res.data.split("#")[2].split("~:~");
39
39
 
40
40
  let result = [];
41
41
 
@@ -30,7 +30,7 @@ module.exports = {
30
30
 
31
31
  let levels = res.data.split("#")[0].split("|");
32
32
  let creators = res.data.split("#")[1].split("|");
33
- let songs = res.data.split("#")[2].split(":");
33
+ let songs = res.data.split("#")[2].split("~:~");
34
34
 
35
35
  let result = [];
36
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "A light-weight Geometry Dash API wrapper",
5
5
  "main": "index.js",
6
6
  "scripts": {