검색해서 재생기능 제작
검색하고 재생 누르면 재생됨 플레이리스트 재생 기능(주소 전달해서 재생하는 방식)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user