From 314baf038fd87e28f4337f7a4f197950604b7349 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 20 Sep 2016 09:31:08 -0500 Subject: [PATCH] Fix for poor HTML in some nfacommunity.com descs. --- fanficfare/adapters/adapter_nfacommunitycom.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fanficfare/adapters/adapter_nfacommunitycom.py b/fanficfare/adapters/adapter_nfacommunitycom.py index 478e1c6..a2e9401 100644 --- a/fanficfare/adapters/adapter_nfacommunitycom.py +++ b/fanficfare/adapters/adapter_nfacommunitycom.py @@ -184,7 +184,6 @@ class NfaCommunityComAdapter(BaseSiteAdapter): # XXX except: return "" - # Rated: NC-17
etc labels = soup.findAll('span',{'class':'label'}) for labelspan in labels: value = labelspan.nextSibling @@ -195,7 +194,13 @@ class NfaCommunityComAdapter(BaseSiteAdapter): # XXX svalue = "" while 'label' not in defaultGetattr(value,'class'): svalue += unicode(value) - value = value.nextSibling + # poor HTML(unclosed

for one) can cause run on + # over the next label. + if '' in svalue: + svalue = svalue[0:svalue.find('')] + break + else: + value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue))