diff --git a/misskaty/plugins/scrapwebsite.py b/misskaty/plugins/scrapwebsite.py index 763465f5..ce4d8c5a 100644 --- a/misskaty/plugins/scrapwebsite.py +++ b/misskaty/plugins/scrapwebsite.py @@ -589,230 +589,6 @@ async def pahe_scrap(_, msg): await msg.reply(f"ERROR: {e}", True) -@app.on_message(filters.command(["terbit21"], COMMAND_HANDLER)) -@capture_err -async def terbit21_scrap(_, msg): - m = await msg.reply("**__Checking data list ...__**", True) - if len(msg.command) == 1: - try: - r = await http.get("https://yasirapi.eu.org/terbit21") - res = r.json() - if not res["result"]: - await m.delete() - return await msg.reply("404 Result not FOUND!", True) - await m.delete() - head = f"#Terbit21 Latest:\nšŸŒ€ Use /{msg.command[0]} [title] to start search with title.\n\n" - msgs = "" - for c, i in enumerate(res["result"], start=1): - msgs += f"{c}. {i['judul']}\nCategory: {i['kategori']}\n" - msgs += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"šŸ’  Download\n\n" - if len(head.encode("utf-8") + msgs.encode("utf-8")) >= 4000: - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - await asyncio.sleep(2) - msgs = "" - if msgs != "": - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - except Exception as e: - await m.delete() - LOGGER.error(e) - await msg.reply(str(e), True) - else: - try: - title = msg.text.split(" ", 1)[1] - r = await http.get(f"https://yasirapi.eu.org/terbit21?q={title}") - res = r.json() - if not res["result"]: - await m.delete() - return await msg.reply("404 Result not FOUND!", True) - await m.delete() - head = f"#Terbit21 Results For: {title}\n\n" - msgs = "" - for c, i in enumerate(res["result"], start=1): - msgs += f"{c}. {i['judul']}\nCategory: {i['kategori']}\n" - msgs += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"šŸ’  Download\n\n" - if len(head.encode("utf-8") + msgs.encode("utf-8")) >= 4000: - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - await asyncio.sleep(2) - msgs = "" - if msgs != "": - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - except Exception as e: - await m.delete() - LOGGER.error(e) - await msg.reply(str(e), True) - - -@app.on_message(filters.command(["lk21"], COMMAND_HANDLER)) -@capture_err -async def lk21_scrap(_, msg): - m = await msg.reply("**__Checking data list ...__**", True) - if len(msg.command) == 1: - try: - r = await http.get("https://yasirapi.eu.org/lk21") - res = r.json() - if res.get("detail", None): - await m.delete() - return await msg.reply(f"ERROR: {res['detail']}", True) - if not res["result"]: - await m.delete() - return await msg.reply("404 Result not FOUND!", True) - await m.delete() - head = f"#Layarkaca21 Latest:\nšŸŒ€ Use /{msg.command[0]} [title] to start search with title.\n\n" - msgs = "" - for c, i in enumerate(res["result"], start=1): - msgs += f"{c}. {i['judul']}\nCategory: {i['kategori']}\n" - msgs += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"šŸ’  Download\n\n" - if len(head.encode("utf-8") + msgs.encode("utf-8")) >= 4000: - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - await asyncio.sleep(2) - msgs = "" - if msgs != "": - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - except Exception as e: - await m.delete() - LOGGER.error(e) - await msg.reply(str(e), True) - else: - try: - title = msg.text.split(" ", 1)[1] - r = await http.get(f"https://yasirapi.eu.org/lk21?q={title}") - res = r.json() - if res.get("detail", None): - await m.delete() - return await msg.reply(f"ERROR: {res['detail']}", True) - if not res["result"]: - await m.delete() - return await msg.reply("404 Result not FOUND!", True) - await m.delete() - head = f"#Layarkaca21 Results For: {title}\n\n" - msgs = "" - for c, i in enumerate(res["result"], start=1): - msgs += f"{c}. {i['judul']}\nCategory: {i['kategori']}\n" - msgs += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"šŸ’  Download\n\n" - if len(head.encode("utf-8") + msgs.encode("utf-8")) >= 4000: - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - await asyncio.sleep(2) - msgs = "" - if msgs != "": - await msg.reply( - head + msgs, - True, - disable_web_page_preview=True, - reply_markup=InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text="āŒ Close", - callback_data=f"close#{msg.from_user.id}", - ) - ] - ] - ), - ) - except Exception as e: - await m.delete() - LOGGER.error(e) - await msg.reply(str(e), True) - - @app.on_message(filters.command(["gomov"], COMMAND_HANDLER)) @capture_err async def gomov_scrap(_, msg):