From cc64c13884906cb6cb8eb17062627e3189c3e8cc Mon Sep 17 00:00:00 2001 From: Akamaru Date: Sun, 24 May 2015 18:23:30 +0200 Subject: [PATCH] new plugin youtube_dl --- .gitignore | 1 - plugins/youtube_dl.lua | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 plugins/youtube_dl.lua diff --git a/.gitignore b/.gitignore index b060723..b1797a0 100644 --- a/.gitignore +++ b/.gitignore @@ -40,5 +40,4 @@ plugins/youtube_playlist.lua plugins/yandere.lua plugins/e621.lua plugins/random.lua -plugins/youtube_dl.lua plugins/ponyfaces.lua \ No newline at end of file diff --git a/plugins/youtube_dl.lua b/plugins/youtube_dl.lua new file mode 100644 index 0000000..95c56f9 --- /dev/null +++ b/plugins/youtube_dl.lua @@ -0,0 +1,22 @@ +function run_bash(str) + local cmd = io.popen(str) + local result = cmd:read('*all') + cmd:close() + return result +end + +function run(msg, matches) + URL = matches[1] + local receiver = get_receiver(msg) + text = run_bash("youtube-dl -o tmp/video.mp4 " .. URL) + send_video(get_receiver(msg), "tmp/video.mp4", ok_cb, false) + return 'Video wird gesendet! \nDas kann je nach Video bis zu 10 Minuten dauern!' +end + +return { + description = "Downloadet und sendet ein YouTube-Video", + usage = {"/ydl"}, + patterns = {"^/ydl (.*)$"}, + run = run +} +--by Akamaru [https://ponywave.de] \ No newline at end of file