I have a list of YouTube links that I'd like to download just the sound file (a list of albums, that I'm going to then turn into .wav files to analyze). I've been using Pytube, but it's very slow and I'm hoping to find a way to possibly compress the file before it actually downloads or processes so it can provide the file faster. Code I'm using is below:
from pytube import YouTube
import time
t1 = time.time()
myAudioStream = YouTube("https://www.youtube.com/watch?v=U_SLL3-NEMM").streams.last()
t2 = time.time()
print(t2-t1)
myAudioStream.download("C:\\Users\\MyUser\\Python Projects\\AlbumFiles\\")
t3 = time.time()
print(t3-t2)
The link in there currently is just a song, since I wanted to get an idea of how long it'd take, and it still takes about 200 seconds. If I want to download something 4-8x larger, it will probably be quite awhile before it finishes. Is there something I can do when processing this data to speed this up?