From 5af34affa957d349518f897c10f4289624a7f877 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 16 May 2020 19:19:31 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20with=202Captcha=20(not=20optimal)=20+=20f?= =?UTF-8?q?ix=20=CF=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- pynyaata/config.py | 1 + pynyaata/connectors/core.py | 5 ++++- pynyaata/templates/layout.html | 6 +++--- requirements.txt | 1 + setup.py | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0787748..e851e68 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 𝛑 😼 た +# π 😼た > "PyNyaaTa", Xéfir's personal animes torrent search engine [![Build Status](https://ci.crystalyx.net/api/badges/Xefir/PyNyaaTa/status.svg)](https://ci.crystalyx.net/Xefir/PyNyaaTa) diff --git a/pynyaata/config.py b/pynyaata/config.py index 3622c30..33b1824 100644 --- a/pynyaata/config.py +++ b/pynyaata/config.py @@ -14,6 +14,7 @@ ADMIN_PASSWORD = generate_password_hash(environ.get('ADMIN_PASSWORD', 'secret')) APP_PORT = environ.get('FLASK_PORT', 5000) CACHE_TIMEOUT = environ.get('CACHE_TIMEOUT', 60 * 60) REQUESTS_TIMEOUT = environ.get('REQUESTS_TIMEOUT', 5) +TWOCAPTCHA_API_KEY = environ.get('2CAPTCHA_API_KEY') BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',') if environ.get('BLACKLIST_WORDS', '') else [] MYSQL_ENABLED = False diff --git a/pynyaata/connectors/core.py b/pynyaata/connectors/core.py index 22b95af..56bf6bb 100644 --- a/pynyaata/connectors/core.py +++ b/pynyaata/connectors/core.py @@ -9,10 +9,13 @@ from cloudscraper.exceptions import CloudflareException from requests import RequestException from .cloudscraper import CloudScraperWrapper -from ..config import CACHE_TIMEOUT, IS_DEBUG, REQUESTS_TIMEOUT +from ..config import CACHE_TIMEOUT, IS_DEBUG, REQUESTS_TIMEOUT, TWOCAPTCHA_API_KEY scraper = CloudScraperWrapper.create_scraper(browser={ 'custom': 'ScraperBot/1.0' +}, recaptcha={ + 'provider': '2captcha', + 'api_key': TWOCAPTCHA_API_KEY }) diff --git a/pynyaata/templates/layout.html b/pynyaata/templates/layout.html index 21d5de0..129a719 100644 --- a/pynyaata/templates/layout.html +++ b/pynyaata/templates/layout.html @@ -5,8 +5,8 @@ - PyNyaaTa {% block title %}{% endblock %} - + PyNyaaTa - {% block title %}{% endblock %} + @@ -17,7 +17,7 @@