ytmusic_api_unofficial
Advanced tools
Comparing version 2.0.6 to 2.0.7
export declare function getSignatureTimestamp(): Promise<number>; | ||
export declare function getDecodeScript(): Promise<any>; | ||
export declare function getUrlDecode(url: string): Promise<string>; | ||
export declare function getUrlDecode(url: string, retry?: boolean): Promise<string>; | ||
//# sourceMappingURL=decode.d.ts.map |
@@ -16,3 +16,2 @@ "use strict"; | ||
exports.getUrlDecode = exports.getDecodeScript = exports.getSignatureTimestamp = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
const node_cache_1 = __importDefault(require("node-cache")); | ||
@@ -37,6 +36,10 @@ const error_1 = require("./error"); | ||
exports.getDecodeScript = getDecodeScript; | ||
function getUrlDecode(url) { | ||
function getUrlDecode(url, retry = false) { | ||
return new Promise((resolve, reject) => { | ||
getDecodeScript().then((decode) => __awaiter(this, void 0, void 0, function* () { | ||
checkUrlIsMusic(decode(url)).then(resolve).catch(reject); | ||
checkUrlIsMusic(decode(url)).then(resolve).catch((e) => { | ||
if (!retry) | ||
return resolve(getUrlDecode(url, true)); | ||
reject(e); | ||
}); | ||
})); | ||
@@ -65,6 +68,6 @@ }); | ||
function fetchScript() { | ||
return new Promise((resolve) => { | ||
if (process.env.buildDev) { | ||
return new Promise((resolve, reject) => { | ||
if (process.env.buildDevDecoderPath) { | ||
process.emitWarning('You are using a development build, the decoder will be use as local. If you want to use the internet decoder, please use a production build.'); | ||
return resolve(require(path_1.default.join(__dirname, '../../decode/build/decoder.js'))); | ||
return resolve(require(process.env.buildDevDecoderPath)); | ||
} | ||
@@ -71,0 +74,0 @@ if (cache.has('decoder')) |
@@ -444,3 +444,3 @@ "use strict"; | ||
function getYTIdFromText(text, precise = false) { | ||
const reg = /https?:\/\/(?:music\.|www\.)?youtube\.com\/(?:watch\?v=|v\/|channel\/|playlist\?list=)([A-Za-z0-9_-]+)/m; | ||
const reg = /https?:\/\/(?:music\.|www\.)?(?:youtube\.com\/(?:watch\?v=|v\/|channel\/|playlist\?list=)|youtu\.be\/)([A-Za-z0-9_-]+)/m; | ||
let id = null; | ||
@@ -447,0 +447,0 @@ if (!text.includes(' ')) |
{ | ||
"name": "ytmusic_api_unofficial", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
184504
2492
7