From 136039cabef0db1817047e5a694dfa0f3f3fb50f Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 24 Dec 2022 12:59:03 +0000 Subject: [PATCH] Fix file request --- commands/pygg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 commands/pygg.py diff --git a/commands/pygg.py b/commands/pygg.py old mode 100644 new mode 100755 index 4496e10..e3844c9 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import argparse import io +import json import os import re import urllib @@ -99,8 +100,10 @@ session = FlareRequests() def check_files(id): req = session.get(f"{YGGTORRENT_BASE_URL}/engine/get_files", params={"torrent": id}) - files = req.json() - html = bs4.BeautifulSoup(files["html"], "html.parser") + 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()