Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do
- local function imdb(movie)
- local http = require("socket.http")
- local movie = movie:gsub(' ', '+')
- local url = "http://www.imdbapi.com/?t=" .. movie
- local response, code, headers = http.request(url)
- if code ~= 200 then
- return "Error: " .. code
- end
- if #response > 0 then
- local r = json:decode(response)
- r['Url'] = "http://imdb.com/title/" .. r.imdbID
- local text = "Title: "..r.Title.."\nRating: "..r.imdbRating.."\nPlot: "..r.Plot.."\nURL: "..r.Url
- return text
- end
- return nil
- end
- local function run(msg, matches)
- return imdb(matches[1])
- end
- return {
- description = "IMDB plugin for telegram",
- usage = "!imdb [movie]",
- patterns = {"^!imdb (.+)"},
- run = run
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement