Skip to content

Commit d53d953

Browse files
committed
refactor: import ytdlp as module
1 parent dc63c3a commit d53d953

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/youtube.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import spawn from 'nano-spawn'
22
import fs from 'fs'
3-
import { video, subtitles } from './yt-dlp.js'
3+
import * as ytdlp from './yt-dlp.js'
44

55
export const ytUrlRegExp = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/watch\?v=([^&]+).*/
66

@@ -16,7 +16,7 @@ export async function downloadVideo(id, repo, callback = () => {}) {
1616
try {
1717
const quality = repo.getVideoQuality()
1818
let location, format
19-
for await (const line of video(id, quality)) {
19+
for await (const line of ytdlp.video(id, quality)) {
2020
console.log(line)
2121
callback(line)
2222
if (line.startsWith('[Merger] Merging formats into')) {
@@ -53,7 +53,7 @@ export async function getVideoSubtitles (id, callback = () => {}) {
5353
try {
5454
const transcriptPath = `./data/videos/${id}.en.srt`
5555
if (!fs.existsSync(transcriptPath)) {
56-
for await (const line of subtitles(id)) {
56+
for await (const line of ytdlp.subtitles(id)) {
5757
console.log(line)
5858
callback(line)
5959
}

0 commit comments

Comments
 (0)