fix: 🐛 fix bad nb_files
This commit is contained in:
parent
94109da87d
commit
f05fd79dd9
@ -7,7 +7,7 @@ from time import sleep
|
|||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from requests import get
|
from requests import JSONDecodeError, get
|
||||||
|
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -31,6 +31,7 @@ args = parser.parse_args()
|
|||||||
|
|
||||||
|
|
||||||
def nb_files(id: int):
|
def nb_files(id: int):
|
||||||
|
try:
|
||||||
response = get(
|
response = get(
|
||||||
f"https://www.ygg.re/engine/get_files?torrent={id}",
|
f"https://www.ygg.re/engine/get_files?torrent={id}",
|
||||||
headers={"Cookie": args.cookie, "User-Agent": args.user_agent},
|
headers={"Cookie": args.cookie, "User-Agent": args.user_agent},
|
||||||
@ -50,6 +51,8 @@ def nb_files(id: int):
|
|||||||
break
|
break
|
||||||
|
|
||||||
return is_mkv and len(rows) == 1
|
return is_mkv and len(rows) == 1
|
||||||
|
except JSONDecodeError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def parse_size(size):
|
def parse_size(size):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user