diff --git a/src/routes/postSkipSegments.js b/src/routes/postSkipSegments.js index d8fe2a3..66cc4b0 100644 --- a/src/routes/postSkipSegments.js +++ b/src/routes/postSkipSegments.js @@ -105,9 +105,11 @@ async function autoModerateSubmission(submission, callback) { } else { let duration = data.items[0].contentDetails.duration; duration = isoDurations.toSeconds(isoDurations.parse(duration)); - - // Reject submission if over 80% of the video - if ((submission.endTime - submission.startTime) > (duration/100)*80) { + if (duration === 0) { + // Allow submission if the duration is 0 (bug in youtube api) + return false; + } else if ((submission.endTime - submission.startTime) > (duration/100)*80) { + // Reject submission if over 80% of the video return "Sponsor segment is over 80% of the video."; } else { return false;