def __get_navigable_strings(self,soup):
if isinstance(soup, NavigableString):
if type(soup) not in (Comment, Declaration) and soup.strip():
yield soup
elif soup.name not in ('script', 'style'):
for c in soup.contents:
for g in self.__get_navigable_strings(c):
yield g
评论列表
文章目录