Fix file request
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Michel Roux 2022-12-24 12:59:03 +00:00
parent 96aef68223
commit 136039cabe
1 changed files with 5 additions and 2 deletions

7
commands/pygg.py Normal file → Executable file
View File

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