added env variables

This commit is contained in:
Omer Sabic 2023-05-09 18:24:10 +02:00
parent b5772e476b
commit a3cbe956d7
4 changed files with 24 additions and 4 deletions

0
.env Normal file
View File

14
main.js
View File

@ -1,9 +1,19 @@
import fs from 'fs';
import https from 'https';
import chalk from 'chalk';
import load from 'dotenv';
load()
let songCount = 1;
const AUTHTOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJGYmd3dndBT1JCTjlibVJmRUxLcHciLCJleHAiOjE2ODE5ODg5MTUuMzU2LCJpYXQiOjE2ODE5ODgwMTV9.hCs0U5Iv5bgaU9oYi9kmSl0A_gt3V9svL0NiCEvtZFr4DXiNQwkt30fUtwOofMmHUnoEKiRt8ER-K8n5vsXKc23gvvcKaYEzY1kipwlAkK_JiYslE1FXDGXBBN1VrunACWLY5sWyRt1og6WP20BaoD0gIvBr0iazN323mlpU_Ls4yOrid2J_veXAwmCkW_26Q2NbhJeEV2rlwnV95CtxmogYHkoDrDz65UncU5AUvl4ae96il9IN7MSI0DvFl3NutVnD3B2wPaNHNAIoMC1_nLwWl5Q5GMbgC2AW3B1U0pozg78ePFVWq-mKYY8IbgjESNKWg1gRF5oknsFq8shxjw";
const AUTHTOKEN = process.env.AUTHTOKEN;
const TOKEN = process.env.TOKEN;
const USERID = process.env.USERID;
if(!AUTHTOKEN || !TOKEN || !USERID) {
console.error('Please enter all the required information');
process.exit(1);
}
@ -100,7 +110,7 @@ for(const genre of genres) {
let folder = `./songs/${genre}/${mentalState}/${activity}/${hasMultipleNELs ? "mixed" : level}`
let filename = `${song.name.replace(' ', '_')}`;
let downloadLink = `https://audio.brain.fm/${song.url}?userId=FbgwvwAORBN9bmRfELKpw&token=1Uah43y3X33F7ERFwx-_P`
let downloadLink = `https://audio.brain.fm/${song.url}?userId=${USERID}&token=${TOKEN}`;
downloadQueue.enqueue(downloadLink, folder, filename);
}

11
package-lock.json generated
View File

@ -9,7 +9,8 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"chalk": "^5.2.0"
"chalk": "^5.2.0",
"dotenv": "^16.0.3"
}
},
"node_modules/chalk": {
@ -22,6 +23,14 @@
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
"engines": {
"node": ">=12"
}
}
}
}

View File

@ -11,6 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"chalk": "^5.2.0"
"chalk": "^5.2.0",
"dotenv": "^16.0.3"
}
}