mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-12 20:25:06 +01:00
stream: move hls exceptions to servicesConfig (#527)
This commit is contained in:
parent
806ad14266
commit
64b5990d81
4 changed files with 6 additions and 6 deletions
|
@ -53,6 +53,7 @@ const
|
||||||
|
|
||||||
export const
|
export const
|
||||||
services = servicesConfigJson.config,
|
services = servicesConfigJson.config,
|
||||||
|
hlsExceptions = servicesConfigJson.hlsExceptions,
|
||||||
audioIgnore = servicesConfigJson.audioIgnore,
|
audioIgnore = servicesConfigJson.audioIgnore,
|
||||||
version = packageJson.version,
|
version = packageJson.version,
|
||||||
genericUserAgent = config.genericUserAgent,
|
genericUserAgent = config.genericUserAgent,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"audioIgnore": ["vk", "ok"],
|
"audioIgnore": ["vk", "ok"],
|
||||||
|
"hlsExceptions": ["dailymotion", "vimeo", "rutube"],
|
||||||
"config": {
|
"config": {
|
||||||
"bilibili": {
|
"bilibili": {
|
||||||
"alias": "bilibili.com & bilibili.tv",
|
"alias": "bilibili.com & bilibili.tv",
|
||||||
|
|
|
@ -3,14 +3,12 @@ import { randomBytes } from "crypto";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
|
|
||||||
import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js";
|
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";
|
import { strict as assert } from "assert";
|
||||||
|
|
||||||
// optional dependency
|
// optional dependency
|
||||||
const freebind = env.freebindCIDR && await import('freebind').catch(() => {});
|
const freebind = env.freebindCIDR && await import('freebind').catch(() => {});
|
||||||
|
|
||||||
const M3U_SERVICES = ['dailymotion', 'vimeo', 'rutube'];
|
|
||||||
|
|
||||||
const streamCache = new NodeCache({
|
const streamCache = new NodeCache({
|
||||||
stdTTL: env.streamLifespan,
|
stdTTL: env.streamLifespan,
|
||||||
checkperiod: 10,
|
checkperiod: 10,
|
||||||
|
@ -110,7 +108,7 @@ export function destroyInternalStream(url) {
|
||||||
function wrapStream(streamInfo) {
|
function wrapStream(streamInfo) {
|
||||||
/* m3u8 links are currently not supported
|
/* m3u8 links are currently not supported
|
||||||
* for internal streams, skip them */
|
* for internal streams, skip them */
|
||||||
if (M3U_SERVICES.includes(streamInfo.service)) {
|
if (hlsExceptions.includes(streamInfo.service)) {
|
||||||
return streamInfo;
|
return streamInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { create as contentDisposition } from "content-disposition-header";
|
||||||
|
|
||||||
import { metadataManager } from "../sub/utils.js";
|
import { metadataManager } from "../sub/utils.js";
|
||||||
import { destroyInternalStream } from "./manage.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";
|
import { getHeaders, closeResponse } from "./shared.js";
|
||||||
|
|
||||||
function toRawHeaders(headers) {
|
function toRawHeaders(headers) {
|
||||||
|
@ -215,7 +215,7 @@ export function streamVideoOnly(streamInfo, res) {
|
||||||
args.push('-an')
|
args.push('-an')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (["vimeo", "rutube", "dailymotion"].includes(streamInfo.service)) {
|
if (hlsExceptions.includes(streamInfo.service)) {
|
||||||
args.push('-bsf:a', 'aac_adtstoasc')
|
args.push('-bsf:a', 'aac_adtstoasc')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue