mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Salah escape text
This commit is contained in:
parent
6be3ff1064
commit
51ffce69a3
3 changed files with 8 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ import pickle
|
|||
import re
|
||||
import sys
|
||||
import traceback
|
||||
from bs4 import BeautifulSoup
|
||||
from datetime import datetime
|
||||
from inspect import getfullargspec
|
||||
from shutil import disk_usage
|
||||
|
|
@ -420,6 +421,7 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
|
|||
"fetch": fetch,
|
||||
"replied": ctx.reply_to_message,
|
||||
"requests": requests,
|
||||
"soup": BeautifulSoup,
|
||||
"help": _help,
|
||||
}
|
||||
eval_vars.update(var)
|
||||
|
|
|
|||
|
|
@ -236,8 +236,8 @@ async def inline_menu(_, inline_query: InlineQuery):
|
|||
snippet = result.select_one("#rso .lyLwlc").text
|
||||
except:
|
||||
snippet = "-"
|
||||
message_text = f"<a href='{link}'>{title}</a>\n"
|
||||
message_text += f"Deskription: {html.escape(snippet)}"
|
||||
message_text = f"<a href='{link}'>{html.escape(title)}</a>\n"
|
||||
message_text += f"Deskription: {html.escape(snippet)}\nGoogleSearch by @{self.me.username}"
|
||||
data.append(
|
||||
InlineQueryResultArticle(
|
||||
title=f"{title}",
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ async def gsearch(_, message):
|
|||
# collect data
|
||||
data = []
|
||||
|
||||
for result in soup.select(".tF2Cxc"):
|
||||
for result in soup.select(".tF2Cxc"):hmm
|
||||
link = result.select_one(".yuRUbf a")["href"]
|
||||
title = result.select_one(".DKV0Md").text
|
||||
try:
|
||||
|
|
@ -219,16 +219,16 @@ async def gsearch(_, message):
|
|||
# appending data to an array
|
||||
data.append(
|
||||
{
|
||||
"title": title,
|
||||
"title": html.escape(title),
|
||||
"link": link,
|
||||
"snippet": snippet,
|
||||
"snippet": html.escape(snippet),
|
||||
}
|
||||
)
|
||||
arr = json.dumps(data, indent=2, ensure_ascii=False)
|
||||
parse = json.loads(arr)
|
||||
total = len(parse)
|
||||
res = "".join(
|
||||
f"<a href='{i['link']}'>{i['title']}</a>\n{html.escape(i['snippet'])}\n\n"
|
||||
f"<a href='{i['link']}'>{i['title']}</a>\n{i['snippet']}\n\n"
|
||||
for i in parse
|
||||
)
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Reference in a new issue