This commit is contained in:
parent
96aef68223
commit
136039cabe
7
commands/pygg.py
Normal file → Executable file
7
commands/pygg.py
Normal file → Executable file
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import io
|
import io
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import urllib
|
import urllib
|
||||||
@ -99,8 +100,10 @@ session = FlareRequests()
|
|||||||
|
|
||||||
def check_files(id):
|
def check_files(id):
|
||||||
req = session.get(f"{YGGTORRENT_BASE_URL}/engine/get_files", params={"torrent": id})
|
req = session.get(f"{YGGTORRENT_BASE_URL}/engine/get_files", params={"torrent": id})
|
||||||
files = req.json()
|
res = bs4.BeautifulSoup(req.text, "html.parser")
|
||||||
html = bs4.BeautifulSoup(files["html"], "html.parser")
|
pre = res.select_one("pre")
|
||||||
|
jhtml = json.loads(pre.get_text())
|
||||||
|
html = bs4.BeautifulSoup(jhtml["html"], "html.parser")
|
||||||
trs = html.select("tr")
|
trs = html.select("tr")
|
||||||
return len(trs) == 1 and "mkv" in trs[0].get_text().lower()
|
return len(trs) == 1 and "mkv" in trs[0].get_text().lower()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user