mirror of
https://github.com/imputnet/cobalt.git
synced 2026-01-02 21:11:14 +00:00
api: add DURATION_LIMIT env variable
duration limit is now in seconds and customizable across instances
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { genericUserAgent, maxVideoDuration } from "../../config.js";
|
||||
import { genericUserAgent, env } from "../../config.js";
|
||||
import { cleanString } from "../../sub/utils.js";
|
||||
|
||||
const resolutions = {
|
||||
@@ -29,7 +29,7 @@ export default async function(o) {
|
||||
|
||||
if (videoData.provider !== "UPLOADED_ODKL") return { error: 'ErrorUnsupported' };
|
||||
if (videoData.movie.is_live) return { error: 'ErrorLiveVideo' };
|
||||
if (videoData.movie.duration > maxVideoDuration / 1000) return { error: ['ErrorLengthLimit', maxVideoDuration / 60000] };
|
||||
if (videoData.movie.duration > env.durationLimit) return { error: ['ErrorLengthLimit', env.durationLimit / 60] };
|
||||
|
||||
let videos = videoData.videos.filter(v => !v.disallowed);
|
||||
let bestVideo = videos.find(v => resolutions[v.name] === quality) || videos[videos.length - 1];
|
||||
|
||||
Reference in New Issue
Block a user