Spaces:
Runtime error
Runtime error
File size: 1,445 Bytes
5b527ce 6c6fcb3 5b527ce 1b0583a cac373a 6c6fcb3 5b527ce 6c6fcb3 5b527ce 6c6fcb3 eaef3cc 1b0583a 6c6fcb3 1b0583a 5b527ce 1b0583a 5b527ce 1b0583a 5b527ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import gradio as gr
import os
def download_url(url, name):
opts = {
"mp3": "-f \"ba\" -x --audio-format mp3",
}
filename = f"{name}.mp3"
os.system(f"yt-dlp {opts} {url} -o {filename}")
return filename
def download_url_vid(url, name):
opts = {
"mp4": '-f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"',
}
filename = f"{name}.mp4"
os.system(f"yt-dlp {opts} {url} -o {filename}")
return filename
with gr.Blocks(theme="Nex432/green") as demo:
gr.Markdown(f"# MEDIA downloader | Easy `DOWNLOAD media LINK` YT, IG ETC")
with gr.Tab("audio downloader"):
url = gr.Textbox(label="Media URL")
name_file = gr.Textbox(label="Media Name")
download = gr.Button("Download")
audio_output = gr.Audio(label="Audo Output")
download.click(download_url, inputs=[url, name_file], outputs=[audio_output])
with gr.Tab("video downloader"):
url = gr.Textbox(label="Media URL")
name_file = gr.Textbox(label="Media Name")
download = gr.Button("Download")
video_output = gr.Video(label="Video Output")
download.click(download_url_vid, inputs=[url, name_file,], outputs=[video_output])
with gr.Tab("credits"):
gr.Markdown(
"""
Code by [Nex432](https://huggingface.co/Nex432)<br> with [ChatGPT's](https://chatgpt.com) help
"""
)
demo.launch()
|