mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 03:08:30 +00:00
fix: video length check in nicovideo
This commit is contained in:
parent
2d8bb1d103
commit
d39fd06387
@ -1,4 +1,4 @@
|
||||
import { genericUserAgent } from "../../config.js";
|
||||
import { env, genericUserAgent } from "../../config.js";
|
||||
import { cleanString } from "../../sub/utils.js";
|
||||
import HLS from "hls-parser";
|
||||
import util from "node:util";
|
||||
@ -144,7 +144,12 @@ async function getHLSContent(contentURL, quality, isAudioOnly) {
|
||||
|
||||
export default async function nicovideo({ id, quality, isAudioOnly }) {
|
||||
try {
|
||||
const { actionTrackId, title, author } = await getBasicVideoInformation(id);
|
||||
const { actionTrackId, title, author, lengthInSeconds } = await getBasicVideoInformation(id);
|
||||
|
||||
if (lengthInSeconds > env.durationLimit) {
|
||||
throw new CobaltError(['ErrorLengthLimit', env.durationLimit / 60]);
|
||||
}
|
||||
|
||||
const { resolution, urls, type } = await fetchGuestData(id, actionTrackId)
|
||||
.then(({ accessRightKey, outputs }) =>
|
||||
fetchContentURL(id, actionTrackId, accessRightKey, outputs)
|
||||
|
Loading…
Reference in New Issue
Block a user