mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Merge pull request #1250 from zedseven/channel-id-lookup-optimisations
Improve the channel ID lookup.
This commit is contained in:
@@ -1126,11 +1126,12 @@ function updatePreviewBar(): void {
|
|||||||
async function whitelistCheck() {
|
async function whitelistCheck() {
|
||||||
const whitelistedChannels = Config.config.whitelistedChannels;
|
const whitelistedChannels = Config.config.whitelistedChannels;
|
||||||
|
|
||||||
const getChannelID = () => videoInfo?.videoDetails?.channelId
|
const getChannelID = () =>
|
||||||
?? document.querySelector(".ytd-channel-name a")?.getAttribute("href")?.replace(/\/.+\//, "") // YouTube
|
(document.querySelector("a.ytd-video-owner-renderer") // YouTube
|
||||||
?? document.querySelector(".ytp-title-channel-logo")?.getAttribute("href")?.replace(/https:\/.+\//, "") // YouTube Embed
|
?? document.querySelector("a.ytp-title-channel-logo") // YouTube Embed
|
||||||
?? document.querySelector("a > .channel-profile")?.parentElement?.getAttribute("href")?.replace(/\/.+\//, "") // Invidious
|
?? document.querySelector(".channel-profile #channel-name")?.parentElement.parentElement // Invidious
|
||||||
?? document.querySelector("a.slim-owner-icon-and-title")?.getAttribute("href")?.replace(/\/.+\//, ""); // Mobile YouTube
|
?? document.querySelector("a.slim-owner-icon-and-title")) // Mobile YouTube
|
||||||
|
?.getAttribute("href")?.match(/\/channel\/(UC[a-zA-Z0-9_-]{22})/)[1];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await utils.wait(() => !!getChannelID(), 6000, 20);
|
await utils.wait(() => !!getChannelID(), 6000, 20);
|
||||||
|
|||||||
Reference in New Issue
Block a user