diff --git a/buzz/transcriber/file_transcriber.py b/buzz/transcriber/file_transcriber.py index 494d8a4e8..80faf8ddb 100755 --- a/buzz/transcriber/file_transcriber.py +++ b/buzz/transcriber/file_transcriber.py @@ -35,14 +35,19 @@ def run(self): temp_output_path = tempfile.mktemp() wav_file = temp_output_path + ".wav" - ydl = YoutubeDL( - { - "format": "bestaudio/best", - "progress_hooks": [self.on_download_progress], - "outtmpl": temp_output_path, - "logger": logging.getLogger() - } - ) + cookiefile = os.getenv("BUZZ_DOWNLOAD_COOKIEFILE") + + options = { + "format": "bestaudio/best", + "progress_hooks": [self.on_download_progress], + "outtmpl": temp_output_path, + "logger": logging.getLogger(), + } + + if cookiefile: + options["cookiefile"] = cookiefile + + ydl = YoutubeDL(options) try: logging.debug(f"Downloading audio file from URL: {self.transcription_task.url}") diff --git a/docs/docs/preferences.md b/docs/docs/preferences.md index 2adc80bac..fd5a86efe 100644 --- a/docs/docs/preferences.md +++ b/docs/docs/preferences.md @@ -92,3 +92,5 @@ Defaults to [user_cache_dir](https://pypi.org/project/platformdirs/). **BUZZ_FAVORITE_LANGUAGES** - Coma separated list of supported language codes to show on top of language list. **BUZZ_LOCALE** - Buzz UI locale to use. Defaults to one of supported system locales. + +**BUZZ_DOWNLOAD_COOKIEFILE** - Location of a [cookiefile](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp) to use for downloading private videos or as workaround for anti-bot protection.