mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 19:28:29 +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 { cleanString } from "../../sub/utils.js";
|
||||||
import HLS from "hls-parser";
|
import HLS from "hls-parser";
|
||||||
import util from "node:util";
|
import util from "node:util";
|
||||||
@ -144,7 +144,12 @@ async function getHLSContent(contentURL, quality, isAudioOnly) {
|
|||||||
|
|
||||||
export default async function nicovideo({ id, quality, isAudioOnly }) {
|
export default async function nicovideo({ id, quality, isAudioOnly }) {
|
||||||
try {
|
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)
|
const { resolution, urls, type } = await fetchGuestData(id, actionTrackId)
|
||||||
.then(({ accessRightKey, outputs }) =>
|
.then(({ accessRightKey, outputs }) =>
|
||||||
fetchContentURL(id, actionTrackId, accessRightKey, outputs)
|
fetchContentURL(id, actionTrackId, accessRightKey, outputs)
|
||||||
|
Loading…
Reference in New Issue
Block a user