in pafy i got that error " best.resolution, best.extension(res, format) TypeError: 'str' object is not callable"

Viewed 57
from pafy import *
url = str(input("Videonun Youtube linkini girin"))
video = pafy.new(url)
streams = video.streams
for s in streams:
    print(s.resolution, s.extension, s.get_filesize(), s.url)

format = input("indirilecek turu seçin")
res = input("lutfen sectiginiz ture uygun cozunurluk yazın")

best = video.getbest(preftype=format)
best.resolution, best.extension(res, format)

konum = str(input("indirilecek yeri seçin"))
best.download(quiet=False,filepath=konum)

i want to do a youtube installer but i got that error and i want to get input from user for resolution, file format and download path

1 Answers

stream.extension is not a method, it's an attribute which holds a string and it specifies the extension of the file associated with the stream object. If you want to change the resolution/extension, choose another stream or download the file as is and convert it with something like ffmpeg.

Related