Improved channel name query selector.

Resolves https://github.com/ajayyy/SponsorBlock/issues/199
This commit is contained in:
Ajay Ramachandran
2019-12-29 00:21:38 -05:00
parent e5937431c3
commit c14c795474

View File

@@ -498,19 +498,12 @@ function updatePreviewBar() {
function getChannelID() {
//get channel id
let channelNameContainer = document.getElementById("channel-name");
let channelURLContainer = null;
if (channelNameContainer !== null) {
try {
channelURLContainer = channelNameContainer.querySelector("#container").querySelector("#text-container").querySelector("#text").firstElementChild;
} catch (e) {
channelURLContainer = null
}
}
if (channelURLContainer == null) {
channelURLContainer = document.querySelector("#channel-name > #container > #text-container > #text");
if (channelURLContainer !== null) {
channelURLContainer = channelURLContainer.firstElementChild;
} else {
//old YouTube theme
let channelContainers = document.getElementsByClassName("yt-user-info");
if (channelContainers.length != 0) {