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.4 to 0.4.5

5

dist/entities/Playlists.d.ts

@@ -6,4 +6,9 @@ import api from "../API";

private readonly resolve;
private readonly tracks;
constructor(api: api);
/**
* Return playlist with all tracks fetched.
*/
fetch: (playlist: SoundcloudPlaylistV2) => Promise<SoundcloudPlaylistV2>;
/**
* @deprecated use searchV2

@@ -10,0 +15,0 @@ * Searches for playlists.

43

dist/entities/Playlists.js

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

this.resolve = new index_1.Resolve(this.api);
this.tracks = new index_1.Tracks(this.api);
/**
* Return playlist with all tracks fetched.
*/
this.fetch = function (playlist) { return __awaiter(_this, void 0, void 0, function () {
var i, _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
i = 0;
_d.label = 1;
case 1:
if (!(i < playlist.tracks.length)) return [3 /*break*/, 6];
if (!!playlist.tracks[i].title) return [3 /*break*/, 5];
_d.label = 2;
case 2:
_d.trys.push([2, 4, , 5]);
_a = playlist.tracks;
_b = i;
return [4 /*yield*/, this.tracks.getV2(playlist.tracks[i].id)];
case 3:
_a[_b] = _d.sent();
return [3 /*break*/, 5];
case 4:
_c = _d.sent();
return [3 /*break*/, 5];
case 5:
i++;
return [3 /*break*/, 1];
case 6: return [2 /*return*/, playlist];
}
});
}); };
/**
* @deprecated use searchV2

@@ -109,3 +142,3 @@ * Searches for playlists.

response = _a.sent();
return [2 /*return*/, response];
return [2 /*return*/, this.fetch(response)];
}

@@ -136,3 +169,3 @@ });

this.searchAlt = function (query) { return __awaiter(_this, void 0, void 0, function () {
var headers, html, urls, scrape, i, songHTML, json, track;
var headers, html, urls, scrape, i, songHTML, json, playlist;
var _a;

@@ -158,4 +191,4 @@ return __generator(this, function (_b) {

json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0]);
track = json[json.length - 1].data;
scrape.push(track);
playlist = json[json.length - 1].data;
scrape.push(playlist);
_b.label = 4;

@@ -185,3 +218,3 @@ case 4:

playlist = json[json.length - 1].data;
return [2 /*return*/, playlist];
return [2 /*return*/, this.fetch(playlist)];
}

@@ -188,0 +221,0 @@ });

2

dist/start.js

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

switch (_a.label) {
case 0: return [4 /*yield*/, soundcloud.users.tracksV2("imtenpi")];
case 0: return [4 /*yield*/, soundcloud.playlists.searchAlt("anime")];
case 1:

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

import axios from "axios"
import api from "../API"
import {SoundcloudPlaylist, SoundcloudPlaylistFilter, SoundcloudPlaylistSearchV2, SoundcloudPlaylistV2, SoundcloudPlaylistFilterV2, SoundcloudSecretToken} from "../types"
import {Resolve} from "./index"
import {Resolve, Tracks} from "./index"
export class Playlists {
private readonly resolve = new Resolve(this.api)
private readonly tracks = new Tracks(this.api)
public constructor(private readonly api: api) {}
/**
* Return playlist with all tracks fetched.
*/
public fetch = async (playlist: SoundcloudPlaylistV2) => {
for (let i = 0; i < playlist.tracks.length; i++) {
if (!playlist.tracks[i].title) {
try {
playlist.tracks[i] = await this.tracks.getV2(playlist.tracks[i].id)
} catch {
// Ignore
}
}
}
return playlist
}
/**
* @deprecated use searchV2

@@ -44,3 +61,3 @@ * Searches for playlists.

const response = await this.api.getV2(`/playlists/${playlistID}`)
return response as Promise<SoundcloudPlaylistV2>
return this.fetch(response) as Promise<SoundcloudPlaylistV2>
}

@@ -71,4 +88,4 @@

const json = JSON.parse(songHTML.match(/(\[{)(.*)(?=;)/gm)[0])
const track = json[json.length - 1].data
scrape.push(track)
const playlist = json[json.length - 1].data
scrape.push(playlist)
}

@@ -87,4 +104,4 @@ return scrape as Promise<SoundcloudPlaylistV2[]>

const playlist = json[json.length - 1].data
return playlist as Promise<SoundcloudPlaylistV2>
return this.fetch(playlist) as Promise<SoundcloudPlaylistV2>
}
}
{
"name": "soundcloud.ts",
"version": "0.4.4",
"version": "0.4.5",
"description": "Wrapper for the Soundcloud API with typings",

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

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

// const result = await soundcloud.tracks.getAlt("https://soundcloud.com/colbreakz/my-universe")
const result = await soundcloud.users.tracksV2("imtenpi")
const result = await soundcloud.playlists.searchAlt("anime")
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