Youtube’dan istediğimiz kalitede video, ses ya da oynatma listesi indirebileceğimiz masaüstü bir uygulama yapmayı öğreniyoruz.
Video Serisi Boyunca Kullandığımız Siteler:
https://pypi.org/project/pytube3/
https://python-pytube.readthedocs.io/en/latest/
https://stackoverflow.com/questions/62661930/pytube3-playlist-returns-empty-list
Kodlar:
from tkinter import * from tkinter import ttk import os class AnaSayfa(Tk): def __init__(self): Tk.__init__(self) self.cerceve1 = Frame(self, bg="#769fcd") self.cerceve1.pack(side=TOP, fill=X) self.cerceve2 = Frame(self, bg="#b9d7ea") self.cerceve2.pack(side=TOP, fill=X) Label(self.cerceve1, text="YOUTUBE İNDİRME PROGRAMI", font=("Baloo 2", 17, "bold"), bg="#769fcd").pack() Button(self.cerceve1, text="VİDEO / SES", font=("Baloo 2", 12), bg="#769fcd", activebackground="#b9d7ea", width=25, command=lambda: Video(self)).pack() Button(self.cerceve1, text="OYNATMA LİSTESİ", font=("Baloo 2", 12), bg="#769fcd", activebackground="#b9d7ea", width=25, command=lambda: OynatmaListesi(self)).pack() class Video(Frame): def __init__(self, master): Frame.__init__(self, master) for widget in master.cerceve2.winfo_children(): widget.destroy() Label(master.cerceve2, text="VİDEO / SES", font=("Baloo 2", 13, "bold"), bg="#b9d7ea").pack() Label(master.cerceve2, text="URL", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.url = Entry(master.cerceve2, width=40, font=("Baloo 2", 11)) self.url.pack() Label(master.cerceve2, text="KALİTE", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() kalite = ["Max. Kalite", "Min. Kalite", "360p", "Sadece Ses"] self.kalite_sec = ttk.Combobox(master.cerceve2, font=("Baloo 2", 12), width=24, value=kalite) self.kalite_sec.pack() self.kalite_sec.current(0) Label(master.cerceve2, text="KAYIT YERİ", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.kayit_yeri_gosterilen = Label(master.cerceve2, text=f"{os.getcwd()}", font=("Baloo 2", 9), bg="#b9d7ea") self.kayit_yeri_gosterilen.pack() Button(master.cerceve2, text="SEÇ", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, ).pack() Button(master.cerceve2, text="İNDİR", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, ).pack() self.indiriliyor = Label(master.cerceve2, text="", bg="#b9d7ea", font=("Baloo 2", 12)) self.indiriliyor.pack() class OynatmaListesi(Frame): def __init__(self, master): Frame.__init__(self, master) for widget in master.cerceve2.winfo_children(): widget.destroy() Label(master.cerceve2, text="OYNATMA LİSTESİ", font=("Baloo 2", 13, "bold"), bg="#b9d7ea").pack() Label(master.cerceve2, text="URL", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.url = Entry(master.cerceve2, width=40, font=("Baloo 2", 11)) self.url.pack() Label(master.cerceve2, text="KALİTE", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() kalite = ["Max. Kalite", "Min. Kalite", "360p", "Sadece Ses"] self.kalite_sec = ttk.Combobox(master.cerceve2, font=("Baloo 2", 12), width=24, value=kalite) self.kalite_sec.pack() self.kalite_sec.current(0) Label(master.cerceve2, text="KAYIT YERİ", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.kayit_yeri_gosterilen = Label(master.cerceve2, text=f"{os.getcwd()}", font=("Baloo 2", 9), bg="#b9d7ea") self.kayit_yeri_gosterilen.pack() Button(master.cerceve2, text="SEÇ", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, ).pack() Button(master.cerceve2, text="İNDİR", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, ).pack() self.indiriliyor = Label(master.cerceve2, text="", bg="#b9d7ea", font=("Baloo 2", 12)) self.indiriliyor.pack() if __name__ == "__main__": app = AnaSayfa() app.configure(bg="#b9d7ea") app.title("Youtube İndirme Programı") app.iconphoto(True, PhotoImage(file="sft.png")) app.geometry("600x475+250+75") app.resizable(False, False) app.mainloop()