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