37 lines
731 B
Python
37 lines
731 B
Python
from __future__ import unicode_literals
|
|
import sys
|
|
#import youtube_dl
|
|
|
|
|
|
print(sys.version)
|
|
|
|
|
|
class MyLogger(object):
|
|
def debug(self, msg):
|
|
pass
|
|
|
|
def warning(self, msg):
|
|
pass
|
|
|
|
def error(self, msg):
|
|
print(msg)
|
|
|
|
|
|
def my_hook(d):
|
|
if d['status'] == 'finished':
|
|
print('Done downloading, now converting ...')
|
|
|
|
|
|
ydl_opts = {
|
|
'format': 'bestaudio/best',
|
|
'postprocessors': [{
|
|
'key': 'FFmpegExtractAudio',
|
|
'preferredcodec': 'mp3',
|
|
'preferredquality': '192',
|
|
}],
|
|
'logger': MyLogger(),
|
|
'progress_hooks': [my_hook],
|
|
}
|
|
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
|
ydl.download(["https://youtu.be/i8q8fFs3kTM?list=PLlqZM4covn1GeiFmvbi8YppviPVUH2Q_9"])
|