Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- try:
- from pytube import Playlist
- from art import tprint
- except ModuleNotFoundError:
- os.system('pip install pytube')
- os.system('pip install art')
- from pytube import Playlist
- from art import tprint
- tprint("NajeebYTBot")
- print("Developed by Najeeb Shah Khan")
- print("-------------------------------------")
- # create a function to get urls from list of playlist
- def get_playlist(playlists):
- urls = []
- # iteratively get watch links from playlist
- for playlist in playlists:
- playlist_urls = Playlist(playlist)
- for url in playlist_urls:
- urls.append(url)
- return urls
- # code driver
- playlists = ['https://www.youtube.com/playlist?list=PLCSCKIX4Tq5ZERz4gRsqtEhVhKMiJs-wD',
- 'https://www.youtube.com/playlist?list=PLCSCKIX4Tq5a_0XOwL3ygCpLxwi0OVikN']
- pl_urls = get_playlist(playlists)
- with open('plurls.txt', 'w') as f:
- for url in pl_urls:
- f.write(url + '\n')
- print("Urls successfully saved into os.getcwd()")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement