【发布时间】:2021-08-12 14:51:59
【问题描述】:
我使用 tkinter 和 pytube 做了这个简单的 python 程序,用于下载 youtube 视频。 它工作得很好,但我想更改目标文件夹并且不知道如何。
from tkinter import*
from pytube import YouTube
root = Tk()
root.geometry('500x300')
root.resizable(0,0)
root.title("Youtube Video Downloader")
Label(root,text = 'Youtube Video Downloader', font = 'arial 20 bold').pack()
#field for entering link
link = StringVar()
Label(root, text='Paste link here:', font = 'arial 15 bold').place(x = 160, y = 60)
link_enter = Entry(root, width = 70, textvariable = link).place(x = 32, y = 90)
#def for downloading
def Downloader():
url =YouTube(str(link.get()))
video = url.streams.first()
video.download()
Label(root, text = 'DOWNLOADED', font = 'arial 15').place(x= 180 , y = 210)
Button(root,text = 'DOWNLOAD', font = 'arial 15 bold' ,bg = 'pale violet red', padx = 2, command = Downloader).place(x=180 ,y = 150)
root.mainloop()
【问题讨论】:
-
为什么不直接移动下载的文件?
-
我更喜欢学习如何去做。