Closed JesperDramsch closed 4 years ago
The recursive insertion of videos does have the benefit you suggest.
One thing to note is that this doesn't bypass the 200 video limit. This limit comes from the fact that the quota cost to insert a video is 50 units, and the max quota limit is 10000 (without any quota audits), so trying to insert more than 200 videos will cause an API quota error. This check shouldn't be removed from the addVideosToPlaylist
function.
The original implementation uses
sleep(1000)
to avoid rate limiting during the video insertion into the playlist. While we can reduce this number (100 still worked fine for me) to get more videos in, we can use recursion to let the API "take the time it needs" and then insert the next video. This is the fastest execution time possible and leaves us with possibilities to extend the code dynamically.