From ba42811220b6d9dca192fe3da99f61d22aa88e45 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Thu, 21 May 2015 20:52:55 +0200 Subject: [PATCH] removed dmm.lua its crap --- plugins/dmm.lua | 57 ------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 plugins/dmm.lua diff --git a/plugins/dmm.lua b/plugins/dmm.lua deleted file mode 100644 index 2fbf7ab..0000000 --- a/plugins/dmm.lua +++ /dev/null @@ -1,57 +0,0 @@ -do - -function get_videos(html) - local videos = {} - for p in html:gmatch("

.-

") do - table.insert(videos, { - link = p:match("href=\"(.-)\""):gsub("?.*", ""), - img = p:match("src=\"(.-)\""):gsub("pt.jpg", "pl.jpg"), - title = p:match("alt=\"(.-)\""), - name = p:match("

(.*)"):gsub("<.->", ""):match("^%s*(.-)%s*$") - }) - end - return videos -end - -function get_dmm(rawid) - local label, num = string.match(rawid, "(%a+).-(%d+)") - local id = string.format("%s%05d", label:lower(), num) - local res, code = http.request("http://www.dmm.co.jp/search/=/searchstr="..id) - if code ~= 200 then return "HTTP ERROR" end - return get_videos(res)[1] -end - -function get_dmm_random() - local res, code = http.request("http://www.dmm.co.jp/digital/videoa/-/list/=/sort=ranking/") - if code ~= 200 then return "HTTP ERROR" end - local videos = get_videos(res) - return videos[math.random(1, #videos)] -end - -function send_title(cb_extra, success, result) - if success then - local message = cb_extra[2] .. "\n" .. cb_extra[3] .. "\n" ..cb_extra[4] - send_msg(cb_extra[1], message, ok_cb, false) - end -end - -function run(msg, matches) - local receiver = get_receiver(msg) - if matches[1] == "/dmm" then - video = get_dmm_random() - else - video = get_dmm(matches[1]) - end - file_path = download_to_file(video.img) - send_photo(receiver, file_path, send_title, {receiver, video.title, video.name, video.link}) - return false -end - -return { - description = "Sendet dmm Video Info", - usage = {"/dmm","/dmm (id)"}, - patterns = {"^/dmm$","^/dmm (.+)"}, - run = run -} - -end \ No newline at end of file