Fix gomov when no result found

This commit is contained in:
yasirarism 2022-12-25 21:58:06 +07:00 committed by GitHub
parent d7cac90473
commit e916cfe825
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -327,6 +327,8 @@ async def gomov_scrap(_, message):
html = await http.get(f"https://185.173.38.216/?s={judul}", headers=headers)
soup = BeautifulSoup(html.text, "lxml")
entry = soup.find_all(class_="entry-header")
if "Nothing Found" in entry[0].text:
return await msg.edit("Oops, data film tidak ditemukan di GoMov")
DATA = []
for i in entry:
genre = i.find(class_="gmr-movie-on").text
@ -334,8 +336,6 @@ async def gomov_scrap(_, message):
judul = i.find(class_="entry-title").find("a").text
link = i.find(class_="entry-title").find("a").get("href")
DATA.append({"judul": judul, "link": link, "genre": genre})
if not DATA:
return await msg.edit("Oops, data film tidak ditemukan di GoMov")
res = "".join(
f"<b>{num}. {i['judul']}</b>\n<code>{i['genre']}</code>{i['link']}\n\n"
for num, i in enumerate(DATA, start=1)