From 198af3c631f97ab5d67c4c18da861b61c51e438a Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 6 Jan 2023 00:25:38 +0100 Subject: [PATCH] Don't disclose YGG_IP --- pynyaata/connectors/yggtorrent.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pynyaata/connectors/yggtorrent.py b/pynyaata/connectors/yggtorrent.py index 0aa3742..d0a0358 100644 --- a/pynyaata/connectors/yggtorrent.py +++ b/pynyaata/connectors/yggtorrent.py @@ -15,7 +15,8 @@ class YggTorrent(ConnectorCore): color = 'is-success' title = 'YggTorrent' favicon = 'yggtorrent.png' - base_url = 'https://%s' % YGG_DOMAIN if not YGG_IP else 'http://%s' % YGG_IP + base_url = 'https://%s' % YGG_DOMAIN + hidden_url = 'http://%s' % YGG_IP is_light = False category = 2179 @@ -37,9 +38,14 @@ class YggTorrent(ConnectorCore): @ConnectorCache.cache_data def search(self): if self.category: - response = curl_content( - self.get_full_search_url(), custom_host=YGG_DOMAIN if YGG_IP else None - ) + if YGG_IP: + params = self.get_full_search_url().split('?') + response = curl_content( + '%s/engine/search?%s' % (self.hidden_url, params[1]), + headers={"Host": YGG_DOMAIN}, + ) + else: + response = curl_content(self.get_full_search_url()) if response['http_code'] == 200: html = BeautifulSoup(response['output'], 'html.parser')