mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-09 05:04:50 +00:00
Update web_scraper.py
This commit is contained in:
parent
5f9bb3392c
commit
7fa7b915fa
1 changed files with 4 additions and 4 deletions
|
|
@ -332,7 +332,7 @@ async def getDataGomov(msg, kueri, CurrentPage, user, strings):
|
||||||
|
|
||||||
# getData samehada
|
# getData samehada
|
||||||
async def getSame(msg, query, current_page, strings):
|
async def getSame(msg, query, current_page, strings):
|
||||||
if not savedict.get(msg.id):
|
if not SCRAP_DICT.get(msg.id):
|
||||||
cfse = cfscrape.CloudflareScraper()
|
cfse = cfscrape.CloudflareScraper()
|
||||||
if query:
|
if query:
|
||||||
data = cfse.get(f"https://samehadaku.cam/?s={query}", headers=headers)
|
data = cfse.get(f"https://samehadaku.cam/?s={query}", headers=headers)
|
||||||
|
|
@ -349,12 +349,12 @@ async def getSame(msg, query, current_page, strings):
|
||||||
if not sdata:
|
if not sdata:
|
||||||
await msg.edit_msg(strings("no_result"), del_in=5)
|
await msg.edit_msg(strings("no_result"), del_in=5)
|
||||||
return None, None, 0
|
return None, None, 0
|
||||||
savedict[msg.id] = [split_arr(sdata, 10), query]
|
SCRAP_DICT[msg.id] = [split_arr(sdata, 10), query]
|
||||||
try:
|
try:
|
||||||
index = int(current_page - 1)
|
index = int(current_page - 1)
|
||||||
PageLen = len(savedict[msg.id][0])
|
PageLen = len(SCRAP_DICT[msg.id][0])
|
||||||
sameresult = ""
|
sameresult = ""
|
||||||
for c, i in enumerate(savedict[msg.id][0][index], start=1):
|
for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
|
||||||
sameresult += f"<b>{c}. <a href='{i['url']}'>{i['title']}</a>\n<b>Status:</b> {i['sta']}\n</b>Rating:</b> {i['rate']}\n\n"
|
sameresult += f"<b>{c}. <a href='{i['url']}'>{i['title']}</a>\n<b>Status:</b> {i['sta']}\n</b>Rating:</b> {i['rate']}\n\n"
|
||||||
IGNORE_CHAR = "[]"
|
IGNORE_CHAR = "[]"
|
||||||
sameresult = "".join(i for i in sameresult if not i in IGNORE_CHAR)
|
sameresult = "".join(i for i in sameresult if not i in IGNORE_CHAR)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue