From bb58c41b9b76194aed34384a52cb7a0db5a4c3b8 Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Sun, 15 Oct 2023 23:09:46 +0700 Subject: [PATCH] Try fix scraper and add sample auto restart docker container to prevent memory leak.. Signed-off-by: Yasir Aris M --- docker-compose.yml | 8 +++++++- misskaty/plugins/web_scraper.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0ee5e7ff..3f141f07 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,4 +10,10 @@ services: command: bash start.sh environment: CONFIG_FILE_URL: $CONFIG_FILE_URL - restart: on-failure \ No newline at end of file + restart: on-failure + + # restarter: + # image: docker:cli + # volumes: ["/var/run/docker.sock:/var/run/docker.sock"] + # command: ["/bin/sh", "-c", "while true; do sleep 259200; docker restart ${CONTAINER_NAME}; done"] + # restart: ${RESTART} \ No newline at end of file diff --git a/misskaty/plugins/web_scraper.py b/misskaty/plugins/web_scraper.py index 626c12ec..d4a7ac2c 100644 --- a/misskaty/plugins/web_scraper.py +++ b/misskaty/plugins/web_scraper.py @@ -271,7 +271,7 @@ async def getDataNodrakor(msg, kueri, CurrentPage, user, strings): return None, 0, None text = BeautifulSoup(data, "lxml") entry = text.find_all(class_="entry-header") - if "Nothing Found" in entry[0].text: + if entry[0].text.strip() == "Nothing Found": if not kueri: await msg.edit_msg(strings("no_result"), del_in=5) else: