added resolution parameter, minor fixes

This commit is contained in:
Dantenerosas 2023-10-01 03:18:00 +03:00 committed by nikili0n
parent 3aa4e074d3
commit a3516f826a
3 changed files with 17 additions and 1 deletions

View File

@ -102,7 +102,11 @@ async def get_url_for_download_video(request: Request, data: SubmitIn = Depends(
body = [
{
"link": data.link,
"format": f"bestvideo[ext={data.video_format.value}]+bestaudio[ext={data.audio_format.value}]/best[ext={data.video_format.value}]/best",
"format": f"bv[width={data.resolution.value}][ext={data.video_format.value}]+ba[ext={data.audio_format.value}]/"
f"bv[width={data.resolution.value}][ext=mp4]+ba[ext=m4a]/"
f"bv[width={data.resolution.value}][ext=webm]+ba[ext=webm]/"
f"best[ext={data.video_format.value}]/"
f"best[ext!=unknown_video]",
"merge_output_format": data.merge_output_format.value,
"outtmpl": f"downloads/%(extractor_key)s/%(id)s_%(resolution)s.%(ext)s",
}, ]

View File

@ -28,6 +28,16 @@ class AudioFormatEnum(Enum):
format_wav = "wav"
class ResolutionEnum(Enum):
resolution_240 = "240"
resolution_360 = "360"
resolution_480 = "480"
resolution_720 = "720"
resolution_1080 = "1080"
resolution_2048 = "2048"
resolution_3820 = "3840"
class MergeOutputFormatEnum(Enum):
format_avi = "avi"
format_flv = "flv"
@ -42,6 +52,7 @@ class SubmitIn:
link: str = Form(...)
video_format: VideoFormatEnum = Form(default=MergeOutputFormatEnum.format_webm)
audio_format: AudioFormatEnum = Form(default=AudioFormatEnum.format_webm)
resolution: ResolutionEnum = Form(default=ResolutionEnum.resolution_1080)
merge_output_format: MergeOutputFormatEnum = Form(default=MergeOutputFormatEnum.format_mkv)

View File

@ -74,6 +74,7 @@
<input type="text" name="link" id="link" placeholder="link">
<input type="text" name="video_format" placeholder="video_format">
<input type="text" name="audio_format" placeholder="audio_format">
<input type="text" name="resolution" placeholder="resolution">
<input type="text" name="merge_output_format" placeholder="merge_output_format">
<button type="submit" class="custom-btn btn-1"><span class="submit-spinner submit-spinner_hide"></span> Download</button>
</form>