From 56a60471d2c2ebd26addb2248ff49eafcd41ab54 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sat, 16 Dec 2017 10:50:21 -0600 Subject: [PATCH] Handle QQ threads w/o threadmarks correctly. --- fanficfare/adapters/adapter_forumquestionablequestingcom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fanficfare/adapters/adapter_forumquestionablequestingcom.py b/fanficfare/adapters/adapter_forumquestionablequestingcom.py index f4dbdd87..21727611 100644 --- a/fanficfare/adapters/adapter_forumquestionablequestingcom.py +++ b/fanficfare/adapters/adapter_forumquestionablequestingcom.py @@ -39,8 +39,11 @@ class QuestionablequestingComAdapter(BaseXenForoForumAdapter): ## extracting threadmarks for chapters has diverged between SV/SB ## and QQ enough to require some differentiation. def extract_threadmarks(self,souptag): + threadmarks=[] # try threadmarks if no '#' in url navdiv = souptag.find('div',{'class':'threadmarkMenus'}) + if not navdiv: + return threadmarks # was class=threadmarksTrigger. thread cats are currently # only OverlayTrigger s in threadmarkMenus, but I wouldn't # be surprised if that changed. Don't want to do use just @@ -49,7 +52,6 @@ class QuestionablequestingComAdapter(BaseXenForoForumAdapter): # weren't being stripped, but that's a different issue. threadmarksas = navdiv.find_all('a',{'class':'OverlayTrigger','href':re.compile('threadmarks.*category_id=')}) ## Loop on threadmark categories. - threadmarks=[] tmcat_num=None for threadmarksa in threadmarksas: