def test_construct(): ob = Playlist( 'https://www.youtube.com/watch?v=m5q2GCsteQs&list=' 'PL525f8ds9RvsXDl44X6Wwh9t3fCzFNApw', ) expected = 'https://www.youtube.com/' \ 'playlist?list=' \ 'PL525f8ds9RvsXDl44X6Wwh9t3fCzFNApw' assert ob.construct_playlist_url() == expected
def test_link_parse(): ob = Playlist( 'https://www.youtube.com/watch?v=m5q2GCsteQs&list=' 'PL525f8ds9RvsXDl44X6Wwh9t3fCzFNApw', ) expected = [ '/watch?v=m5q2GCsteQs', '/watch?v=5YK63cXyJ2Q', '/watch?v=Rzt4rUPFYD4', ] assert ob.parse_links() == expected
def test_populate(): ob = Playlist( 'https://www.youtube.com/watch?v=m5q2GCsteQs&list=' 'PL525f8ds9RvsXDl44X6Wwh9t3fCzFNApw', ) expected = [ 'https://www.youtube.com/watch?v=m5q2GCsteQs', 'https://www.youtube.com/watch?v=5YK63cXyJ2Q', 'https://www.youtube.com/watch?v=Rzt4rUPFYD4', ] ob.populate_video_urls() assert ob.video_urls == expected
def download_originals(playlist_url, save_path): playlist = Playlist(playlist_url) counter = 1 seen = 0 for url in playlist: if seen == 0: YouTube(url).streams.first().download(save_path, filename_prefix=str(counter) + ' ' + seen + ' ') print(counter) seen = 1 else: YouTube(url).streams.first().download(save_path, filename_prefix=str(counter) + ' ' + seen + ' ') print(counter) seen = 0 counter += 1 for file in os.listdir(save_path): if re.search('mp4', file): mp4_path = os.path.join(save_path, file) mp3_path = os.path.join(save_path, os.path.splitext(file)[0]+'.mp3') new_file = mp.AudioFileClip(mp4_path) new_file.write_audiofile(mp3_path) os.remove(mp4_path)
def download_from_playlist(): arguments = command_args.parse_download_arguments() try: playlist = Playlist(arguments.url) video_urls = playlist.video_urls if len(video_urls) == 0: raise exceptions.EmptyPlaylistException() download(video_urls) except exceptions.EmptyPlaylistException as exception: exception.show_message() return except PytubeRegexMatchError: exceptions.InvalidPlaylistURLError().show_message() except KeyboardInterrupt: pass except Exception as exception: exceptions.UnspecifiedError().show_message() raise exception
def download_audio(directory, url): if not os.path.exists(directory): os.makedirs(directory) print('Playlist URL: ', url) os.chdir(directory) playlist = Playlist(url) print('Number of videos in playlist: %s' % len(playlist.video_urls)) for vid in playlist.videos: first = vid.streams.first() basename = os.path.splitext(first.default_filename)[0] first.download(output_path=directory) mp4 = "'%s'.mp4" % basename mp3 = "'%s'.mp3" % basename print('Url: ', first.url) print('Filename: ', basename) print('Mp4 Filename: ', mp4) print('Mp3 Filename: ', mp3) ffmpeg = ('ffmpeg -i %s ' % mp4 + mp3) subprocess.call(ffmpeg, shell=True) time.sleep(1)
def insert_url_pl(): print("Cual es la URL a descargar: ", end="") url=input() save_url_pl(url) # Guarda la URL en la variable global global pl # Importa la variable que almacena la URL del video como srt print("Leyendo URL...") try: # Comprueba que al realizar el polimorfismo no salte error pl_main=Playlist(pl) # Hace un polimorfismo y cambia yt de srt a la clase YouTube except: # En caso de saltar se volvera al menu pl='' print("ERROR: LA URL INTRODUCIDA NO ES VALIDA") print("Pulsa cualquier tecla para continuar") input() borrarPantalla() main() # Si no salta ningun error se leera el codigo debajo de este comentario. print("¿Es esta la playlist que has seleccionado?") print(pl_main.title) # Imprime el titulo del video print("[S/N]", end="") opcion=input() if opcion=='S' or opcion=='s': # La URL ya se ha guardado y vuelves al menu principal borrarPantalla() print("Pulsa cualquier tecla para continuar") input() borrarPantalla() main2() elif opcion=='N' or opcion=='n': # En caso de que se hayan equivocado en la URL, borra la anterior y vuelve a ejecutar lo de introducir la URL borrarPantalla() pl='' # Borra la URL introducida anteriormente print("Vuelve a introducir la URL") insert_url_pl() else: # En caso de introducir una opcion no contemplada vuelve al menu principal borrarPantalla() print("ERROR: Valor introducido erroneo") pl='' # Borra la URL introducida anteriormente print("Pulsa cualquier tecla para continuar") input() borrarPantalla() main2()
def checkListLink(object_, link): if str(type(object_)) == "<class 'telebot.types.CallbackQuery'>": message_id = object_.message.id chat_id = object_.message.chat.id else: chat_id = object_.chat.id message_id = object_.id user_id = object_.from_user.id try: yt = Playlist(link) markup = types.InlineKeyboardMarkup() vidCount = len(yt.video_urls) numbers = divide(number=vidCount, amount=5 if vidCount > 100 else 4) for idx in range(len(numbers) - 1): if idx % 2 == 0: markup.add( types.InlineKeyboardButton( text=f"{numbers[idx] if numbers[idx] != 0 else 1}.", callback_data= f"PL {numbers[idx] if numbers[idx] != 0 else 1} {user_id} {yt.playlist_id}" ), types.InlineKeyboardButton( text=f"{numbers[idx+1] if numbers[idx+1] != 0 else 1}.", callback_data= f"PL {numbers[idx+1] if numbers[idx+1] != 0 else 1} {user_id} {yt.playlist_id}" )) #lt = list else: pass bot.send_message( chat_id=chat_id, text= f"- اسم القائمة {yt.title}\n- عدد الفيديوهات {vidCount}\n\nكم عنصر تريد تنزيله من القائمة ؟ 📥\n", reply_markup=markup, parse_mode='HTML') except Exception as e: bot.send_message(chat_id=chat_id, text=" رابط قائمة التشغيل لايعمل❗️", reply_to_message_id=message_id)
def Download(self): self.Update_Download_Status() link = self.video_link.get() download_folder = self.download_path.get() if "list" in link: playlist = Playlist(link) thread = threading.Thread(target=self.Download_Playlist, args=( playlist, download_folder, )) thread.daemon = 1 thread.start() else: thread = threading.Thread(target=self.Download_Single, args=( link, download_folder, )) thread.daemon = 1 thread.start()
def playlistDownload(llink, output): print('llink') print('Accessing Youtube URL...') try: pl = Playlist(llink) print('Downloading...') if (output is None): pl.download_all() else: print('Your file will save to:', output) pl.download_all(output) delete_last_line() print('Completed') except: print( "ERROR. Check your:\n -connection\n -url is a YouTube url\n\nTry again." )
def get_list(link,path,text_obb): text_obb.insert(END,"starting....\n") text_obb.see(END) path_ = make_folder() path_ = os.path.join(path_,path) try: os.mkdir(path_) except: text_obb.insert(END,str(path_)+" is allready exists\n") text_obb.see(END) try: list_ = Playlist(link).video_urls # print(list_) text_obb.insert(END,str(len(list_))+" videos in this list.\n") text_obb.see(END) except: text_obb.insert(END,"[*]invalide link\n") text_obb.see(END) text_obb.insert(END,"\nDownloading path : %s\n"%(str(path_))) text_obb.see(END) for video in list_: try: # text_obb.insert(END,str(video)+"\n") # text_obb.see(END) opened_video = YouTube(video) load_video = opened_video.streams.first() file_size = str(int((load_video.filesize/1000)/1000)) text_obb.insert(END,str(opened_video.title)+" downloading...\n") text_obb.see(END) load_video.download(path_) text_obb.insert(END,"Done..\n") text_obb.see(END) except: text_obb.insert(END,"con't open this link"+str(video)+"\n") text_obb.see(END)
def download(what, url): if what == 'video': i = 0 print('Getting the video...') yt = YouTube(url) print('Done!\n') print('Please choose one of the available streams:\n') while i < len(yt.streams): print(str(i + 1) + '- ' + str(yt.streams[i])) i = i + 1 choice = input() print('Downloading...') yt.streams[int(choice) - 1].download() print('Download complete!') elif what == 'playlist': i = 0 print('Getting the playlist...') playlist = Playlist(url) print('Done!\n') first_video = YouTube(playlist[0]) print('Please choose one of the available streams:\n') while i < len(first_video.streams): print(str(i + 1) + '- ' + str(first_video.streams[i])) i = i + 1 choice = input() print('Downloading...') try: iterrer = 0 while iterrer < len(playlist): playlist[iterrer].streams[int(choice) - 1].download() except Exception as e: print(e)
def a_dl_pl(): global pl # Importa la variable que almacena la URL del video como srt if pl!='': # Comprueba que antes se haya introducido una URL i=1 print("Leyendo URLs...") pl_main=Playlist(pl) # Hace el polimorfismo carpeta_pl(pl_main.title) print("Descargando audios...") for yt in pl_main: yt_main=YouTube(yt) dl_audio(yt_main, True, i) # Llama a la funcion encargada de decargar el audio i+=1 print("Audios descargado con exito") print("Pulsa cualquier tecla para continuar") input() borrarPantalla() main2() # Vuelve al menu principal else: print("ERROR: Introduce antes una URL") print("Pulsa cualquier tecla para continuar") input() borrarPantalla() main2() # Vuelve al menu principal
def play_dwon(): play_url = input("please enter the playlist link: ") playlist = Playlist(play_url) print("*****************") print(f"{playlist.title}:") for tit in playlist.video_urls: print(tit) print("*****************") print("Downloading the playlist with the highest quality") print("*****************") # downloading path if not os.path.exists('playlist'): os.makedirs('playlist') try: # extract the playlist to videos and then download the videos for url in playlist.video_urls: url = YouTube(url) url.streams.filter( res="720p").first().download(f'{path}/playlist/') print("finish!") loop() except: print("download failed!")
def playlistDownload(self): try: playlist = Playlist(self.link) print('Number of videos in playlist: %s' % len(playlist.video_urls)) # downloading everything as a video if self.type == 'video': for i in playlist.video_urls: try: yt = YouTube(i) print("Video downloading : " + yt.title) self.print_info(yt) result_video = yt.streams.get_highest_resolution() result_video.download() # print(i) except: print("Some Error!") return 0 return 1 # downloading everything as a audio. if self.type == 'audio': for i in playlist.video_urls: try: yt = YouTube(i) print("Video downloading : " + yt.title) self.print_info(yt) result_video = yt.streams.get_audio_only() result_video.download() # print(i) except: print("Some Error!") return 0 return 1 except: print('Connection Error') return 0
def Playlist_Download(self): playlist_url = self.lineEdit_12.text() save_location = self.lineEdit_11.text() if playlist_url == "" or save_location == "": QMessageBox.warning( self, "Data Error", "Provide a valid Playlist URL or save location") else: playlist_video = Playlist(playlist_url) videos_number = len(playlist_video.video_urls) self.lcdNumber.display(videos_number) os.chdir(save_location) if os.path.exists(playlist_video.title): os.chdir(playlist_video.title) else: os.mkdir(playlist_video.title) os.chdir(playlist_video.title) current_video_downloaded = 1 QApplication.processEvents() for video in playlist_video.videos: self.lcdNumber_2.display(current_video_downloaded) video.register_on_progress_callback(self.Playlist_progress) video.streams.get_lowest_resolution().download() QApplication.processEvents() current_video_downloaded += 1 QMessageBox.information(self, "Download Completed", "The video download finished") self.progressBar_6.setValue(int(0)) self.lcdNumber.display(int(0)) self.lcdNumber_2.display(int(0)) self.lineEdit_12.setText('') self.lineEdit_11.setText('')
def on_switch1_notify(self, switch, gparam): music_path = os.environ["HOME"] music_path = music_path + "/Music" print(music_path) if switch.get_active(): self.label1.set_text("Recording Started") if len(self.textbox.get_text()) != 0: # mp3file = self.textbox.get_text() # fileData = pafy.new(mp3file) # audio = fileData.audiostreams # audio[2].download() # get the sub URL's from the playlist URL = self.textbox.get_text() playlist = Playlist(URL) for video_url in playlist.video_urls: print(video_url) video = pafy.new(video_url) bestaudio = video.getbestaudio(preftype="m4a", ftypestrict="True") print("Video title is :" + video.title) print("Video Duration is :" + video.duration) print("audio quality :" + bestaudio.bitrate) bestaudio.download(filepath="mp3") print("download") # skip.skipper() else: self.label1.set_text("enter url") else: print("Stop") self.label1.set_text("Recording Stopped") subprocess.call(["pkill", "parec"])
def fetch(self, link, identifier, is_playlist=False): try: from django.db import connection connection.close() self.link = link self.is_playlist = is_playlist if is_playlist: self.playlist = Playlist(self.link) self.videos = [] for v in self.playlist: self.videos += [Video(v)] try: record = VModel.objects.get(identifier=identifier) record.downloader = self.toBinary() except BaseException as b: print('Fetch', b) record = VModel(identifier=identifier, downloader=self.toBinary(), done=False) record.save() record = VModel.objects.get(identifier=identifier) record.done = True record.save() else: self.videos = [Video(self.link)] record = VModel(identifier=identifier, downloader=self.toBinary(), done=True) record.save() except BaseException as ex: record = VModel(identifier=identifier, done=True) record.save() print('FetchBaseEx:', ex)
def downloadplaylist(urlplaylist: str, path: str) -> str: """ download videos from a playlist :param urlplaylist: :param path: :return: """ playlist = Playlist(urlplaylist) if len(playlist) > 0: if Path(path).exists(): try: for url in playlist: yt = YouTube(url) video = yt.streams.first() print('Title: ' + video.title) localpath = video.download(path) print(localpath) return path except: return 'Error: check the url unknown' else: return 'Error: Path not exists' else: return 'Error: no video was listed in the playlist'
def playlistDownload(llink, output): print() print(llink) print('Accessing Youtube URL...') try: pl = Playlist(llink) print('Downloading...') if (output is None): pl.download_all() else: print('Your file will save to:', output) pl.download_all(output) delete_last_line() print('Completed') except: print( "ERROR. Check your:\n -connection\n -url is a YouTube url\n" + " -add '' to playlist link, example: python yt.py -l 'youtube playlist link'\n" + " -check your location if you add -o, sometime it's different between systems: Mac, Windows, Linux\n" + "\nTry again.")
# -*- coding: utf-8 -*- """ Created on Fri May 21 19:51:54 2021 @author: Lachlan """ from pytube import YouTube from pytube import Playlist import ffmpeg playlist = Playlist("https://www.youtube.com/playlist?list=PLgqwWmjSsNRzDOAmtyRc9K3fO-VMpE07C").video_urls flip = False for video_link in playlist: if (flip): continue #flip = True print(video_link) print("\n") try: # YouTube(video_link).streams.filter(progressive=True, mime_type="video/mp4").order_by('resolution').desc().first().download() print(YouTube(video_link).streams.filter(progressive=True, mime_type="video/mp4").order_by('resolution')) print(YouTube(video_link).streams.filter(progressive=True, mime_type="video/mp4").order_by('resolution').desc()) print(YouTube(video_link).streams.filter(progressive=True, mime_type="video/mp4").order_by('resolution').desc().first()) # YouTube(video_link).streams.first().download() # video_file = YouTube(video_link).streams.filter(mime_type="video/mp4").order_by('resolution').desc().first().download() # video_file = YouTube(video_link).streams.order_by('resolution').desc().first().download() # print(video_file) # print(YouTube(video_link)) # print("\n")
import secret from pytube import Playlist import os driver = Chrome("./chromedriver") driver.get("https://www.youtube.com/view_all_playlists") # 輸入帳號 (driver.find_element_by_id("identifierId").send_keys("*****@*****.**")) driver.find_element_by_id("identifierNext").click() # 輸入密碼 time.sleep(3) (driver.find_element_by_class_name("whsOnd").send_keys(secret.pwd)) driver.find_element_by_id("passwordNext").click() # 取得播放清單 time.sleep(5) playlists = driver.find_elements_by_class_name("vm-video-title-text") # 紙條: .text # (bs) ["href'"] -> get_attribute("href") for p in playlists: print(p.text) print(p.get_attribute("href")) try: pl = Playlist(p.get_attribute("href"), suppress_exception=True) #suppress_exception=True略過已移除影片 dn = "youtube/" + p.text if not os.path.exists(dn): os.makedirs(dn) pl.download_all(dn) except: print("放棄這播放清單")
if len(urls_bruto) == 0: print( "No hay videos para descargar en el fichero \"1 - Pega aqui videos a descargar.txt\"\nPega en el fichero los videos a descargar" ) messagebox.showinfo( message="No hay videos para descargar en el fichero", title="Fichero vacio") sys.exit(0) #root.destroy() for url in urls_bruto: es_playlist = False #Comprobamos si nos pasan una URL de video o de Playlist try: pl = Playlist(url) #En caso de exito añadimos cada URL a la lista de URL if len(pl) > 0: es_playlist = True except KeyError: print("Importamos videos") if es_playlist == True: for video in pl: lista_url.append(video) else: lista_url.append(url) run(lista_url)
def test_last_update(request_get, playlist_html): expected = datetime.date(2019, 3, 7) request_get.return_value = playlist_html playlist = Playlist("url") assert playlist.last_update == expected
def test_init_with_playlist_url(request_get): request_get.return_value = "" url = "https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ-ghgoSH6n" playlist = Playlist(url) assert playlist.playlist_url == url
def test_download(): ob = Playlist( 'https://www.youtube.com/watch?v=lByG_AgKS9k&list=' 'PL525f8ds9RvuerPZ3bZygmNiYw2sP4BDk', ) ob.download_all()
What do you want? (1) Download YouTube Videos manually (2) Download a YouTube Playlist (3) Download YouTube Videos and Convert Into MP3 I am not responsible for your downloads! Go at your own risk! Copyright (c) NeuralNine 2019 ''') choice = input("Choice: ") if choice == '2': link = input("Enter the link of the playlist: ") playlist = Playlist(link) print("Downloading Playlist...") playlist.download_all() print("DOWNLOAD DONE!") elif choice == '1' or choice == '3': print("Enter the links of the videos (end by entering 'STOP'):") links = [] link = "" while link != "STOP": link = input() links.append(link) links.pop()
last_url = "" while True: win32clipboard.OpenClipboard() url = win32clipboard.GetClipboardData() win32clipboard.CloseClipboard() if url and last_url != url: if url.startswith("https://www.youtube.com/watch?v"): if "list" not in url: print("Video detected, downloading...") YouTube(url).streams.get_highest_resolution().download(OUTPUT_FOLDER) print("Video downloaded") print("#########################################################") else: print("Playlist detected, downloading...") playlist = Playlist(url) for i in range(len(playlist)): print("downloading video number {}, {} more to go".format(i + 1, len(playlist) - (i + 1))) try: YouTube(playlist[i]).streams.get_highest_resolution().download(OUTPUT_FOLDER) except: print("This video is not available, skipping...: {0}".format(playlist[i])) print("Playlist descargada") print("#########################################################") last_url = url time.sleep(0.1)
from pytube import Playlist n = input("ENTER PLAYLIST LINK\n") pl = Playlist(n) pl.download_all()
def main(): here = False only_audio = True show = False if len(sys.argv) == 1: link = input("YouTube link: ") only_audio = True if input( "Download as audio? (y,n): ").strip().lower() == "y" else False else: link = sys.argv[1] only_audio = "-vid" not in sys.argv: here = "-here" in sys.argv: show = "-show" in sys.argv: # select where to put downloaded files downloaded_videos_folder = "Downloaded Videos" downloaded_audios_folder = "Downloaded Audios" if here: os.chdir(FILE_DIR) # check to make folders in default folder if not os.path.exists(downloaded_videos_folder): os.makedirs(downloaded_videos_folder) if not os.path.exists(downloaded_audios_folder): os.makedirs(downloaded_audios_folder) elif only_audio: os.chdir(os.path.join(FILE_DIR, downloaded_audios_folder)) else: os.chdir(os.path.join(FILE_DIR, downloaded_videos_folder)) # link to video/playlist or title of a video downloaded = False if "youtube.com/watch?v=" in link or "youtu.be/" in link: print_where_to_download() download_video_from_url(link) downloaded = True elif "playlist?list=" in link: playlist = Playlist(link) try: download_playlist_from_urls( playlist.video_urls, only_audio=only_audio) # the problem is at Playlist.video_urls # maybe some videos are removed but still shown in playlist except HTTPError: # time to use good old method of parsing html lmao headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/87.0.4280.66 Safari/537.36" } import requests r = requests.get(link, headers=headers) vid_ids = set([each.split('"')[0] for each in r.text.split( '"videoId":"')][1:-3]) # 3 duplicates of each id download_playlist_from_urls( list(map(lambda id: f"https://youtu.be/{id}", vid_ids))) downloaded = True else: results = VideosSearch(link).result()['result'] try: print("ctrl + c to cancel.") for r in results: if 'y' in input(f"{r['title']}, {r['duration']}\n(y,n)?: "): print_where_to_download() download_video_from_url(r['link'], only_audio=only_audio) downloaded = True break else: print("No more result.") except KeyboardInterrupt: exit(0) if downloaded: # ask wether to show in file explorer if show: explore(os.getcwd()) else: if "y" in input("Show in File Explorer? (y,n): ").strip().lower(): explore(os.getcwd())
def doDownload(self): playlistUrl = self.getPlaylistUrlFromClipboard() if playlistUrl == None: self.displayError('Playlist URL not in clipboard. Program closed.') return playlist = None try: playlist = Playlist(playlistUrl) playlist._video_regex = re.compile(r"\"url\":\"(/watch\?v=[\w-]*)") except KeyError as e: self.displayError('Playlist URL not in clipboard. Program closed.') return except http.client.InvalidURL as e: self.displayError(str(e)) return playlistTitle = playlist.title() if 'Oops' in playlistTitle: self.displayError( 'The URL obtained from clipboard is not pointing to a playlist. Program closed.' ) return playlistName, timeInfo = self.splitPlayListTitle(playlistTitle) targetAudioDir = AUDIO_DIR + DIR_SEP + playlistName if not os.path.isdir(targetAudioDir): targetAudioDirList = targetAudioDir.split(DIR_SEP) targetAudioDirShort = DIR_SEP.join(targetAudioDirList[-2:]) if self.getConfirmation( "Directory\n{}\nwill be created.\n\nContinue with download ?" .format(targetAudioDirShort)) != 'yes': return os.makedirs(targetAudioDir) for video in playlist.videos: audioStream = video.streams.get_by_itag(YOUTUBE_STREAM_AUDIO) videoTitle = video.title self.msgText = self.msgText + 'downloading ' + videoTitle + '\n' self.msg.configure(text=self.msgText) self.root.update() audioStream.download(output_path=targetAudioDir) for file in [ n for n in os.listdir(targetAudioDir) if re.search('mp4', n) ]: mp4FilePathName = os.path.join(targetAudioDir, file) mp3FilePathName = os.path.join(targetAudioDir, os.path.splitext(file)[0] + '.mp3') if timeInfo: timeStartSec, timeEndSec = self.splitTimeInfo(timeInfo) import moviepy.editor as mp # not working on Android clip = mp.AudioFileClip(mp4FilePathName).subclip( timeStartSec, timeEndSec) # disable if do not want any clipping clip.write_audiofile(mp3FilePathName) clip.close() os.remove(mp4FilePathName) else: if os.path.isfile(mp3FilePathName): os.remove(mp3FilePathName) os.rename(mp4FilePathName, mp3FilePathName)
from pytube import Playlist playlist = Playlist( 'https://www.youtube.com/playlist?list=PL3pGy4HtqwD02GVgM96-V0sq4_DSinqvf') print('Number of videos in playlist: %s' % len(playlist.video_urls)) playlist.download_all()
start = time.time() #Test URL Daft Punkt |Discover: https://www.youtube.com/playlist?list=PLSdoVPM5WnndLX6Ngmb8wktMF61dJirKl #get Input print("Post your URL here: ") in_playlistURL = input() print("Choose Path: ") in_path = "C:\Temp" print("Artist: ") in_artist = input() print("Album: ") in_album = input() #Get Playlist List playlist = Playlist(in_playlistURL) in_urls = playlist.video_urls class PlayListDownlaod: def __init__(self, url, path, artist, album): self.url = url self.path = path self.artist = artist self.album = album async def downloadVideo(self): # Get Video var_video = YouTube(self.url) time.sleep(0.05)
def test_proxy(install_proxy, request_get): url = "https://www.fakeurl.com/playlist?list=whatever" request_get.return_value = "" Playlist(url, proxies={"http": "things"}) install_proxy.assert_called_with({"http": "things"})