검색해서 재생기능 제작

검색하고 재생 누르면 재생됨
플레이리스트 재생 기능(주소 전달해서 재생하는 방식)
This commit is contained in:
tkrmagid-desktop
2026-04-09 01:53:27 +09:00
parent cefe37e2a8
commit 2e014e9b34
11 changed files with 238 additions and 21 deletions

View File

@@ -146,9 +146,10 @@ export const YoutubeMusic = {
if (videoId && title) {
results.push({
videoId,
url: `https://music.youtube.com/watch?v=${videoId}`,
title,
artist,
videoId,
thumbnail,
duration: parseDurationToMs(durationStr)
});
@@ -187,9 +188,10 @@ export const YoutubeMusic = {
if (videoId && title) {
results.push({
videoId,
url: `https://music.youtube.com/watch?v=${videoId}`,
title,
artist,
videoId,
thumbnail,
duration: parseDurationToMs(durationStr || "")
});
@@ -209,8 +211,7 @@ export const YoutubeMusic = {
const lowerQuery = query.toLocaleLowerCase().trim();
if (searchCache.has(lowerQuery)) return searchCache.get(lowerQuery) ?? null;
const video = (await this.getSearchFull(query) ?? [])?.[0];
const url = video?.videoId ? `https://music.youtube.com/watch?v=${video.videoId}` : null;
if (url) searchCache.set(lowerQuery, url);
return url;
if (video.url) searchCache.set(lowerQuery, video.url);
return video.url;
}
};