Version 1.4.2

This commit is contained in:
Taras Terletskyi 2023-07-06 23:27:43 +03:00
parent 20a4dd5014
commit a262414157
5 changed files with 39 additions and 1 deletions

View file

@ -2,7 +2,7 @@
Simple and reliable self-hosted YouTube Download Telegram Bot.
Version: 1.4.1. [Release details](RELEASES.md).
Version: 1.4.2. [Release details](RELEASES.md).
![frames](.assets/download_success.png)
@ -92,6 +92,8 @@ or something went wrong.
is the premium user, you're allowed to upload files up to 4GB (4294967296 bytes) and
can change the default value stored in the `upload_video_max_file_size` config
variable.
5. If the website you want to download from requires authentication you can use your cookies by putting them into
the `app_worker/cookies/cookies.txt` file in the Netscape format.
## 🛑 Failed download

View file

@ -1,3 +1,23 @@
## Release 1.4.2
Release date: July 06, 2023
## New Features
- Use cookies for website auth for download by putting them into the `app_worker/cookies/cookies.txt` file in Netscape
format.
## Important
- If you are using the customized yt-dlp options in the `app_worker/ytdl_opts/user.py` you must reconfigure them from
the updated `app_worker/ytdl_opts/default.py`.
## Misc
N/A
---
## Release 1.4.1
Release date: March 29, 2023

View file

View file

@ -1,5 +1,9 @@
import os
import yt_dlp
_COOKIES_FILEPATH = '/app/cookies/cookies.txt'
def cli_to_api(opts: list) -> dict:
"""Convert yt-dlp CLI options to internal API ones."""
@ -12,3 +16,13 @@ def cli_to_api(opts: list) -> dict:
pp for pp in diff['postprocessors'] if pp not in default['postprocessors']
]
return diff
def is_file_empty(filepath: str) -> bool:
"""Check whether the file is empty."""
return os.path.isfile(filepath) and os.path.getsize(filepath) == 0
def get_cookies_opts_if_not_empty() -> list[str]:
"""Return yt-dlp cookies option with cookies filepath."""
return [] if is_file_empty(_COOKIES_FILEPATH) else ['--cookies', _COOKIES_FILEPATH]

View file

@ -6,6 +6,7 @@ More here https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/options.py or 'yt-
If you want to change any of these values or add new ones, copy all content to the `user.py` in the same
directory as this file, and edit the values.
"""
from worker.utils import get_cookies_opts_if_not_empty
FINAL_AUDIO_FORMAT = 'mp3'
FINAL_THUMBNAIL_FORMAT = 'jpg'
@ -20,6 +21,7 @@ DEFAULT_YTDL_OPTS = [
'5',
'--ignore-errors',
'--verbose',
*get_cookies_opts_if_not_empty(),
]
AUDIO_YTDL_OPTS = [