Skip to content

Commit

Permalink
use the last item in yt music playlist instead of first
Browse files Browse the repository at this point in the history
Signed-off-by: Vu Van Dung <[email protected]>
  • Loading branch information
joulev committed Dec 16, 2023
1 parent e00db82 commit 54f4f99
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/(public)/(home)/music-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MetadataCard } from "./metadata-card";
export async function MusicData() {
const client = await new YTMusic().initialize();
if (!client) throw new Error("invariant: client is falsy");
const song = await client.getPlaylistVideos(env.RECENT_FAVOURITE_PLAYLIST_ID).then(a => a.at(0));
const song = await client.getPlaylistVideos(env.RECENT_FAVOURITE_PLAYLIST_ID).then(a => a.at(-1));
if (!song) throw new Error("invariant: song is falsy");
const thumbnail = song.thumbnails
.sort((a, b) => a.width - b.width)
Expand Down

0 comments on commit 54f4f99

Please sign in to comment.