const startPlaylistURLs = buildUrls(playlistPaths)
const startVideoURLs = buildUrls(videoPaths)
-const watchRegex = /\/([^/]+)$/
const isURLOptions = {
require_host: true,
require_tld: true
const startIsOk = isVideo || isPlaylist
- const matches = watchRegex.exec(urlPath)
+ const parts = urlPath.split('/')
- if (startIsOk === false || matches === null) {
+ if (startIsOk === false || parts.length === 0) {
return res.fail({
status: HttpStatusCode.BAD_REQUEST_400,
message: 'Invalid url.',
})
}
- const elementId = toCompleteUUID(matches[1])
+ const elementId = toCompleteUUID(parts.pop())
if (isIdOrUUIDValid(elementId) === false) {
return res.fail({ message: 'Invalid video or playlist id.' })
}