From 0bedddc21f7fdfafd76f70cb26efd5add0427401 Mon Sep 17 00:00:00 2001 From: localhost Date: Sat, 17 Jan 2026 23:43:42 +0100 Subject: [PATCH] companion ip --- utils/companion.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/companion.ts b/utils/companion.ts index 6785283..e6a47f4 100644 --- a/utils/companion.ts +++ b/utils/companion.ts @@ -164,7 +164,8 @@ export async function downloadStream(streamUrl: string, format: any, stream: Wri } async function getStreamUrl(videoId: string, itag: number): Promise { - const req = await fetch(`http://127.0.0.1:8282/companion/latest_version?id=${videoId}&itag=${itag}`, { + const config = await Bun.file('config.json').json() + const req = await fetch(`http://${config.companionIp || '127.0.0.1'}:8282/companion/latest_version?id=${videoId}&itag=${itag}`, { redirect: 'manual' }) @@ -183,7 +184,8 @@ function secondsToTime(seconds: number) { } export async function getInfo(videoId: string) { - const req = await fetch('http://127.0.0.1:8282/companion/youtubei/v1/player', { + const config = await Bun.file('config.json').json() + const req = await fetch(`http://${config.companionIp || '127.0.0.1'}:8282/companion/youtubei/v1/player`, { method: 'POST', headers: { 'Content-Type': 'application/json',