2022-04-14 20:03:16 +01:00
|
|
|
from imdb_utils import IMDbUtils
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
from progress.bar import IncrementalBar
|
|
|
|
|
|
|
|
|
|
|
|
def get_hidden_themes(imdb_ids):
|
2022-04-15 17:09:56 +01:00
|
|
|
film_keywords = []
|
2022-04-14 20:03:16 +01:00
|
|
|
|
|
|
|
with IncrementalBar('Retrieving movie data', max=len(imdb_ids), suffix='%(percent).1f%% - %(eta)ds remaining', check_tty=False) as bar:
|
|
|
|
for imdb_id in imdb_ids:
|
|
|
|
movie_data = IMDbUtils.get_movie_keywords(imdb_id)
|
|
|
|
|
|
|
|
if 'keywords' in movie_data:
|
|
|
|
keywords = set(movie_data['keywords'])
|
2022-04-15 17:09:56 +01:00
|
|
|
film_keywords.append(keywords)
|
2022-04-14 20:03:16 +01:00
|
|
|
|
2022-04-21 23:51:18 +01:00
|
|
|
bar.next()
|
2022-04-14 20:03:16 +01:00
|
|
|
|
2022-04-15 17:09:56 +01:00
|
|
|
hidden_themes = set.intersection(*film_keywords)
|
|
|
|
|
2022-04-14 20:03:16 +01:00
|
|
|
return hidden_themes
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('imdb_ids', nargs="+", default=[])
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
hidden_themes = get_hidden_themes(args.imdb_ids)
|
|
|
|
|
|
|
|
print(hidden_themes)
|