Dumb update
This commit is contained in:
parent
e6096f2cd2
commit
9f36097598
1 changed files with 6 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
||||||
import { create } from 'youtube-dl-exec';
|
import { create, type Flags } from 'youtube-dl-exec';
|
||||||
import { env } from '$env/dynamic/private';
|
import { env } from '$env/dynamic/private';
|
||||||
import { spawn } from 'node:child_process';
|
import { spawn } from 'node:child_process';
|
||||||
import supportedFormats from '$lib/common/supportedFormats.json';
|
|
||||||
import { logger, mimeTypeMap } from '$lib/server/helpers';
|
import { logger, mimeTypeMap } from '$lib/server/helpers';
|
||||||
|
|
||||||
const YTDLP_PATH: string = env.YTDLP_PATH as string;
|
const YTDLP_PATH: string = env.YTDLP_PATH as string;
|
||||||
|
@ -13,7 +12,7 @@ export const ytdl = create(YTDLP_PATH);
|
||||||
* Fetch YouTube metadata (title, uploader/artist)
|
* Fetch YouTube metadata (title, uploader/artist)
|
||||||
*/
|
*/
|
||||||
export async function getYouTubeMetadata(link: string) {
|
export async function getYouTubeMetadata(link: string) {
|
||||||
const options = {
|
const options: Flags = {
|
||||||
dumpSingleJson: true,
|
dumpSingleJson: true,
|
||||||
noCheckCertificates: true,
|
noCheckCertificates: true,
|
||||||
noWarnings: true,
|
noWarnings: true,
|
||||||
|
@ -66,10 +65,13 @@ export function streamYouTube(link: string, format: string): ReadableStream<Uint
|
||||||
process.stdout.on('data', (chunk) => {
|
process.stdout.on('data', (chunk) => {
|
||||||
try {
|
try {
|
||||||
controller.enqueue(chunk);
|
controller.enqueue(chunk);
|
||||||
} catch (ex) {
|
} catch () {
|
||||||
process.kill();
|
process.kill();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
process.stderr.on('data', (chunk) => logger.debug(chunk.toString()));
|
process.stderr.on('data', (chunk) => logger.debug(chunk.toString()));
|
||||||
process.stdout.on('end', () => {
|
process.stdout.on('end', () => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue