From 5a4c5f1a3ca475a1798cd146406723528a2131ac Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Tue, 24 Sep 2024 07:34:25 +0700 Subject: [PATCH] Fix scraper --- misskaty/plugins/web_scraper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/misskaty/plugins/web_scraper.py b/misskaty/plugins/web_scraper.py index d55893f1..3c8b3f30 100644 --- a/misskaty/plugins/web_scraper.py +++ b/misskaty/plugins/web_scraper.py @@ -16,7 +16,7 @@ import httpx from bs4 import BeautifulSoup from cachetools import TTLCache from pykeyboard import InlineButton, InlineKeyboard -from pyrogram.errors import QueryIdInvalid +from pyrogram.errors import MessageTooLong, QueryIdInvalid from pyrogram.types import Message from database import dbname @@ -1463,7 +1463,10 @@ async def muviku_scrap(_, message, strings): res = "".join( f"Host: {i['kualitas']}\n{i['link']}\n\n" for i in data ) - await message.reply(res) + await message.reply_msg(res) + except MessageTooLong: + url = await post_to_telegraph(False, link, res) + await message.reply_msg(f"Your result is too long, i have pasted your result on Telegraph:\n{url}") except IndexError: return await message.reply( strings("invalid_cmd_scrape").format(cmd=message.command[0])