mirror of
https://github.com/snobu/destreamer.git
synced 2026-01-21 23:42:16 +00:00
Account for addtional query parameters when parsing video ID (#75)
* Account for extra query parameters when parsing video ID * Use URL module to parse URL
This commit is contained in:
@@ -105,10 +105,10 @@ function extractVideoGuid(videoUrls: string[]): string[] {
|
||||
|
||||
for (const url of videoUrls) {
|
||||
try {
|
||||
guid = url.split('/').pop();
|
||||
|
||||
const urlObj = new URL(url);
|
||||
guid = urlObj.pathname.split('/').pop();
|
||||
} catch (e) {
|
||||
console.error(`${e.message}`);
|
||||
console.error(`Unrecognized URL format in ${url}: ${e.message}`);
|
||||
process.exit(ERROR_CODE.INVALID_VIDEO_GUID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user