-
-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #925 from reverieeee/master
update movie.py to use omdbapi as imdbapi is non-functional
- Loading branch information
Showing
1 changed file
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
Copyright © 2012-2013, Elad Alfassa, <[email protected]> | ||
Licensed under the Eiffel Forum License 2. | ||
This module relies on imdbapi.com | ||
This module relies on omdbapi.com | ||
""" | ||
from __future__ import unicode_literals | ||
import json | ||
|
@@ -25,17 +25,17 @@ def movie(bot, trigger): | |
if not trigger.group(2): | ||
return | ||
word = trigger.group(2).rstrip() | ||
uri = "http://www.imdbapi.com/?t=" + word | ||
uri = "http://www.omdbapi.com/?t=" + word | ||
u = web.get(uri, 30) | ||
data = json.loads(u) # data is a Dict containing all the information we need | ||
if data['Response'] == 'False': | ||
if 'Error' in data: | ||
message = '[MOVIE] %s' % data['Error'] | ||
else: | ||
LOGGER.warning( | ||
'Got an error from the imdb api, search phrase was %s; data was %s', | ||
'Got an error from the OMDb api, search phrase was %s; data was %s', | ||
word, str(data)) | ||
message = '[MOVIE] Got an error from imdbapi' | ||
message = '[MOVIE] Got an error from OMDbapi' | ||
else: | ||
message = '[MOVIE] Title: ' + data['Title'] + \ | ||
' | Year: ' + data['Year'] + \ | ||
|