From ab41d6796c41dd4a18449a3695ca85c522aeffb1 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 13 Nov 2022 20:06:48 +0100 Subject: [PATCH] Add yggtorrent base url --- commands/pygg.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/commands/pygg.py b/commands/pygg.py index f54c17c..2b6a64d 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -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")