From 55db6736ba2d77abd47b330322c5214eaebb10f8 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 20 Jan 2023 16:05:04 +0100 Subject: [PATCH] Fix check_files --- commands/pygg.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/pygg.py b/commands/pygg.py index 5a027fb..aebf01d 100755 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -106,9 +106,11 @@ def parse_size(size): def check_files(id): - req = requests.get(f"https://{YGG_DOMAIN}/engine/get_files", params={"torrent": id}) - res = json.loads(req.text) - html = bs4.BeautifulSoup(res["html"], "html.parser") + req = session.get(f"{YGG_DOMAIN}/engine/get_files", params={"torrent": id}) + res = bs4.BeautifulSoup(req.text, "html.parser") + pre = res.select_one("pre") + jhtml = json.loads(pre.get_text()) + html = bs4.BeautifulSoup(jhtml["html"], "html.parser") trs = html.select("tr") return len(trs) == 1 and "mkv" in trs[0].get_text().lower()