fix: download/pip button for podcast video

This commit is contained in:
JellyBrick
2024-01-06 11:05:15 +09:00
parent 6b7c43925a
commit de709cc7c9
2 changed files with 45 additions and 5 deletions

View File

@ -60,10 +60,23 @@ const observer = new MutationObserver(() => {
return;
}
const menuUrl = $<HTMLAnchorElement>(
// check for video (or music)
let menuUrl = $<HTMLAnchorElement>(
'tp-yt-paper-listbox [tabindex="0"] #navigation-endpoint',
)?.href;
if (!menuUrl?.includes('watch?') && doneFirstLoad) {
if (!menuUrl?.includes('watch?')) {
menuUrl = undefined;
// check for podcast
for (const it of document.querySelectorAll('tp-yt-paper-listbox [tabindex="-1"] #navigation-endpoint')) {
if (it.getAttribute('href')?.includes('podcast/')) {
menuUrl = it.getAttribute('href')!;
break;
}
}
}
if (!menuUrl && doneFirstLoad) {
return;
}