AttributeError: 'YouTube' object has no attribute 'get_videos'

user9594573 picture user9594573 · Apr 4, 2018 · Viewed 10.6k times · Source

While trying to download a YouTube video from python, I come across this error AttributeError: 'YouTube' object has no attribute 'get_videos'.

Last line causes the error.

import pytube

link = ""
yt = pytube.YouTube(link)
videos = yt.get_videos()

Thanks!

Answer

Vallie picture Vallie · Apr 4, 2018
import pytube
link = "https://www.youtube.com/watch?v=mpjREfvZiDs"
yt = pytube.YouTube(link)
stream = yt.streams.first()
stream.download()

Try above code. Here and here similar code which does not work.