@bot.message_handler(content_types='text')
def send_echo(message):
urldl = '
https://www.youtube.com /watch?v=HNuSD49chY8'
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([urldl])
p = get_video_info(urldl)
newurl = urldl[32:]
file = p + "-" + newurl + '.mp3'
print(file)
file_open = open(file, 'rb')
bot.send_document(
message.chat.id, file)
bot.polling(none_stop=True)