Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

soundcloud-key-fetch

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soundcloud-key-fetch - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

74

index.js
exports.fetchKey = async function() {
return new Promise(async function(resolve, rej) {
const fetch = require('node-fetch');
fetch(`https://soundcloud.com`).then(res => res.text())
.then(async r => {
const res = r.split('<script crossorigin src="');
const urls = [];
res.forEach(urlA => {
const urlreg = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/
let url = urlA.replace('"></script>', ''); let res = url.split('\n')[0];
if(urlreg.test(res)) urls.push(res);
});
async function fetchKey() {
return new Promise(async function(resolve, rej) {
let done = 0; let key;
while(done !== urls.length && !key) {
let url = urls[done];
done++;
const a = await fetch(url);
a.text().then(b => {
if(b.includes(',client_id:"')) {
const thingA = b.split(',client_id:"');
key = thingA[1].split('"')[0];
if(done === urls.length) return resolve(key)
}
});
};
})
}
const key = await fetchKey()
if(key) {resolve(key)} else {rej(`Key not found! (SoundCloud API changed?)`)}
}).catch(e => {
require('https').get('https://soundcloud.com/', (res) => {
res.on('data', async (d) => {
r = d.toString()
const res = r.split('<script crossorigin src="');
const urls = [];
res.forEach(urlA => {
const urlreg = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/
let url = urlA.replace('"></script>', ''); let res = url.split('\n')[0];
if(urlreg.test(res)) urls.push(res);
});
async function fetchKey() {
return new Promise(async function(resolve, rej) {
let done = 0; let key;
while(done !== urls.length && !key) {
let url = urls[done];
done++;
require('https').get(url, async a => {
a.on('data', async d => {
const b = d.toString()
if(b.includes(',client_id:"')) {
const thingA = b.split(',client_id:"');
key = thingA[1].split('"')[0];
if(done === urls.length) return resolve(key)
}
})
});
};
})
}
const key = await fetchKey()
if(key) {resolve(key)} else {rej(`Key not found! (SoundCloud API changed?)`)}
})
}).on('error', async e => {
rej(e)

@@ -41,9 +44,10 @@ })

if(!key) {return rej(`No API key provided`)} else {
const fetch = require('node-fetch');
fetch(`https://api-v2.soundcloud.com/search?client_id=${key}&q=this%20package%20gave%20me%20neck%20pains&limit=0`).then(async result => {
if(result.status === 401) return res(false);
if(result.status === 404 || result.status === 200) return res(true)
}).catch(e => {return rej(e)})
require('https').get(`https://api-v2.soundcloud.com/search?client_id=${key}&q=this%20package%20gave%20me%20neck%20pains&limit=0`, async (result) => {
if(result.statusCode === 401) return res(false);
if(result.statusCode === 404 || result.statusCode === 200) return res(true)
}).on('error', e => {
return rej(e)
})
}
})
}
{
"name": "soundcloud-key-fetch",
"version": "1.0.5",
"version": "1.0.6",
"description": "Fetch a SoundCloud API key without owning an app!",

@@ -11,5 +11,3 @@ "main": "index.js",

"license": "ISC",
"dependencies": {
"node-fetch": "^2.6.0"
},
"dependencies": {},
"keywords": [

@@ -16,0 +14,0 @@ "soundcloud",

# Soundcloud Key Fetch
A simple module to fetch a SoundCloud API key without owning an application!
A simple module to fetch a SoundCloud API key without owning an application, requiring no dependencies!
```

@@ -4,0 +4,0 @@ npm i soundcloud-key-fetch

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc