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

ytmusic_api_unofficial

Package Overview
Dependencies
Maintainers
0
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ytmusic_api_unofficial - npm Package Compare versions

Comparing version 2.0.0-beta.1.6.8 to 2.0.0-beta.1.6.9

6

dist/classes/Music.d.ts

@@ -115,3 +115,9 @@ import { Thumbnail } from "./Thumbnail";

getRadioPlaylist(): Promise<Playlist>;
/**
* Return Thumbnail with custom size
* @param width The width of the thumbnail
* @param height The height of the thumbnail
*/
getThumbnail(width: number, height: number): Thumbnail;
}
//# sourceMappingURL=Music.d.ts.map

24

dist/classes/Music.js

@@ -26,8 +26,8 @@ "use strict";

constructor(data) {
var _a, _b, _c, _d, _e;
this.thumbnails = (_a = data === null || data === void 0 ? void 0 : data.thumbnails) === null || _a === void 0 ? void 0 : _a.map((thumbnail) => new Thumbnail_1.Thumbnail(thumbnail));
var _a, _b, _c, _d, _e, _f, _g, _h;
this.thumbnails = (0, utils_1.thumbnail_defaults_size)((_c = (_a = data === null || data === void 0 ? void 0 : data.thumbnails) === null || _a === void 0 ? void 0 : _a[((_b = data === null || data === void 0 ? void 0 : data.thumbnails) === null || _b === void 0 ? void 0 : _b.length) - 1]) === null || _c === void 0 ? void 0 : _c.url, (_d = data === null || data === void 0 ? void 0 : data.thumbnails) === null || _d === void 0 ? void 0 : _d.map((thumbnail) => new Thumbnail_1.Thumbnail(thumbnail)));
this.id = data.videoId;
this.browseID = data.browseID;
this.title = data.title;
this.artists = (_b = data === null || data === void 0 ? void 0 : data.artists) === null || _b === void 0 ? void 0 : _b.map((artist) => new Artist_1.default(artist));
this.artists = (_e = data === null || data === void 0 ? void 0 : data.artists) === null || _e === void 0 ? void 0 : _e.map((artist) => new Artist_1.default(artist));
this.resultType = data.resultType;

@@ -41,6 +41,6 @@ if (data.album) {

this.year = data.year;
this.isAudioOnly = (_c = this.videoType) === null || _c === void 0 ? void 0 : _c.includes('ATV');
this.isAudioOnly = (_f = this.videoType) === null || _f === void 0 ? void 0 : _f.includes('ATV');
this.isExplicit = !!data.isExplicit;
this.radioPlaylistID = (_d = data.radioPlID) === null || _d === void 0 ? void 0 : _d.playlistId;
this.radioPlaylistCode = (_e = data.radioPlID) === null || _e === void 0 ? void 0 : _e.params;
this.radioPlaylistID = (_g = data.radioPlID) === null || _g === void 0 ? void 0 : _g.playlistId;
this.radioPlaylistCode = (_h = data.radioPlID) === null || _h === void 0 ? void 0 : _h.params;
this.relativeBrowseID = data.relativeBrowseID;

@@ -97,4 +97,16 @@ }

}
/**
* Return Thumbnail with custom size
* @param width The width of the thumbnail
* @param height The height of the thumbnail
*/
getThumbnail(width, height) {
return new Thumbnail_1.Thumbnail({
url: (0, utils_1.customThumbnailSize)(this.thumbnails[0].url, width, height),
width: width,
height: height
});
}
}
exports.default = Music;
//# sourceMappingURL=Music.js.map

@@ -78,2 +78,3 @@ "use strict";

}
result.content = result.content.filter((content) => !!(content === null || content === void 0 ? void 0 : content.id));
if (fetch) {

@@ -80,0 +81,0 @@ result.content = result.content.filter((content) => !!(content === null || content === void 0 ? void 0 : content.id));

@@ -6,2 +6,3 @@ import Music from "../classes/Music";

import StreamPlayers from "../classes/StreamPlayer";
import { Thumbnail } from "../classes/Thumbnail";
export declare function detectType(type: string, none_if_empty?: boolean): string | null;

@@ -25,2 +26,4 @@ export declare function topResult(response: any): any;

export declare function getPlayers_dv(id: string): Promise<StreamPlayers>;
export declare function customThumbnailSize(url: string, width: number, height: number): string;
export declare function thumbnail_defaults_size(url: string, thumbnails_defaults?: Thumbnail[]): Thumbnail[];
//# sourceMappingURL=utils.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.getPlayers_dv = exports.downloadYTDL = exports.getTypeByID = exports.getYTIdFromText = exports.parseGetResult = exports.getItemText = exports.parseSongFromFollowList = exports.getFlexColumnItem = exports.parseSearchResults = exports.parseSearchResult = exports.parseMenuPlaylists = exports.topResults = exports.topResult = exports.detectType = void 0;
exports.thumbnail_defaults_size = exports.customThumbnailSize = exports.getPlayers_dv = exports.downloadYTDL = exports.getTypeByID = exports.getYTIdFromText = exports.parseGetResult = exports.getItemText = exports.parseSongFromFollowList = exports.getFlexColumnItem = exports.parseSearchResults = exports.parseSearchResult = exports.parseMenuPlaylists = exports.topResults = exports.topResult = exports.detectType = void 0;
const responseBuilder_1 = require("./responseBuilder");

@@ -29,2 +29,3 @@ const Music_1 = __importDefault(require("../classes/Music"));

const Player_1 = __importDefault(require("../classes/Player"));
const Thumbnail_1 = require("../classes/Thumbnail");
function detectType(type, none_if_empty = false) {

@@ -482,2 +483,25 @@ var _a;

exports.getPlayers_dv = getPlayers_dv;
function customThumbnailSize(url, width, height) {
const match = url.match(/=w(?<width>\d+)-h(?<height>\d+)/);
if (match)
url = url.replace(match[0], `=w${width}-h${height}`);
return url;
}
exports.customThumbnailSize = customThumbnailSize;
const defaultsSize = [60, 120, 180, 226, 302, 480, 544, 720, 1080];
function thumbnail_defaults_size(url, thumbnails_defaults) {
let thumbnails = [];
for (const size of defaultsSize) {
if (new URL(url).origin.includes('googleusercontent'))
thumbnails.push(new Thumbnail_1.Thumbnail({
url: customThumbnailSize(url, size, size),
width: size,
height: size
}));
}
if (thumbnails.length === 0)
thumbnails = thumbnails_defaults || [];
return thumbnails;
}
exports.thumbnail_defaults_size = thumbnail_defaults_size;
//# sourceMappingURL=utils.js.map
{
"name": "ytmusic_api_unofficial",
"version": "2.0.0-beta.1.6.8",
"version": "2.0.0-beta.1.6.9",
"description": "A simple API to get music from YouTube Music",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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