This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot/plugins/youtube_mp3.lua

21 lines
783 B
Lua
Raw Normal View History

2015-06-26 14:04:21 +02:00
-- Requires: (sudo) apt-get install youtube-dl
2015-06-29 21:11:47 +02:00
-- See https://github.com/rg3/youtube-dl/blob/master/README.md#options
2015-06-26 14:04:21 +02:00
function run(msg, matches)
URL = matches[1]
local receiver = get_receiver(msg)
if string.match(msg.text, '"') then
return 'Vergiss es'
else
2015-06-29 21:11:47 +02:00
text = run_bash("youtube-dl -o tmp/sound.mp3 --audio-format mp3 --no-continue " .. URL)
2015-06-26 14:04:21 +02:00
send_audio(get_receiver(msg), "tmp/sound.mp3", ok_cb, false)
return URL .. ' wurde gedownloadet und wird jetzt gesendet! \nDas kann je nach Video sehr lang dauern! \nAlso habt Geduld!'
end
end
return {
2015-06-29 21:11:47 +02:00
description = "Downloadet und sendet die MP3 von einem YouTube-Video",
2015-06-26 14:04:21 +02:00
usage = {"/mp3 [Link]"},
patterns = {"^/mp3 (https?://[%w-_%.%?%.:/%+=&]+)$"},
run = run
}
--by Akamaru [https://ponywave.de]