Check if mkv
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2022-11-17 01:29:15 +01:00
parent 3421790411
commit a03bd570e4

View File

@ -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}")