SponsorBlock
SponsorBlock copied to clipboard
Must create a instance o URL first
https://github.com/ajayyy/SponsorBlock/blob/b7c5737a953959d1f31e881aa5ebe12f55dffb67/src/utils/urlParser.ts#L3
Fuction getStartTimeFromUrl from src/utils/urlParser.ts will not work with URLString. An instance o URL must be created first and then URLSearchParams can be created using the property search from URL instance. This is necessary because the URLSearchParams constructor does not analyze complete URLs.
from:
export function getStartTimeFromUrl(url: string): number {
const urlParams = new URLSearchParams(url);
const time = urlParams?.get('t') || urlParams?.get('time_continue');
return urlTimeToSeconds(time);
}
to:
export function getStartTimeFromUrl(url: string): number {
const urlParams = new URLSearchParams(new URL(url).search);
const time = urlParams?.get('t') || urlParams?.get('time_continue');
return urlTimeToSeconds(time);
}
I hope I've helped