def mp3(self, url): path = Helpers.check_platform('Music') self.create_path(path) ydl_opts = utils.ydl_options() with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([url]) print(colored('Download Completed', 'green'))
def playlist(self, url): playlist = pafy.get_playlist(url) path = Helpers.check_platform() + "/Playlists/{}".format( playlist['title']) join_ = os.path.join(path) file = Helpers.check_platform('Playlists') if os.path.isdir(file) == True: pass else: os.mkdir(file) if os.path.isdir(path) == True: pass else: os.mkdir(join_) os.chdir(join_) utils.playlist_info(url) with youtube_dl.YoutubeDL({}) as ydl: ydl.download([url])
def mp4(self, url): path = Helpers.check_platform('Videos') self.create_path(path) try: with youtube_dl.YoutubeDL({}) as ydl: ydl.download([url]) print(colored('Download Completed', 'green')) except: print(colored('something went wrong try again', 'red'))