Skip to content
Advertisement

Change download location to “Downloads” in Pytube in Python

I want to change the download location to “Downloads” in pytube in Python. Can anyone tell me how to do this? Thanks in advance:)

Advertisement

Answer

Hope this helps:

from pytube import YouTube

youtube = YouTube('https://www.youtube.com/watch?v=5m8BAffnuA8&list=PLTgRMOcmRb3PQEztkPnMvAeehReJPoSNP')

my_video = youtube.streams.first()

my_video.download('~/Downloads')

Advertisement