@@ -384,7 +384,7 @@ function resetValues() {
384384 categoryPill ?. setVisibility ( false ) ;
385385}
386386
387- async function videoIDChange ( id ) : Promise < void > {
387+ async function videoIDChange ( id : string ) : Promise < void > {
388388 // don't switch to invalid value
389389 if ( ! id && sponsorVideoID && ! document ?. URL ?. includes ( "youtube.com/clip/" ) ) return ;
390390 //if the id has not changed return unless the video element has changed
@@ -441,7 +441,7 @@ async function videoIDChange(id): Promise<void> {
441441 //close popup
442442 closeInfoMenu ( ) ;
443443
444- sponsorsLookup ( id ) ;
444+ sponsorsLookup ( ) ;
445445
446446 // Make sure all player buttons are properly added
447447 updateVisibilityOfPlayerControlsButton ( ) ;
@@ -1219,12 +1219,12 @@ function startSkipScheduleCheckingForStartSponsors() {
12191219 }
12201220}
12211221
1222- function getYouTubeVideoID ( document : Document , url ?: string ) : string | boolean {
1222+ function getYouTubeVideoID ( document : Document , url ?: string ) : string {
12231223 url ||= document . URL ;
12241224 // pageType shortcut
1225- if ( pageType === PageType . Channel ) return getYouTubeVideoIDFromDocument ( )
1225+ if ( pageType === PageType . Channel ) return getYouTubeVideoIDFromDocument ( ) ;
12261226 // clips should never skip, going from clip to full video has no indications.
1227- if ( url . includes ( "youtube.com/clip/" ) ) return false ;
1227+ if ( url . includes ( "youtube.com/clip/" ) ) return null ;
12281228 // skip to document and don't hide if on /embed/
12291229 if ( url . includes ( "/embed/" ) && url . includes ( "youtube.com" ) ) return getYouTubeVideoIDFromDocument ( false , PageType . Embed ) ;
12301230 // skip to URL if matches youtube watch or invidious or matches youtube pattern
@@ -1235,7 +1235,7 @@ function getYouTubeVideoID(document: Document, url?: string): string | boolean {
12351235 return getYouTubeVideoIDFromURL ( url ) || getYouTubeVideoIDFromDocument ( false ) ;
12361236}
12371237
1238- function getYouTubeVideoIDFromDocument ( hideIcon = true , pageHint = PageType . Watch ) : string | boolean {
1238+ function getYouTubeVideoIDFromDocument ( hideIcon = true , pageHint = PageType . Watch ) : string {
12391239 const selector = "a.ytp-title-link[data-sessionlink='feature=player-title']" ;
12401240 // get ID from document (channel trailer / embedded playlist)
12411241 const element = pageHint === PageType . Embed ? document . querySelector ( selector )
@@ -1247,11 +1247,11 @@ function getYouTubeVideoIDFromDocument(hideIcon = true, pageHint = PageType.Watc
12471247 pageType = pageHint ;
12481248 return getYouTubeVideoIDFromURL ( videoURL ) ;
12491249 } else {
1250- return false ;
1250+ return null ;
12511251 }
12521252}
12531253
1254- function getYouTubeVideoIDFromURL ( url : string ) : string | boolean {
1254+ function getYouTubeVideoIDFromURL ( url : string ) : string {
12551255 if ( url . startsWith ( "https://www.youtube.com/tv#/" ) ) url = url . replace ( "#" , "" ) ;
12561256
12571257 //Attempt to parse url
@@ -1260,7 +1260,7 @@ function getYouTubeVideoIDFromURL(url: string): string | boolean {
12601260 urlObject = new URL ( url ) ;
12611261 } catch ( e ) {
12621262 console . error ( "[SB] Unable to parse URL: " + url ) ;
1263- return false ;
1263+ return null ;
12641264 }
12651265
12661266 // Check if valid hostname
@@ -1274,25 +1274,25 @@ function getYouTubeVideoIDFromURL(url: string): string | boolean {
12741274 utils . wait ( ( ) => Config . config !== null ) . then ( ( ) => videoIDChange ( getYouTubeVideoIDFromURL ( url ) ) ) ;
12751275 }
12761276
1277- return false ;
1277+ return null ;
12781278 } else {
12791279 onInvidious = false ;
12801280 }
12811281
12821282 //Get ID from searchParam
12831283 if ( urlObject . searchParams . has ( "v" ) && [ "/watch" , "/watch/" ] . includes ( urlObject . pathname ) || urlObject . pathname . startsWith ( "/tv/watch" ) ) {
12841284 const id = urlObject . searchParams . get ( "v" ) ;
1285- return id . length == 11 ? id : false ;
1285+ return id . length == 11 ? id : null ;
12861286 } else if ( urlObject . pathname . startsWith ( "/embed/" ) || urlObject . pathname . startsWith ( "/shorts/" ) ) {
12871287 try {
12881288 const id = urlObject . pathname . split ( "/" ) [ 2 ]
12891289 if ( id ?. length >= 11 ) return id . slice ( 0 , 11 ) ;
12901290 } catch ( e ) {
12911291 console . error ( "[SB] Video ID not valid for " + url ) ;
1292- return false ;
1292+ return null ;
12931293 }
12941294 }
1295- return false ;
1295+ return null ;
12961296}
12971297
12981298/**
0 commit comments