Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 498
user9594573 Avatar asked Apr 04 '18 05:04

user9594573


2 Answers

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.

like image 185
Vallie Avatar answered Oct 31 '22 02:10

Vallie


from pytube import YouTube
yt = YouTube("Please copy and paste the video link here")
print(yt.title)
stream = yt.streams.first()
stream.download()
like image 42
M.A.A. SHOHAIL Avatar answered Oct 31 '22 01:10

M.A.A. SHOHAIL