From 262d543724029575738bd87e6f3e5963a5d772f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Alberto=20Orejuela=20Garc=C3=ADa?= Date: Fri, 8 May 2020 12:17:17 +0200 Subject: [PATCH] Fix a new error in scrapping explanation --- api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index a8dfe32..28b2b6d 100644 --- a/api.py +++ b/api.py @@ -1,4 +1,4 @@ -# Copyright © 2019 José Alberto Orejuela García (josealberto4444) +# Copyright © 2019-2020 José Alberto Orejuela García (josealberto4444) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -90,6 +90,7 @@ class Apod: explanation = explanation.replace('\n>', '>') # Fix split HTML tags. explanation = explanation.replace('', '') # Fix typos (they seem to write the HTML by hand, yes). explanation = explanation.replace('\n', ' ') # Delete all newlines. + explanation = explanation.replace('
', ' ') # Delete all HTML newlines. explanation = re.sub('\s+', ' ', explanation).strip() # Substitute repeated spaces and strips the ones at the beginning and the end of the string. explanation = re.sub(r']*)href=["\'](?!http)([^"\']*)["\']([^>]*)>', r'', explanation) # Change relative paths to absolute. return explanation -- 2.45.2