mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
fix(song-info-front): fix parser to parse album name
This commit is contained in:
@ -2,7 +2,7 @@ import { singleton } from './decorators';
|
||||
|
||||
import type { YoutubePlayer } from '@/types/youtube-player';
|
||||
import type { GetState } from '@/types/datahost-get-state';
|
||||
import type { VideoDataChangeValue } from '@/types/player-api-events';
|
||||
import type { AlbumDetails, VideoDataChangeValue } from '@/types/player-api-events';
|
||||
|
||||
import type { SongInfo } from './song-info';
|
||||
import type { VideoDataChanged } from '@/types/video-data-changed';
|
||||
@ -155,7 +155,10 @@ export default (api: YoutubePlayer) => {
|
||||
const data = api.getPlayerResponse();
|
||||
|
||||
data.videoDetails.album =
|
||||
videoData?.Hd?.playerOverlays?.playerOverlayRenderer?.browserMediaSession?.browserMediaSessionRenderer?.album.runs?.at(
|
||||
(
|
||||
Object.entries(videoData)
|
||||
.find(([, value]) => value && Object.hasOwn(value, 'playerOverlays')) as AlbumDetails | undefined
|
||||
)?.playerOverlays?.playerOverlayRenderer?.browserMediaSession?.browserMediaSessionRenderer?.album?.runs?.at(
|
||||
0,
|
||||
)?.text;
|
||||
data.videoDetails.elapsedSeconds = 0;
|
||||
|
||||
@ -246,8 +246,6 @@ export type VideoDataChangeValue = Record<string, unknown> & {
|
||||
title: string;
|
||||
author: string;
|
||||
|
||||
Hd?: AlbumDetails;
|
||||
|
||||
playlistId: string;
|
||||
isUpcoming: boolean;
|
||||
loading: boolean;
|
||||
|
||||
Reference in New Issue
Block a user