def parse(self): from kinopoisk.person import Person note = self.extract('note', to_str=True).split('...') role_name = None if len(note) > 1: role_name = re.sub(r'^(.*),( в титрах не указан.?| озвучка)?$', r'\1', self.prepare_str(note[1])) self.instance.name = role_name self.instance.person = Person.get_parsed('cast_link', self.content) self.instance.set_source('role_link')
def parse(self): from kinopoisk.person import Person note = self.extract('note', to_str=True).split('...') role_name = None if len(note) > 1: role_name = re.sub(r'^(.*),( в титрах не указан.?| озвучка)?$', r'\1', self.prepare_str(note[1])) if 'озвучка' in note[1]: self.instance.voice = True self.instance.name = role_name self.instance.person = Person.get_parsed('cast_link', self.content) self.instance.set_source('role_link')
def parse_persons(self, field_name, links): from kinopoisk.person import Person for link in links: if isinstance(link, Tag) and link.text != "...": person = Person.get_parsed('short_link', link.decode()) getattr(self.instance, field_name).append(person)
def parse_persons(self, field_name, links): from kinopoisk.person import Person for link in links: if isinstance(link, Tag) and link.text != "...": person = Person.get_parsed('short_link', link.decode()) getattr(self.instance, field_name).append(person)