StoryCacher: cope with failed diffbot fetches

This commit is contained in:
joshua stein 2015-10-19 19:13:15 -05:00
parent d44d43e551
commit 2ee262fe8a

View file

@ -28,7 +28,7 @@ class StoryCacher
j = JSON.parse(res)
# turn newlines into double newlines, so they become paragraphs
j["text"].gsub!("\n", "\n\n")
j["text"] = j["text"].to_s.gsub("\n", "\n\n")
while j["text"].match("\n\n\n")
j["text"].gsub!("\n\n\n", "\n\n")