soundcloud-key-fetch
Advanced tools
Comparing version 1.0.10 to 1.0.11
19
index.js
exports.fetchKey = async function() { | ||
return new Promise(async function(resolve, rej) { | ||
require('https').get('https://soundcloud.com/', (res) => { | ||
let r = '' | ||
res.on('data', async (d) => { | ||
r = d.toString() | ||
r += d | ||
}) | ||
res.on('end', async () => { | ||
const res = r.split('<script crossorigin src="'); | ||
@@ -17,12 +21,17 @@ const urls = []; | ||
require('https').get(urls[urls.length - 1], async a => { | ||
let data = '' | ||
a.on('data', async d => { | ||
const b = d.toString() | ||
if(b.includes(',client_id:"')) { | ||
const thingA = b.split(',client_id:"'); | ||
data += d | ||
}) | ||
a.on('end', () => { | ||
if(data.includes(',client_id:"')) { | ||
const thingA = data.split(',client_id:"'); | ||
key = thingA[1].split('"')[0]; | ||
return resolve(key) | ||
} | ||
return resolve('') | ||
}) | ||
a.on('error', () => rej(err)) | ||
}); | ||
@@ -29,0 +38,0 @@ }) |
@@ -27,3 +27,3 @@ { | ||
}, | ||
"version": "1.0.10" | ||
"version": "1.0.11" | ||
} |
@@ -1,3 +0,2 @@ | ||
# [soundcloud-key-fetch](https://www.npmjs.com/package/soundcloud-key-fetch) | ||
### *[soundcloud-key-fetch on GitLab](https://gitlab.com/syqwq/soundcloud-key-fetch)* | ||
# [soundcloud-key-fetch](https://www.npmjs.com/package/soundcloud-key-fetch) — *[GitLab](https://gitlab.com/syqwq/soundcloud-key-fetch)* | ||
A simple module to fetch a SoundCloud API key without owning an application, requiring no dependencies! | ||
@@ -49,2 +48,4 @@ ``` | ||
const test = await sckey.testKey('SC-KEY'); | ||
``` | ||
``` | ||
huge thank you to [Zack Radisic](https://github.com/zackradisic/) for helping me out a ton w this package |
5882
73
50