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()