mirror of
https://github.com/snobu/destreamer.git
synced 2026-03-01 17:48:25 +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) {
|
for (const url of videoUrls) {
|
||||||
try {
|
try {
|
||||||
guid = url.split('/').pop();
|
const urlObj = new URL(url);
|
||||||
|
guid = urlObj.pathname.split('/').pop();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`${e.message}`);
|
console.error(`Unrecognized URL format in ${url}: ${e.message}`);
|
||||||
process.exit(ERROR_CODE.INVALID_VIDEO_GUID);
|
process.exit(ERROR_CODE.INVALID_VIDEO_GUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user