1
0
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:
Bill
2020-04-20 11:54:41 -04:00
committed by GitHub
parent 087850821c
commit 318026895b

View File

@@ -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);
}