OMDBAPI now needs an api key

This commit is contained in:
jesopo 2018-07-02 11:09:02 +01:00
parent 685364d56d
commit 464510cd80
2 changed files with 8 additions and 2 deletions

View file

@ -16,5 +16,6 @@
"tfl-api-id" : "",
"tfl-api-key" : "",
"eagle-api-url" : "",
"eagle-api-key" : ""
"eagle-api-key" : "",
"omdbapi-api-key" : ""
}

View file

@ -1,3 +1,5 @@
#--require-config omdbapi-api-key
import json
import Utils
@ -7,13 +9,16 @@ URL_IMDBTITLE = "http://imdb.com/title/%s"
class Module(object):
_name = "IMDb"
def __init__(self, bot):
self.bot = bot
bot.events.on("received").on("command").on("imdb").hook(
self.imdb, min_args=1,
help="Search for a given title on IMDb",
usage="<movie/tv title>")
def imdb(self, event):
page = Utils.get_url(URL_OMDB, get_params={"t": event["args"]},
page = Utils.get_url(URL_OMDB, get_params={
"t": event["args"],
"apikey": self.bot.config["omdbapi-api-key"]},
json=True)
if page:
if "Title" in page: