From a03bd570e45a2a840b4e7cdcd9d76b4a84baf0d1 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Thu, 17 Nov 2022 01:29:15 +0100 Subject: [PATCH] Check if mkv --- commands/pygg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/pygg.py b/commands/pygg.py index 85e1dfb..7e8add5 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -74,12 +74,12 @@ session.mount("http://", DNSAdapter(["1.1.1.1"])) session.mount("https://", DNSAdapter(["1.1.1.1"])) -def get_files(id): +def check_files(id): req = session.get(f"{YGGTORRENT_BASE_URL}/engine/get_files", params={"torrent": id}) files = req.json() html = BeautifulSoup(files["html"], "html.parser") trs = html.select("tr") - return len(trs) + return len(trs) == 1 and "mkv" in trs[0].get_text().lower() def search_ygg(query, multi, full): @@ -135,7 +135,7 @@ def search_ygg(query, multi, full): link = tds[1].a["href"] id = link.split("/")[-1].split("-")[0] - if get_files(id) > 1: + if not check_files(id): continue print(f"{name} {link}")