0

I have a code that downloads video with python pafy module

At default it downloads the video in where my .py file is. But I want the Windows Downloads Folder as the destination of the downloaded video. How can I do it? Thanks in Advance

import pafy

url = "video_url"
video = pafy.new(url)

#all streams
streams = video.streams

#best video
best = video.getbest()

#download
try:
    best.download()
except Exception as e:
    print ("Error Downloading video")
else:
    print ("Video Downloaded Successfully")

1 Answers1

2

Based on the comments.

Initially I thought that you wanted to change the current directory in your machine. Hence, I referenced this question where we can read answers like this one which states that the desired operation can be achieved with

import os

os.chdir(path)

OFC in your particular case you'd want to change the path right before downloading the file.

Since you added more clarification with

What if I want to make it an app and in others computer how can I know there donwload directory folder?

that'd be a different scenario and there's an already existing question for that too with an already accepted answer.

Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145