Skip to content

Commit 42269c9

Browse files
committed
youtube: repair channel id hook
1 parent 2676357 commit 42269c9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

youtube.com/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Show channel ID on pages that use "pretty" URLS
33
*/
44
if (
5-
/^\/(?:c|user)\//.test(location.pathname) ||
6-
document.getElementById("channel-header")
5+
/^\/(?:c|user|@)\/?/.test(location.pathname) ||
6+
document.getElementById("page-header")
77
) {
88
const chanId = document.createElement("a");
99
const meta = ytInitialData.metadata.channelMetadataRenderer;
@@ -14,5 +14,9 @@ if (
1414
const p = document.createElement("p");
1515
p.appendChild(chanId);
1616

17-
document.querySelector("div.ytd-channel-name").appendChild(p);
17+
setTimeout(() => {
18+
document
19+
.querySelector(".yt-page-header-view-model__page-header-title")
20+
.nextElementSibling.prepend(p);
21+
}, 1500); // wait for the header to load
1822
}

0 commit comments

Comments
 (0)