Add yggtorrent base url
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2022-11-13 20:06:48 +01:00
parent da030848f8
commit ab41d6796c

View File

@ -9,6 +9,7 @@ from requests import Session, adapters
from urllib3.util.connection import HAS_IPV6
BLACKLIST_WORDS = ["dvd", "iso"]
YGGTORRENT_BASE_URL = "https://www5.yggtorrent.fi"
parser = argparse.ArgumentParser()
@ -74,9 +75,7 @@ session.mount("https://", DNSAdapter(["1.1.1.1"]))
def get_files(id):
req = session.get(
"https://www5.yggtorrent.fi/engine/get_files", params={"torrent": 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")
@ -99,7 +98,7 @@ def search_ygg(query, multi):
if multi:
ygg_params["option_langue"] = ["4"]
req = session.get("https://www5.yggtorrent.fi/engine/search", params=ygg_params)
req = session.get(f"{YGGTORRENT_BASE_URL}/engine/search", params=ygg_params)
html = BeautifulSoup(req.text, "html.parser")
trs = html.select("table.table tr")