-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
29 lines (27 loc) · 1.11 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from imdb import IMDb
# https://github.com/alberanid/imdbpy/blob/master/docs/usage/query.rst
# requires [console] pip install imdbpy
# https://github.com/hardikvasa/google-images-download#examples
# requires [console] pip install google_images_download
from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
moviename='I Robot 2004'
output="images/"+moviename
ia = IMDb()
data=ia.search_movie(moviename)
if data:
movieId= data[0].movieID
movie=ia.get_movie(movieId)
if movie:
cast=movie.get('cast')
limit=5
for index, actor in zip(range(limit), cast):
a=str(actor['name'])
a=a.replace("å","a").replace("ú","u").replace("á","a")
print(index, a)
keys=''+a+' '+moviename
#millora de busqueda
print(keys)
arguments = {"keywords": keys,"limit":10,"print_urls":True,"output_directory": output,"image_directory":a}
paths = response.download(arguments)
print(paths)