Spaces:
Sleeping
Sleeping
Create imdb
Browse files- utils/imdb +18 -0
utils/imdb
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from imdb import IMDb
|
2 |
+
|
3 |
+
ia = IMDb()
|
4 |
+
|
5 |
+
def search_imdb(title):
|
6 |
+
results = ia.search_movie(title)
|
7 |
+
if not results:
|
8 |
+
return "No results found"
|
9 |
+
|
10 |
+
top = results[0]
|
11 |
+
ia.update(top)
|
12 |
+
return {
|
13 |
+
"Title": top.get("title"),
|
14 |
+
"Year": top.get("year"),
|
15 |
+
"Rating": top.get("rating"),
|
16 |
+
"Genres": top.get("genres"),
|
17 |
+
"Plot": top.get("plot")[0] if top.get("plot") else "No plot available"
|
18 |
+
}
|