youtube_dl gefixt

This commit is contained in:
Akamaru 2016-02-14 21:02:55 +01:00
parent d6ae7ebf23
commit 1e283a0311
1 changed files with 3 additions and 5 deletions

View File

@ -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