Search code examples
pythonpafy

{Pafy Problem} How can i change video name in pafy


I want to know how to change the name of the downloaded video or add to it

import pafy
url = str(input("Youtube video URL :"))
video = pafy.new(url)
stream = video.streams
stream[0].download()

Solution

  • In stream[0].download(), add a string argument with your desired filename and extension, for example stream[0].download("example.mp4").

    See the docs for more info.