From 0f895205f693d7d3535f497a462fe0fe35796b86 Mon Sep 17 00:00:00 2001 From: Hazel Shanks Date: Fri, 11 Dec 2020 18:32:38 +1300 Subject: [PATCH] cast JSON api values to string even when expecting string -- fixes #604 --- fanficfare/adapters/adapter_fictionlive.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fanficfare/adapters/adapter_fictionlive.py b/fanficfare/adapters/adapter_fictionlive.py index e0c48d55..13412546 100644 --- a/fanficfare/adapters/adapter_fictionlive.py +++ b/fanficfare/adapters/adapter_fictionlive.py @@ -282,7 +282,9 @@ class FictionLiveAdapter(BaseSiteAdapter): text = "" - for chunk in data: + for count, chunk in enumerate(data): + + # logger.debug(count) # pollutes the debug log, shows which chunk crashed the handler text += "
" # chapter chunks aren't always well-delimited in their contents @@ -452,7 +454,7 @@ class FictionLiveAdapter(BaseSiteAdapter): if index in x_outs: crossed.append((index, choice_text, verified_votes, total_votes)) else: - output += "" + choice_text + "" + output += "" + str(choice_text) + "" if verified_votes > 0: output += "★" + str(verified_votes) + "/" output += str(total_votes)+ " \n" @@ -465,7 +467,7 @@ class FictionLiveAdapter(BaseSiteAdapter): else: x_reason = x_reasons[str(index)] if str(index) in x_reasons else "" output += "" \ - + choice_text + "
" + x_reason + "
" + + str(choice_text) + "
" + str(x_reason) + "" output += "\n" @@ -494,17 +496,17 @@ class FictionLiveAdapter(BaseSiteAdapter): for uid, roll in dice.items(): output += '
' if roll: # optional. just because there's a list entry for it doesn't mean it has a value! - output += '
' + roll + '
\n' + output += '
' + str(roll) + '
\n' if uid in posts: post = posts[uid] if post: - output += post + output += str(post) del posts[uid] # it's handled here with the roll instead of later output += '
' for post in posts.values(): if post: - output += '
' + post + '
\n' + output += '
' + str(post) + '
\n' return output @@ -520,9 +522,7 @@ class FictionLiveAdapter(BaseSiteAdapter): ### known bugs: -# BUG: chapters at the start of the story -- 'home' is often folded into the second chapter -# BUG: short stories can crash -- see crash-checker testing - # TODO: support chapter urls for single-chapter / chapter-range downloads # complicated -- urls for getChapterText are API urls generated by add_chapters, not the public/website ones # in particular, may need more API reversing to figure out how to get the *end* of the chunk range +# find in 'bm' in the metadata?