diff --git a/plugins/youtube_dl.lua b/plugins/youtube_dl.lua index ea57ed9..c74c635 100644 --- a/plugins/youtube_dl.lua +++ b/plugins/youtube_dl.lua @@ -1,7 +1,7 @@ -- Requires: sudo apt-get install youtube-dl -- See https://github.com/rg3/youtube-dl/blob/master/README.md#options function run(msg, matches) - URL = matches[1] + local URL = matches[1] local receiver = get_receiver(msg) if string.match(msg.text, '"') then @@ -10,13 +10,11 @@ function run(msg, matches) if string.match(msg.text, "/mp4") then text = run_bash('youtube-dl -o "tmp/%(title)s.%(ext)s" '..URL) - video = string.match(text, 'Merging formats into "tmp/(.*)"') + video = string.match(text, '%[download%] Destination: tmp/(.*).mp4') if not video then file = string.match(text, '%[download%] (.*) has already been downloaded') - --else - --file = string.match(text, '%[download%] Destination: (.*).flv') else - file = 'tmp/'..video + file = 'tmp/'..video..'.mp4' end send_video(get_receiver(msg), file, ok_cb, false) end