This commit is contained in:
Kovid Goyal 2009-01-31 18:47:49 -08:00
parent cfce3b878e
commit 0bced7741e

View File

@ -139,6 +139,8 @@ class RecursiveFetcher(object, LoggingInterface):
if self.keep_only_tags: if self.keep_only_tags:
body = Tag(soup, 'body') body = Tag(soup, 'body')
try: try:
if isinstance(self.keep_only_tags, dict):
self.keep_only_tags = [self.keep_only_tags]
for spec in self.keep_only_tags: for spec in self.keep_only_tags:
for tag in soup.find('body').findAll(**spec): for tag in soup.find('body').findAll(**spec):
body.insert(len(body.contents), tag) body.insert(len(body.contents), tag)