Here's the code:
from __future__ import unicode_literals
import youtube_dl
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])
I pretty much copied this from download only audio from youtube video using youtube-dl in python script. The error that is coming up is:
AttributeError: module 'youtube_dl' has no attribute 'YoutubeDL'
I did lots of research but is seems youtube_dl is a pretty uncommon module. Essentially, it can get a ton of data off of youtube. The code I had was supposed to successfully grab audio from a youtube link of my desire. However, that same error always comes up. I ran it on python 2.7.13 and 3.6.3 - the same outcome on both. It seemed to have worked for otthers, and there was another thread about this here Can someone tell me what is causing the error so I can move onward with this project?