Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from tkinter import Tk, Label, Button, Text, Entry, messagebox
- from pytube import Playlist
- from art import *
- def install_missing_modules():
- try:
- from pytube import Playlist
- from art import tprint
- except ModuleNotFoundError:
- os.system('pip install pytube')
- os.system('pip install art')
- messagebox.showinfo("Modules Installed", "Required modules have been installed. Please restart the application.")
- exit()
- def save_playlist_urls(playlists):
- urls = []
- for playlist in playlists:
- playlist_urls = Playlist(playlist)
- for url in playlist_urls:
- urls.append(url)
- with open('plurls.txt', 'w') as f:
- for url in urls:
- f.write(url + '\n')
- messagebox.showinfo("Success", "URLs successfully saved to plurls.txt")
- def get_playlist():
- playlists = entry.get().split(',')
- save_playlist_urls(playlists)
- def on_closing():
- if messagebox.askokcancel("Quit", "Do you want to quit?"):
- root.destroy()
- # GUI setup
- root = Tk()
- root.title("Najeeb Youtube Channel Urls Scraping")
- root.protocol("WM_DELETE_WINDOW", on_closing)
- label = Label(root, text="Enter playlist URLs (comma separated):")
- label.pack()
- entry = Entry(root, width=50)
- entry.pack()
- button = Button(root, text="Save to Youtube.txt", command=get_playlist)
- button.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement