mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 20:31: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 { YoutubePlayer } from '@/types/youtube-player';
|
||||||
import type { GetState } from '@/types/datahost-get-state';
|
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 { SongInfo } from './song-info';
|
||||||
import type { VideoDataChanged } from '@/types/video-data-changed';
|
import type { VideoDataChanged } from '@/types/video-data-changed';
|
||||||
@ -155,7 +155,10 @@ export default (api: YoutubePlayer) => {
|
|||||||
const data = api.getPlayerResponse();
|
const data = api.getPlayerResponse();
|
||||||
|
|
||||||
data.videoDetails.album =
|
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,
|
0,
|
||||||
)?.text;
|
)?.text;
|
||||||
data.videoDetails.elapsedSeconds = 0;
|
data.videoDetails.elapsedSeconds = 0;
|
||||||
|
|||||||
@ -246,8 +246,6 @@ export type VideoDataChangeValue = Record<string, unknown> & {
|
|||||||
title: string;
|
title: string;
|
||||||
author: string;
|
author: string;
|
||||||
|
|
||||||
Hd?: AlbumDetails;
|
|
||||||
|
|
||||||
playlistId: string;
|
playlistId: string;
|
||||||
isUpcoming: boolean;
|
isUpcoming: boolean;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user