ytmusic_api_unofficial
Advanced tools
Comparing version 1.1.0-beta.1.4 to 1.1.0-beta.1.5
@@ -34,7 +34,24 @@ "use strict"; | ||
}).then((res) => __awaiter(void 0, void 0, void 0, function* () { | ||
let ids = JSON.stringify(res.data).match(/videoId\W+"(\w*)"/gmi).map(videoID => videoID.match(/"(\w*)"/)[1]); | ||
ids = [...new Set(ids)]; | ||
let ids = JSON.stringify(res.data).match(/videoId\W+"(\w*)"([\n|\w|\W]?)+?musicVideoType\W+"(\w*)/gmi).map(videoID => { | ||
return { | ||
id: videoID.match(/videoId\W+"(\w*)"([\n|\w|\W]?)+?musicVideoType\W+"(\w*)/mi)[1], | ||
type: videoID.match(/videoId\W+"(\w*)"([\n|\w|\W]?)+?musicVideoType\W+"(\w*)/mi)[3] | ||
}; | ||
}); | ||
let ids2 = []; | ||
// Remove duplicate | ||
ids.filter((item, index) => { | ||
return ids2.find((e) => e.id === item.id) ? false : ids2.push(item); | ||
}); | ||
ids = ids2; | ||
const resp_data = []; | ||
// Filter by type | ||
if (type === TypeSearch.MUSIC) { | ||
ids = ids.filter((e) => TypeSearch.MUSIC_values.includes(e.type)); | ||
} | ||
else if (type === TypeSearch.VIDEO) { | ||
ids = ids.filter((e) => TypeSearch.VIDEO_values.includes(e.type)); | ||
} | ||
for (const id of ids) { | ||
resp_data.push(new Music_1.Music((0, extract_1.extract_dataFromGetData)(yield GetData(id)))); | ||
resp_data.push(new Music_1.Music((0, extract_1.extract_dataFromGetData)(yield GetData(id.id)))); | ||
} | ||
@@ -41,0 +58,0 @@ return resp_data; |
{ | ||
"name": "ytmusic_api_unofficial", | ||
"version": "1.1.0-beta.1.4", | ||
"version": "1.1.0-beta.1.5", | ||
"description": "A simple API to get music from YouTube Music", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61362
1416