Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

refactor: import ytdlp as module

Christian Feid53d953ccd35
diff --git a/lib/youtube.js b/lib/youtube.js
index a581688..cc86306 100644
--- a/lib/youtube.js
+++ b/lib/youtube.js
@@ -1,6 +1,6 @@
import spawn from 'nano-spawn'
import fs from 'fs'
-import { video, subtitles } from './yt-dlp.js'
+import * as ytdlp from './yt-dlp.js'
export const ytUrlRegExp = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/watch\?v=([^&]+).*/
@@ -16,7 +16,7 @@ export async function downloadVideo(id, repo, callback = () => {}) {
try {
const quality = repo.getVideoQuality()
let location, format
- for await (const line of video(id, quality)) {
+ for await (const line of ytdlp.video(id, quality)) {
console.log(line)
callback(line)
if (line.startsWith('[Merger] Merging formats into')) {
@@ -53,7 +53,7 @@ export async function getVideoSubtitles (id, callback = () => {}) {
try {
const transcriptPath = `./data/videos/${id}.en.srt`
if (!fs.existsSync(transcriptPath)) {
- for await (const line of subtitles(id)) {
+ for await (const line of ytdlp.subtitles(id)) {
console.log(line)
callback(line)
}