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

soundcloud.ts

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soundcloud.ts - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

35

dist/entities/Playlists.js

@@ -134,6 +134,6 @@ "use strict";

this.searchAlt = function (query) { return __awaiter(_this, void 0, void 0, function () {
var headers, html, urls, scrape, i, songHTML, data, user;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
var headers, html, urls, scrape, i, songHTML, json, track;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -143,3 +143,3 @@ headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" };

case 1:
html = _c.sent();
html = _b.sent();
urls = (_a = html.match(/(?<=<li><h2><a href=")(.*?)(?=">)/gm)) === null || _a === void 0 ? void 0 : _a.map(function (u) { return "https://soundcloud.com" + u; });

@@ -150,3 +150,3 @@ if (!urls)

i = 0;
_c.label = 2;
_b.label = 2;
case 2:

@@ -156,7 +156,7 @@ if (!(i < urls.length)) return [3 /*break*/, 5];

case 3:
songHTML = _c.sent();
data = JSON.parse((_b = songHTML.match(/(\[{"id")(.*?)(?=\);)/)) === null || _b === void 0 ? void 0 : _b[0]);
user = data[data.length - 1].data[0];
scrape.push(user);
_c.label = 4;
songHTML = _b.sent();
json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0]);
track = json[json.length - 1].data;
scrape.push(track);
_b.label = 4;
case 4:

@@ -173,6 +173,5 @@ i++;

this.getAlt = function (url) { return __awaiter(_this, void 0, void 0, function () {
var headers, songHTML, data, playlist;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
var headers, songHTML, json, playlist;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -184,5 +183,5 @@ if (!url.startsWith("https://soundcloud.com/"))

case 1:
songHTML = _b.sent();
data = JSON.parse((_a = songHTML.match(/(\[{"id")(.*?)(?=\);)/)) === null || _a === void 0 ? void 0 : _a[0]);
playlist = data[data.length - 1].data[0];
songHTML = _a.sent();
json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0]);
playlist = json[json.length - 1].data;
return [2 /*return*/, playlist];

@@ -189,0 +188,0 @@ }

@@ -209,6 +209,6 @@ "use strict";

this.searchAlt = function (query) { return __awaiter(_this, void 0, void 0, function () {
var headers, html, urls, scrape, i, songHTML, data, track;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
var headers, html, urls, scrape, i, songHTML, json, track;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -218,3 +218,3 @@ headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" };

case 1:
html = _c.sent();
html = _b.sent();
urls = (_a = html.match(/(?<=<li><h2><a href=")(.*?)(?=">)/gm)) === null || _a === void 0 ? void 0 : _a.map(function (u) { return "https://soundcloud.com" + u; });

@@ -225,3 +225,3 @@ if (!urls)

i = 0;
_c.label = 2;
_b.label = 2;
case 2:

@@ -231,7 +231,7 @@ if (!(i < urls.length)) return [3 /*break*/, 5];

case 3:
songHTML = _c.sent();
data = JSON.parse((_b = songHTML.match(/(\[{"id")(.*?)(?=\);)/)) === null || _b === void 0 ? void 0 : _b[0]);
track = data[data.length - 1].data[0];
songHTML = _b.sent();
json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0]);
track = json[json.length - 1].data;
scrape.push(track);
_c.label = 4;
_b.label = 4;
case 4:

@@ -248,6 +248,5 @@ i++;

this.getAlt = function (url) { return __awaiter(_this, void 0, void 0, function () {
var headers, songHTML, data, track;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
var headers, songHTML, json, track;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -259,5 +258,5 @@ if (!url.startsWith("https://soundcloud.com/"))

case 1:
songHTML = _b.sent();
data = JSON.parse((_a = songHTML.match(/(\[{"id")(.*?)(?=\);)/)) === null || _a === void 0 ? void 0 : _a[0]);
track = data[data.length - 1].data[0];
songHTML = _a.sent();
json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0]);
track = json[json.length - 1].data;
return [2 /*return*/, track];

@@ -264,0 +263,0 @@ }

@@ -305,6 +305,6 @@ "use strict";

this.searchAlt = function (query) { return __awaiter(_this, void 0, void 0, function () {
var headers, html, urls, scrape, i, songHTML, data, user;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
var headers, html, urls, scrape, i, songHTML, json, user;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -314,3 +314,3 @@ headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" };

case 1:
html = _c.sent();
html = _b.sent();
urls = (_a = html.match(/(?<=<li><h2><a href=")(.*?)(?=">)/gm)) === null || _a === void 0 ? void 0 : _a.map(function (u) { return "https://soundcloud.com" + u; });

@@ -321,3 +321,3 @@ if (!urls)

i = 0;
_c.label = 2;
_b.label = 2;
case 2:

@@ -327,7 +327,7 @@ if (!(i < urls.length)) return [3 /*break*/, 5];

case 3:
songHTML = _c.sent();
data = JSON.parse((_b = songHTML.match(/(\[{"id")(.*?)(?=\);)/)) === null || _b === void 0 ? void 0 : _b[0]);
user = data[data.length - 1].data[0];
songHTML = _b.sent();
json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0]);
user = json[json.length - 1].data;
scrape.push(user);
_c.label = 4;
_b.label = 4;
case 4:

@@ -344,6 +344,5 @@ i++;

this.getAlt = function (url) { return __awaiter(_this, void 0, void 0, function () {
var headers, songHTML, data, user;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
var headers, songHTML, json, user;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -355,5 +354,5 @@ if (!url.startsWith("https://soundcloud.com/"))

case 1:
songHTML = _b.sent();
data = JSON.parse((_a = songHTML.match(/(\[{"id")(.*?)(?=\);)/)) === null || _a === void 0 ? void 0 : _a[0]);
user = data[data.length - 1].data[0];
songHTML = _a.sent();
json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0]);
user = json[json.length - 1].data;
return [2 /*return*/, user];

@@ -360,0 +359,0 @@ }

@@ -46,3 +46,3 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, soundcloud.util.downloadSongCover("https://soundcloud.com/colbreakz/my-universe", null, true)];
case 0: return [4 /*yield*/, soundcloud.tracks.getAlt("https://soundcloud.com/colbreakz/my-universe")];
case 1:

@@ -49,0 +49,0 @@ result = _a.sent();

@@ -69,5 +69,5 @@ import axios from "axios"

const songHTML = await axios.get(urls[i], {headers}).then((r: any) => r.data)
const data = JSON.parse(songHTML.match(/(\[{"id")(.*?)(?=\);)/)?.[0])
const user = data[data.length - 1].data[0]
scrape.push(user)
const json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0])
const track = json[json.length - 1].data
scrape.push(track)
}

@@ -84,6 +84,6 @@ return scrape as Promise<SoundcloudPlaylistV2[]>

const songHTML = await axios.get(url, {headers}).then((r: any) => r.data)
const data = JSON.parse(songHTML.match(/(\[{"id")(.*?)(?=\);)/)?.[0])
const playlist = data[data.length - 1].data[0]
const json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0])
const playlist = json[json.length - 1].data
return playlist as Promise<SoundcloudPlaylistV2>
}
}

@@ -109,4 +109,4 @@ import axios from "axios"

const songHTML = await axios.get(urls[i], {headers}).then((r: any) => r.data)
const data = JSON.parse(songHTML.match(/(\[{"id")(.*?)(?=\);)/)?.[0])
const track = data[data.length - 1].data[0]
const json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0])
const track = json[json.length - 1].data
scrape.push(track)

@@ -124,4 +124,4 @@ }

const songHTML = await axios.get(url, {headers}).then((r: any) => r.data)
const data = JSON.parse(songHTML.match(/(\[{"id")(.*?)(?=\);)/)?.[0])
const track = data[data.length - 1].data[0]
const json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0])
const track = json[json.length - 1].data
return track as Promise<SoundcloudTrackV2>

@@ -128,0 +128,0 @@ }

@@ -162,4 +162,4 @@ import axios from "axios"

const songHTML = await axios.get(urls[i], {headers}).then((r: any) => r.data)
const data = JSON.parse(songHTML.match(/(\[{"id")(.*?)(?=\);)/)?.[0])
const user = data[data.length - 1].data[0]
const json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0])
const user = json[json.length - 1].data
scrape.push(user)

@@ -177,4 +177,4 @@ }

const songHTML = await axios.get(url, {headers}).then((r: any) => r.data)
const data = JSON.parse(songHTML.match(/(\[{"id")(.*?)(?=\);)/)?.[0])
const user = data[data.length - 1].data[0]
const json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0])
const user = json[json.length - 1].data
return user as Promise<SoundcloudUserV2>

@@ -181,0 +181,0 @@ }

{
"name": "soundcloud.ts",
"version": "0.4.1",
"version": "0.4.2",
"description": "Wrapper for the Soundcloud API with typings",

@@ -5,0 +5,0 @@ "main": "dist/soundcloud.js",

@@ -7,5 +7,4 @@ import SoundCloud from "./soundcloud"

// const result = await soundcloud.util.downloadTrack("https://soundcloud.com/colbreakz/my-universe", "./tracks")
// const result = await soundcloud.tracks.getV2("https://soundcloud.com/colbreakz/my-universe")
const result = await soundcloud.util.downloadSongCover("https://soundcloud.com/colbreakz/my-universe", null, true)
const result = await soundcloud.tracks.getAlt("https://soundcloud.com/colbreakz/my-universe")
console.log(result)
})()
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