1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2026-01-04 14:43:48 +01:00

FFN: less-destructive attribute clearing

This commit is contained in:
David Lynch 2019-10-17 22:29:01 -05:00
parent 6cc1620fb3
commit dc10e4cf17

View file

@ -70,12 +70,14 @@ class FanFictionNet(Site):
raise SiteException("No chapter content")
text = content.find(id="storytext")
if not text:
raise SiteException("No chapter content")
# clean up some invalid xhtml attributes
# TODO: be more selective about this somehow
try:
for tag in text.find_all(True):
tag.attrs = None
tag.attrs.clear()
except Exception:
logger.exception("Trouble cleaning attributes")