0

PYTUBE Error downloading video

i wanted to download a youtube video using pytube but all it did was say that the video was invalid i need help analyzing the issue

this it the code i used

import customtkinter
import tkinter
from pytube import YouTube


def startdownload():
    try:
        ytLink = Link.get()
        ytObject = YouTube(ytLink)
        video = ytObject.streams.get_highest_resolution()  # change this line
        video.download()
    except:
        print("YouTube link is invalid")
    print("youtube Link complete")




# Adding UI Elements
title = customtkinter.CTkLabel(app, text="Insert a youtube link")
title.pack(padx=10, pady=10)

# Link Input
url_var = tkinter.StringVar()
Link = customtkinter.CTkEntry(app, width=350, height=40, textvariable=url_var)
Link.pack()

# Download Button
download = customtkinter.CTkButton(app, text="Download", command=startdownload)
download.pack(padx=10, pady=10)


mr. code
  • 67
  • 5

0 Answers0