Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # IMDb lookup plugin
- from util import hook, http
- def out(*args):
- d = args[0]
- s = ""
- if d["Title"] != "N/A":
- s += "\x02%(Title)s\x02 "
- if d["Year"] != "N/A":
- s += "(%(Year)s) "
- if d["Genre"] != "N/A":
- s += "(%(Genre)s): "
- if d["Plot"] != "N/A":
- s += "%(Plot)s "
- if d["Runtime"] != "N/A":
- s += "\x02%(Runtime)s\x02. "
- if d["Rating"] != "N/A" and d["Votes"] != "N/A":
- s += "\x02%(Rating)s/10\x02 with \x02%(Votes)s\x02 votes. "
- if d["URL"] != "N/A":
- s += "%(URL)s"
- return s % d
- @hook.command
- def imdb(inp):
- '''.imdb <movie> -- gets information about <movie> from IMDb'''
- content = http.get_json("http://www.imdbapi.com/", t=inp)
- if content['Response'] == 'Movie Not Found':
- return 'movie not found'
- elif content['Response'] == 'True':
- content['URL'] = 'http://www.imdb.com/title/%(ID)s' % content
- return out(content)
- else:
- return 'unknown error'
Add Comment
Please, Sign In to add comment