stream: move hls exceptions to servicesConfig (#527)

This commit is contained in:
wukko 2024-05-28 14:32:03 +06:00 committed by GitHub
parent 806ad14266
commit 64b5990d81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 6 deletions

View file

@ -53,6 +53,7 @@ const
export const
services = servicesConfigJson.config,
hlsExceptions = servicesConfigJson.hlsExceptions,
audioIgnore = servicesConfigJson.audioIgnore,
version = packageJson.version,
genericUserAgent = config.genericUserAgent,

View file

@ -1,5 +1,6 @@
{
"audioIgnore": ["vk", "ok"],
"hlsExceptions": ["dailymotion", "vimeo", "rutube"],
"config": {
"bilibili": {
"alias": "bilibili.com & bilibili.tv",

View file

@ -3,14 +3,12 @@ import { randomBytes } from "crypto";
import { nanoid } from "nanoid";
import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js";
import { env } from "../config.js";
import { env, hlsExceptions } from "../config.js";
import { strict as assert } from "assert";
// optional dependency
const freebind = env.freebindCIDR && await import('freebind').catch(() => {});
const M3U_SERVICES = ['dailymotion', 'vimeo', 'rutube'];
const streamCache = new NodeCache({
stdTTL: env.streamLifespan,
checkperiod: 10,
@ -110,7 +108,7 @@ export function destroyInternalStream(url) {
function wrapStream(streamInfo) {
/* m3u8 links are currently not supported
* for internal streams, skip them */
if (M3U_SERVICES.includes(streamInfo.service)) {
if (hlsExceptions.includes(streamInfo.service)) {
return streamInfo;
}

View file

@ -5,7 +5,7 @@ import { create as contentDisposition } from "content-disposition-header";
import { metadataManager } from "../sub/utils.js";
import { destroyInternalStream } from "./manage.js";
import { env, ffmpegArgs } from "../config.js";
import { env, ffmpegArgs, hlsExceptions } from "../config.js";
import { getHeaders, closeResponse } from "./shared.js";
function toRawHeaders(headers) {
@ -215,7 +215,7 @@ export function streamVideoOnly(streamInfo, res) {
args.push('-an')
}
if (["vimeo", "rutube", "dailymotion"].includes(streamInfo.service)) {
if (hlsExceptions.includes(streamInfo.service)) {
args.push('-bsf:a', 'aac_adtstoasc')
}