From b675618b95005ff36423cc7ec9355959506d1b3f Mon Sep 17 00:00:00 2001 From: Schimon Jehudah Date: Wed, 10 Jan 2024 21:40:12 +0000 Subject: [PATCH] Change order of html data and status code --- slixfeed/action.py | 4 ++-- slixfeed/xmpp/process.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/slixfeed/action.py b/slixfeed/action.py index 9ddd4e0..396ec34 100644 --- a/slixfeed/action.py +++ b/slixfeed/action.py @@ -715,13 +715,13 @@ async def get_content(url): try: document = Document(result[0]) content = document.summary() - info = [code, content] + info = [content, code] except: logging.warning( "Install package readability.") info = result else: - info = [code, None] + info = [None, code] return info # TODO Either adapt it to filename # or change it to something else diff --git a/slixfeed/xmpp/process.py b/slixfeed/xmpp/process.py index dcf07ac..4e03d4a 100644 --- a/slixfeed/xmpp/process.py +++ b/slixfeed/xmpp/process.py @@ -83,7 +83,7 @@ async def message(self, message): # BOTE This is an exceptional case in which we treat # type groupchat the same as type chat. - if (message_text.lower().startswith("http")) and( + if (message_text.lower().startswith("http") and message_text.lower().endswith(".opml")): url = message_text await task.clean_tasks_xmpp( @@ -472,8 +472,8 @@ async def message(self, message): url = uri.remove_tracking_parameters(url) url = (uri.replace_hostname(url, "link")) or url info = await action.get_content(url) - content = info[1] - status = info[0] + content = info[0] + status = info[1] if content: try: match ext: @@ -487,8 +487,6 @@ async def message(self, message): self, jid, filename) await send_oob_message( self, jid, url) - await task.start_tasks_xmpp( - self, jid, ["status"]) except: logging.warning( "Check that packages html2text, pdfkit " @@ -496,6 +494,8 @@ async def message(self, message): response = ( "Failed to export to {}" ).format(ext) + await task.start_tasks_xmpp( + self, jid, ["status"]) else: response = ( "Failed to fetch resource. Reason: {}"