Skip to content

armgit / my-yt

Public Imported from GitHub
0

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

JavaScript

--default-search "ytsearch"

Christian Fei7c2d55665c2d
diff --git a/lib/youtube.js b/lib/youtube.js
index ec54a72..54c14d2 100644
--- a/lib/youtube.js
+++ b/lib/youtube.js
@@ -4,7 +4,7 @@ import fs from 'fs'
export async function downloadVideo(id, repo, callback = () => {}) {
return new Promise(async (resolve, reject) => {
try {
- for await (const line of execa`yt-dlp -f best[ext=mp4] "${id}" -o ./data/videos/${id}.mp4`.iterable()) {
+ for await (const line of execa`yt-dlp --default-search ytsearch -f best[ext=mp4] "${id}" -o ./data/videos/${id}.mp4`.iterable()) {
callback(line)
}
@@ -21,7 +21,7 @@ export async function downloadVideo(id, repo, callback = () => {}) {
export async function getVideoSubtitles (id, callback = () => {}) {
return new Promise(async (resolve, reject) => {
try {
- for await (const line of execa`yt-dlp --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt --default-search ytsearch "${id}" -o ./data/videos/${id}-sub`.iterable()) {
+ for await (const line of execa`yt-dlp --default-search ytsearch --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt "${id}" -o ./data/videos/${id}-sub`.iterable()) {
callback(line)
}
const transcriptPath = `./data/videos/${id}-sub.en.srt`