From 8675175f26f0ad4110cf3ee5b719b9ca17d3517e Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Mon, 14 Nov 2022 18:11:22 +0100 Subject: [PATCH 1/9] Fix year str --- commands/pygg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/pygg.py b/commands/pygg.py index be753f0..893e797 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -117,7 +117,7 @@ def search_ygg(query, multi): if any(word.lower() in name for word in BLACKLIST_WORDS): continue - if args.year and args.year not in name: + if args.year and str(args.year) not in name: continue if args.uploader and not any( From 2d0edc097383850c85bea6502a4a17a1c3790ce6 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Mon, 14 Nov 2022 18:42:52 +0100 Subject: [PATCH 2/9] Be more precise with year --- commands/pygg.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/commands/pygg.py b/commands/pygg.py index 893e797..08a7825 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -82,7 +82,7 @@ def get_files(id): return len(trs) -def search_ygg(query, multi): +def search_ygg(query, multi, full): ygg_params = { "name": query, "description": "", @@ -95,6 +95,9 @@ def search_ygg(query, multi): "sort": "publish_date", } + if full and args.year: + ygg_params["name"] += f" {args.year}" + if multi: ygg_params["option_langue:multiple[]"] = "4" @@ -164,11 +167,19 @@ fra = ( ) -search_ygg(args.query, True) -search_ygg(fra, True) -search_ygg(eng, True) -search_ygg(args.query, False) -search_ygg(fra, False) -search_ygg(eng, False) +search_ygg(args.query, True, True) +search_ygg(fra, True, True) +search_ygg(eng, True, True) +search_ygg(args.query, False, True) +search_ygg(fra, False, True) +search_ygg(eng, False, True) + +if args.year: + search_ygg(args.query, True, False) + search_ygg(fra, True, False) + search_ygg(eng, True, False) + search_ygg(args.query, False, False) + search_ygg(fra, False, False) + search_ygg(eng, False, False) print("No results :(") From 40bd3e33eefb097835856a0080ec75a9e0f88203 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 15 Nov 2022 08:26:35 +0000 Subject: [PATCH 3/9] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Dockerfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 48cfa9a..874341a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM linuxserver/ffmpeg:4.4-cli-ls65 +FROM linuxserver/ffmpeg:4.4-cli-ls66 RUN apt-get update && \ apt-get install -y \ From 9ede795bd8eb3ef9de00102d2086d5fe1b7a7879 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Thu, 17 Nov 2022 01:12:13 +0100 Subject: [PATCH 4/9] Restrict by downloads --- commands/pygg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands/pygg.py b/commands/pygg.py index 08a7825..85e1dfb 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -112,11 +112,15 @@ def search_ygg(query, multi, full): tds = tr.find_all("td") size = tds[5].get_text() + downloads = tds[6].get_text() name = tds[1].get_text().lower().strip() if parse_size(size) > parse_size(f"{args.size}Go"): continue + if int(downloads) < 10: + continue + if any(word.lower() in name for word in BLACKLIST_WORDS): continue From a03bd570e45a2a840b4e7cdcd9d76b4a84baf0d1 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Thu, 17 Nov 2022 01:29:15 +0100 Subject: [PATCH 5/9] Check if mkv --- commands/pygg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/pygg.py b/commands/pygg.py index 85e1dfb..7e8add5 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -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}") From 916f2b8b47e7d1821f6e19b98cb6fbe02e3be2f2 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Thu, 17 Nov 2022 22:11:12 +0100 Subject: [PATCH 6/9] At least 20 downloads now --- commands/pygg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/pygg.py b/commands/pygg.py index 7e8add5..ad71668 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -118,7 +118,7 @@ def search_ygg(query, multi, full): if parse_size(size) > parse_size(f"{args.size}Go"): continue - if int(downloads) < 10: + if int(downloads) < 20: continue if any(word.lower() in name for word in BLACKLIST_WORDS): From f7ab8bc247d1d37f8980d6f03b45326745c541aa Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Thu, 17 Nov 2022 22:12:00 +0100 Subject: [PATCH 7/9] Make downloads limit configurable --- commands/pygg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/pygg.py b/commands/pygg.py index ad71668..a3f64d2 100644 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -16,6 +16,7 @@ parser = argparse.ArgumentParser() parser.add_argument("-u", "--uploader", action="append") parser.add_argument("-y", "--year", type=int) parser.add_argument("-s", "--size", type=int, default=10) +parser.add_argument("-d", "--downloads", type=int, default=20) parser.add_argument("query") args = parser.parse_args() @@ -118,7 +119,7 @@ def search_ygg(query, multi, full): if parse_size(size) > parse_size(f"{args.size}Go"): continue - if int(downloads) < 20: + if int(downloads) < args.downloads: continue if any(word.lower() in name for word in BLACKLIST_WORDS): From 8d8cbe8ca716c4d31f367dc2e4c5b3e97bc21b3e Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 22 Nov 2022 12:00:43 +0000 Subject: [PATCH 8/9] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Dockerfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 874341a..153318d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM linuxserver/ffmpeg:4.4-cli-ls66 +FROM linuxserver/ffmpeg:4.4-cli-ls67 RUN apt-get update && \ apt-get install -y \ From 078997ee7cfbf19cb5b3b4cb6066c567805a7c0e Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 29 Nov 2022 08:38:44 +0000 Subject: [PATCH 9/9] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Dockerfile'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 153318d..bd43c94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM linuxserver/ffmpeg:4.4-cli-ls67 +FROM linuxserver/ffmpeg:4.4-cli-ls68 RUN apt-get update && \ apt-get install -y \