added resolution parameter, minor fixes
This commit is contained in:
		@@ -102,7 +102,11 @@ async def get_url_for_download_video(request: Request, data: SubmitIn = Depends(
 | 
				
			|||||||
        body = [
 | 
					        body = [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                "link": data.link,
 | 
					                "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,
 | 
					                "merge_output_format": data.merge_output_format.value,
 | 
				
			||||||
                "outtmpl": f"downloads/%(extractor_key)s/%(id)s_%(resolution)s.%(ext)s",
 | 
					                "outtmpl": f"downloads/%(extractor_key)s/%(id)s_%(resolution)s.%(ext)s",
 | 
				
			||||||
            }, ]
 | 
					            }, ]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,16 @@ class AudioFormatEnum(Enum):
 | 
				
			|||||||
    format_wav = "wav"
 | 
					    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):
 | 
					class MergeOutputFormatEnum(Enum):
 | 
				
			||||||
    format_avi = "avi"
 | 
					    format_avi = "avi"
 | 
				
			||||||
    format_flv = "flv"
 | 
					    format_flv = "flv"
 | 
				
			||||||
@@ -42,6 +52,7 @@ class SubmitIn:
 | 
				
			|||||||
    link: str = Form(...)
 | 
					    link: str = Form(...)
 | 
				
			||||||
    video_format: VideoFormatEnum = Form(default=MergeOutputFormatEnum.format_webm)
 | 
					    video_format: VideoFormatEnum = Form(default=MergeOutputFormatEnum.format_webm)
 | 
				
			||||||
    audio_format: AudioFormatEnum = Form(default=AudioFormatEnum.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)
 | 
					    merge_output_format: MergeOutputFormatEnum = Form(default=MergeOutputFormatEnum.format_mkv)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,6 +74,7 @@
 | 
				
			|||||||
         <input type="text" name="link" id="link" placeholder="link">
 | 
					         <input type="text" name="link" id="link" placeholder="link">
 | 
				
			||||||
         <input type="text" name="video_format" placeholder="video_format">
 | 
					         <input type="text" name="video_format" placeholder="video_format">
 | 
				
			||||||
         <input type="text" name="audio_format" placeholder="audio_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">
 | 
					         <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>
 | 
					         <button type="submit" class="custom-btn btn-1"><span class="submit-spinner submit-spinner_hide"></span> Download</button>
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user