scripts/deprecated/ytdlp_helper.py
Ferit Yiğit BALABAN 7f4d328d77
more deprecations
Signed-off-by: Ferit Yiğit BALABAN <fyb@fybx.dev>
2024-01-15 22:47:27 +03:00

38 lines
1.2 KiB
Python

#!/usr/bin/env python3
# Helps me to download whole playlists or just one video, in any format I wish.
from subprocess import run
def yt_dlp(url: str, what: int, form: int, ):
try:
if what == 1 and form == 1:
run(['yt-dlp', '-x', '--audio-format', "'mp3'", '--audio-quality', '0', f"'{url}'"])
elif what == 1 and form == 2:
run(['yt-dlp', '-S', "'ext'", f"'{url}'"])
elif what == 2 and form == 1:
run(['yt-dlp'])
except FileNotFoundError:
print("Are you sure that yt-dlp is installed?")
def main():
print("Welcome to yt-dlp helper!\n")
url = input("Would you be kind and share the URL of content you wish to download: ")
print("Which format do you want the downloaded content be in?")
print("1. mp3")
print("2. mp4")
form = int(input("Please make your selection: "))
print("1. I want to download a video.")
print("2. I want to download a playlist.")
if input("Please make your selection: ") == 1:
print("Alright! Your download shall begin now: ")
yt_dlp(url, 1, form)
else:
yt_dlp(url, 2, form)
if __name__ == '__main__':
main()