this is a blog post

Nov 25, 2023 • 1 min read

tags

super cool

yeah

Header YUH

this is some text for the blog bro!

Related to blog post
# import youtube_dl
import pytube

# audio = False

# ydl_opts = {}

# if audio:
#     ydl_opts = {
#         'format': 'bestaudio/best',
#         'outtmpl': '%(title)s.%(ext)s',
#         'postprocessors': [{
#             'key': 'FFmpegExtractAudio',
#             'preferredcodec': 'mp3',
#             'preferredquality': '192',
#         }]
#     }

# with youtube_dl.YoutubeDL(ydl_opts) as ydl:
#     ydl.download(['https://www.youtube.com/watch?v=Pt5_GSKIWQM'])

def download(video_url):
    video = pytube.YouTube(video_url)
    video = video.streams.get_highest_resolution()

    try:
        video.download("./video")
    except:
        print("Failed to download video")

    print("video was downloaded successfully")

download("https://www.youtube.com/watch?v=Pt5_GSKIWQM")