Change download location to “Downloads” in Pytube in Python

Tags: , , , ,



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

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')



Source: stackoverflow