Open mokurin000 opened 1 year ago
Alternatives Considered
set youtube movie URL in xesam:url, so external players may query the necessary meta info themselves
Please enable the shortcuts
plugin
thx. I will mention this plugin in my README
I keep opening this issue because I think we need extra help to solve it. If there is a way to get background music data directly from YouTube Music, I don't need to use the ugly hack to fix this issue.
I tried every 'part' (contentDetails,id,liveStreamingDetails,localizations,player,recordingDetails,snippet,statistics,status,topicDetails
) public but none is related to the background music
https://developers.google.com/youtube/v3/docs/videos/list
or could we locate ytd-video-description-music-section-renderer
tag and read SONG, ARTIST and ALBUM with electron?
This is pretty hacky and may easily break with youtube updates
or could we locate
ytd-video-description-music-section-renderer
tag and read SONG, ARTIST and ALBUM with electron?This is pretty hacky and may easily break with youtube updates
It seems to doesn't work on YTM
or could we locate
ytd-video-description-music-section-renderer
tag and read SONG, ARTIST and ALBUM with electron? This is pretty hacky and may easily break with youtube updatesIt seems to doesn't work on YTM
create a hidden BrowserWindow and once received ready-to-show we could locate ytd-video-description-music-section-renderer
and read up to three meta info in order of "title, artist, album"
descriptionSection = document.getElementsByTagName("ytd-video-description-music-section-renderer")[0];
metas = descriptionSection.querySelectorAll("yt-formatted-string#default-metadata");
const metainfo = {
title: metas[0].innerText,
artist: metas[1].innerText,
album: metas[2].innerText || null,
};
for a complete demo:
const {app, ipcMain, BrowserWindow} = require('electron')
app.on('ready', () => {
window = new BrowserWindow({width: 400, height: 300, show: false})
window.on('ready-to-show', () => {
window.webContents.on('dom-ready', () => {
window.webContents.executeJavaScript(`
descriptionSection = document.getElementsByTagName("ytd-video-description-music-section-renderer")[0];
let metas = descriptionSection.querySelectorAll("yt-formatted-string#default-metadata");
const metainfo = {
title: metas[0].innerText,
artist: metas[1].innerText,
album: metas[2].innerText || null,
};
require('electron').ipcRenderer.send('ytb-bg-music', metainfo);
`);
});
});
ipcMain.on('ytb-bg-music', (_, metainfo) => {
console.log(metainfo);
});
window.loadURL("https://www.youtube.com/watch?v=H6iBYmRRLYQ")
});
This is similarly related, may need it's own issue. Could you possibly set the mpris player to something other than chromium? I know it's hard coded but there is supposedly an npm package that has support for mpris metadata not present in chromium's source code, but idk how well it works nor how difficult implementation of this would be. Using this it would also be possible to set the artUrl so external player controllers could see the album art.
This is similarly related, may need it's own issue. Could you possibly set the mpris player to something other than chromium? I know it's hard coded but there is supposedly an npm package that has support for mpris metadata not present in chromium's source code, but idk how well it works nor how difficult implementation of this would be. Using this it would also be possible to set the artUrl so external player controllers could see the album art.
https://github.com/th-ch/youtube-music/issues/1323#issuecomment-1764185013
Preflight Checklist
Problem Description
current behaviour of youtube-music gives strange metainfo for external mpris controller, while you could find background music title/singers/album on Youtube (for example this MMD video)
Proposed Solution
query youtube api and set album / title / singers
Alternatives Considered
set youtube movie URL in xesam:url, so external players may query the necessary meta info themselves
Additional Information
No response