def parse_notes(self):
notes = []
#??????????? ????????? ???? ?????? ??????? ??? ?????
for tag in self.page.find_all(class_='div-comment'):
sibling = tag.next_sibling.next_sibling if type(tag.next_sibling) is NavigableString else tag.next_sibling
if sibling and not (sibling.has_attr('class') and 'div-control' in sibling['class']):
note = tag.get_text()
if note.startswith('?????(?):'):
notes.append({'name':'authors', 'value':note[10:].strip()})
elif note.startswith('??????????:'):
notes.append({'name':'comment', 'value':note[12:].strip()})
else:
raise NotImplementedError('??????????? ????? ? ??????????: {}'.format(note))
return notes
评论列表
文章目录