From bb92e112fecb62c0ae2833e9108f8e22690cd526 Mon Sep 17 00:00:00 2001 From: Tofik Denianto <77754555+tofikdn@users.noreply.github.com> Date: Mon, 31 Jan 2022 17:35:01 +0700 Subject: [PATCH] done --- program/ytsearch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/program/ytsearch.py b/program/ytsearch.py index a11f748..f0d9b53 100644 --- a/program/ytsearch.py +++ b/program/ytsearch.py @@ -12,6 +12,8 @@ async def ytsearch(_, message: Message): query = message.text.split(None, 1)[1] m = await message.reply_text("🔎 **Searching...**") results = YoutubeSearch(query, max_results=5).to_dict() + if len(results) == 0: + return await m.edit_text("❌ **no results found.**") text = "" for i in range(5): try: