From 2a03726c39ca7f723b78785ba545032e8e8eb5c3 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 14 Jan 2018 18:33:59 +0100 Subject: [PATCH] fix countries --- ox/web/imdb.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ox/web/imdb.py b/ox/web/imdb.py index b63dc69..9e4ed6e 100644 --- a/ox/web/imdb.py +++ b/ox/web/imdb.py @@ -289,6 +289,11 @@ class Imdb(SiteParser): isinstance(self['alternativeTitles'][0], string_types): self['alternativeTitles'] = [self['alternativeTitles']] + for key in ('country', 'genre'): + if key in self: + self[key] = [x[0] if len(x) == 1 and isinstance(x, list) else x for x in self[key]] + self[key] = list(filter(lambda x: x.lower() != 'home', self[key])) + #normalize country names if 'country' in self: self['country'] = [normalize_country_name(c) or c for c in self['country']] @@ -372,9 +377,6 @@ class Imdb(SiteParser): self['connections'] = cc - for key in ('country', 'genre'): - if key in self: - self[key] = list(filter(lambda x: x.lower() != 'home', self[key])) if 'isSeries' in self: del self['isSeries'] self['isSeries'] = True