mirror of https://github.com/MISP/misp-modules
new: [imdb] First version to get IMDB score from a movie title
parent
882e17ae09
commit
4516e5595a
|
@ -54,6 +54,7 @@ httplib2==0.18.1
|
||||||
idna-ssl==1.1.0; python_version < '3.7'
|
idna-ssl==1.1.0; python_version < '3.7'
|
||||||
idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
|
idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
|
||||||
imapclient==2.1.0
|
imapclient==2.1.0
|
||||||
|
IMDbPY==2020.9.25
|
||||||
isodate==0.6.0
|
isodate==0.6.0
|
||||||
jbxapi==3.14.0
|
jbxapi==3.14.0
|
||||||
json-log-formatter==0.3.0
|
json-log-formatter==0.3.0
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
import json
|
||||||
|
import imdb
|
||||||
|
|
||||||
|
misperrors = {'error': 'Error'}
|
||||||
|
mispattributes = {'input': ['text'], 'output': ['text']}
|
||||||
|
|
||||||
|
# possible module-types: 'expansion', 'hover' or both
|
||||||
|
moduleinfo = {'version': '1', 'author': 'MISP',
|
||||||
|
'description': 'Get the IMDB score of the movie title',
|
||||||
|
'module-type': ['hover']}
|
||||||
|
|
||||||
|
# config fields that your code expects from the site admin
|
||||||
|
moduleconfig = []
|
||||||
|
|
||||||
|
ia = imdb.IMDb()
|
||||||
|
|
||||||
|
def handler(q=False):
|
||||||
|
if q is False:
|
||||||
|
return False
|
||||||
|
request = json.loads(q)
|
||||||
|
|
||||||
|
movieTitle = request['text']
|
||||||
|
movies = ia.search_movie(movieTitle)
|
||||||
|
movieID = movies[0].movieID
|
||||||
|
movie = ia.get_movie(movieID)
|
||||||
|
score = movie.get('rating', 'Could not retreive rating')
|
||||||
|
|
||||||
|
r = {'results': [{'types': 'text', 'values': score}]}
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
def introspection():
|
||||||
|
return mispattributes
|
||||||
|
|
||||||
|
|
||||||
|
def version():
|
||||||
|
moduleinfo['config'] = moduleconfig
|
||||||
|
return moduleinfo
|
Loading…
Reference in New Issue