Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Continue early in remove_unlikely_candidates() in case there is neith…

…er a class nor an id attribute.
  • Loading branch information...
commit 960f885edfaa4c54f371cab8eb4d51808c570875 1 parent 6b3961c
Jan Weiß authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  readability/readability.py
View
2  readability/readability.py
@@ -280,6 +280,8 @@ def debug(self, *a):
def remove_unlikely_candidates(self):
for elem in self.html.iter():
s = "%s %s" % (elem.get('class', ''), elem.get('id', ''))
+ if len(s) < 2:
+ continue
#self.debug(s)
if REGEXES['unlikelyCandidatesRe'].search(s) and (not REGEXES['okMaybeItsACandidateRe'].search(s)) and elem.tag != 'body':
self.debug("Removing unlikely candidate - %s" % describe(elem))
Please sign in to comment.
Something went wrong with that request. Please try again.