quasarr 1.27.0__tar.gz → 1.28.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of quasarr might be problematic. Click here for more details.
- {quasarr-1.27.0 → quasarr-1.28.1}/PKG-INFO +12 -6
- {quasarr-1.27.0 → quasarr-1.28.1}/README.md +11 -5
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/__init__.py +22 -4
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/api/__init__.py +1 -1
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/api/arr/__init__.py +2 -2
- quasarr-1.28.1/quasarr/api/config/__init__.py +327 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/linkcrypters/al.py +8 -2
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/al.py +7 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/wd.py +12 -2
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/cloudflare.py +20 -1
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/sessions/al.py +31 -1
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/utils.py +22 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/version.py +1 -1
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/al.py +0 -2
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/storage/setup.py +77 -4
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr.egg-info/PKG-INFO +12 -6
- quasarr-1.27.0/quasarr/api/config/__init__.py +0 -135
- {quasarr-1.27.0 → quasarr-1.28.1}/LICENSE +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/api/captcha/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/api/sponsors_helper/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/api/statistics/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/linkcrypters/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/linkcrypters/filecrypt.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/linkcrypters/hide.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/packages/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/by.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/dd.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/dj.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/dl.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/dt.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/dw.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/he.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/mb.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/nk.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/nx.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/sf.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/sj.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/sl.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/downloads/sources/wx.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/html_images.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/html_templates.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/imdb_metadata.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/log.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/myjd_api.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/notifications.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/obfuscated.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/sessions/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/sessions/dd.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/sessions/dl.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/sessions/nx.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/shared_state.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/statistics.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/providers/web_server.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/by.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/dd.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/dj.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/dl.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/dt.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/dw.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/fx.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/he.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/mb.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/nk.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/nx.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/sf.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/sj.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/sl.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/wd.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/search/sources/wx.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/storage/__init__.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/storage/config.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr/storage/sqlite_database.py +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr.egg-info/SOURCES.txt +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr.egg-info/dependency_links.txt +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr.egg-info/entry_points.txt +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr.egg-info/not-zip-safe +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr.egg-info/requires.txt +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/quasarr.egg-info/top_level.txt +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/setup.cfg +0 -0
- {quasarr-1.27.0 → quasarr-1.28.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quasarr
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.28.1
|
|
4
4
|
Summary: Quasarr connects JDownloader with Radarr, Sonarr and LazyLibrarian. It also decrypts links protected by CAPTCHAs.
|
|
5
5
|
Home-page: https://github.com/rix1337/Quasarr
|
|
6
6
|
Author: rix1337
|
|
@@ -45,22 +45,28 @@ Quasarr will confidently handle the rest. Some CAPTCHA types require [Tampermonk
|
|
|
45
45
|
|
|
46
46
|
# Instructions
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
# Instructions
|
|
49
|
+
|
|
50
|
+
1. Set up and run [JDownloader 2](https://jdownloader.org/download/index)
|
|
51
|
+
2. Configure the integrations below
|
|
52
|
+
3. (Optional) Set up [FlareSolverr 3](https://github.com/FlareSolverr/FlareSolverr) for sites that require it
|
|
51
53
|
|
|
52
54
|
> **Finding your Quasarr URL and API Key**
|
|
53
55
|
> Both values are shown in the console output under **API Information**, or in the Quasarr web UI.
|
|
54
56
|
|
|
55
57
|
---
|
|
56
58
|
|
|
57
|
-
## FlareSolverr
|
|
59
|
+
## FlareSolverr (Optional)
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
FlareSolverr is **optional** but **required for some sites** (e.g., AL) that use Cloudflare protection. You can skip FlareSolverr during setup and configure it later via the web UI.
|
|
62
|
+
|
|
63
|
+
If using FlareSolverr, provide your URL including the version path:
|
|
60
64
|
```
|
|
61
65
|
http://192.168.1.1:8191/v1
|
|
62
66
|
```
|
|
63
67
|
|
|
68
|
+
> **Note:** Sites requiring FlareSolverr will show a warning in the console when it's not configured.
|
|
69
|
+
|
|
64
70
|
---
|
|
65
71
|
|
|
66
72
|
## Quasarr
|
|
@@ -18,22 +18,28 @@ Quasarr will confidently handle the rest. Some CAPTCHA types require [Tampermonk
|
|
|
18
18
|
|
|
19
19
|
# Instructions
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
# Instructions
|
|
22
|
+
|
|
23
|
+
1. Set up and run [JDownloader 2](https://jdownloader.org/download/index)
|
|
24
|
+
2. Configure the integrations below
|
|
25
|
+
3. (Optional) Set up [FlareSolverr 3](https://github.com/FlareSolverr/FlareSolverr) for sites that require it
|
|
24
26
|
|
|
25
27
|
> **Finding your Quasarr URL and API Key**
|
|
26
28
|
> Both values are shown in the console output under **API Information**, or in the Quasarr web UI.
|
|
27
29
|
|
|
28
30
|
---
|
|
29
31
|
|
|
30
|
-
## FlareSolverr
|
|
32
|
+
## FlareSolverr (Optional)
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
FlareSolverr is **optional** but **required for some sites** (e.g., AL) that use Cloudflare protection. You can skip FlareSolverr during setup and configure it later via the web UI.
|
|
35
|
+
|
|
36
|
+
If using FlareSolverr, provide your URL including the version path:
|
|
33
37
|
```
|
|
34
38
|
http://192.168.1.1:8191/v1
|
|
35
39
|
```
|
|
36
40
|
|
|
41
|
+
> **Note:** Sites requiring FlareSolverr will show a warning in the console when it's not configured.
|
|
42
|
+
|
|
37
43
|
---
|
|
38
44
|
|
|
39
45
|
## Quasarr
|
|
@@ -17,7 +17,7 @@ from quasarr.providers import shared_state, version
|
|
|
17
17
|
from quasarr.providers.log import info, debug
|
|
18
18
|
from quasarr.providers.notifications import send_discord_message
|
|
19
19
|
from quasarr.providers.utils import extract_allowed_keys, extract_kv_pairs, is_valid_url, check_ip, check_flaresolverr, \
|
|
20
|
-
validate_address, Unbuffered
|
|
20
|
+
validate_address, Unbuffered, FALLBACK_USER_AGENT
|
|
21
21
|
from quasarr.storage.config import Config, get_clean_hostnames
|
|
22
22
|
from quasarr.storage.setup import path_config, hostnames_config, hostname_credentials_config, flaresolverr_config, \
|
|
23
23
|
jdownloader_config
|
|
@@ -100,19 +100,37 @@ def run():
|
|
|
100
100
|
shared_state.update("database", DataBase)
|
|
101
101
|
supported_hostnames = extract_allowed_keys(Config._DEFAULT_CONFIG, 'Hostnames')
|
|
102
102
|
shared_state.update("sites", [key.upper() for key in supported_hostnames])
|
|
103
|
-
shared_state.update("user_agent", "") # will be set by FlareSolverr
|
|
103
|
+
shared_state.update("user_agent", "") # will be set by FlareSolverr or fallback
|
|
104
104
|
shared_state.update("helper_active", False)
|
|
105
105
|
|
|
106
106
|
print(f'Config path: "{config_path}"')
|
|
107
107
|
|
|
108
|
+
# Check if FlareSolverr was previously skipped
|
|
109
|
+
skip_flaresolverr_db = DataBase("skip_flaresolverr")
|
|
110
|
+
flaresolverr_skipped = skip_flaresolverr_db.retrieve("skipped")
|
|
111
|
+
|
|
108
112
|
flaresolverr_url = Config('FlareSolverr').get('url')
|
|
109
|
-
if not flaresolverr_url:
|
|
113
|
+
if not flaresolverr_url and not flaresolverr_skipped:
|
|
110
114
|
flaresolverr_config(shared_state)
|
|
111
|
-
|
|
115
|
+
# Re-check after config - user may have skipped
|
|
116
|
+
flaresolverr_skipped = skip_flaresolverr_db.retrieve("skipped")
|
|
117
|
+
flaresolverr_url = Config('FlareSolverr').get('url')
|
|
118
|
+
|
|
119
|
+
if flaresolverr_skipped:
|
|
120
|
+
info('FlareSolverr setup skipped by user preference')
|
|
121
|
+
info('Some sites (AL) will not work without FlareSolverr. Configure it later in the web UI.')
|
|
122
|
+
# Set fallback user agent
|
|
123
|
+
shared_state.update("user_agent", FALLBACK_USER_AGENT)
|
|
124
|
+
print(f'User Agent (fallback): "{FALLBACK_USER_AGENT}"')
|
|
125
|
+
elif flaresolverr_url:
|
|
112
126
|
print(f'Flaresolverr URL: "{flaresolverr_url}"')
|
|
113
127
|
flaresolverr_check = check_flaresolverr(shared_state, flaresolverr_url)
|
|
114
128
|
if flaresolverr_check:
|
|
115
129
|
print(f'User Agent: "{shared_state.values["user_agent"]}"')
|
|
130
|
+
else:
|
|
131
|
+
info('FlareSolverr check failed - using fallback user agent')
|
|
132
|
+
shared_state.update("user_agent", FALLBACK_USER_AGENT)
|
|
133
|
+
print(f'User Agent (fallback): "{FALLBACK_USER_AGENT}"')
|
|
116
134
|
|
|
117
135
|
print("\n===== Hostnames =====")
|
|
118
136
|
try:
|
|
@@ -31,7 +31,6 @@ def get_api(shared_state_dict, shared_state_lock):
|
|
|
31
31
|
def index():
|
|
32
32
|
protected = shared_state.get_db("protected").retrieve_all_titles()
|
|
33
33
|
api_key = Config('API').get('key')
|
|
34
|
-
|
|
35
34
|
captcha_hint = ""
|
|
36
35
|
if protected:
|
|
37
36
|
plural = 's' if len(protected) > 1 else ''
|
|
@@ -103,6 +102,7 @@ def get_api(shared_state_dict, shared_state_lock):
|
|
|
103
102
|
<div class="section">
|
|
104
103
|
<h2>🔧 Quick Actions</h2>
|
|
105
104
|
<p><button class="btn-primary" onclick="location.href='/hostnames'">Update Hostnames</button></p>
|
|
105
|
+
<p><button class="btn-primary" onclick="location.href='/flaresolverr'">Configure FlareSolverr</button></p>
|
|
106
106
|
<p><button class="btn-primary" onclick="location.href='/statistics'">View Statistics</button></p>
|
|
107
107
|
</div>
|
|
108
108
|
|
|
@@ -327,7 +327,7 @@ def setup_arr_routes(app):
|
|
|
327
327
|
else:
|
|
328
328
|
info(
|
|
329
329
|
f'Ignoring search request from {request_from} - only imdbid searches are supported')
|
|
330
|
-
releases = [
|
|
330
|
+
releases = [] # sonarr expects this but we will not support non-imdbid searches
|
|
331
331
|
|
|
332
332
|
items = ""
|
|
333
333
|
for release in releases:
|
|
@@ -353,7 +353,7 @@ def setup_arr_routes(app):
|
|
|
353
353
|
<enclosure url="{release.get("link", "")}" length="{release.get("size", 0)}" type="application/x-nzb" />
|
|
354
354
|
</item>'''
|
|
355
355
|
|
|
356
|
-
is_feed_request = not getattr(request.query, 'imdbid', '')
|
|
356
|
+
is_feed_request = not getattr(request.query, 'imdbid', '') and not getattr(request.query, 'q', '')
|
|
357
357
|
if is_feed_request and not items:
|
|
358
358
|
items = f'''
|
|
359
359
|
<item>
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Quasarr
|
|
3
|
+
# Project by https://github.com/rix1337
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
import signal
|
|
8
|
+
import threading
|
|
9
|
+
import time
|
|
10
|
+
from urllib.parse import urlparse
|
|
11
|
+
|
|
12
|
+
import requests
|
|
13
|
+
from bottle import request, response
|
|
14
|
+
|
|
15
|
+
from quasarr.providers.html_templates import render_form, render_button, render_fail
|
|
16
|
+
from quasarr.providers.log import info
|
|
17
|
+
from quasarr.providers.shared_state import extract_valid_hostname
|
|
18
|
+
from quasarr.providers.utils import extract_kv_pairs, extract_allowed_keys, check_flaresolverr
|
|
19
|
+
from quasarr.storage.config import Config
|
|
20
|
+
from quasarr.storage.setup import hostname_form_html, save_hostnames, render_reconnect_success
|
|
21
|
+
from quasarr.storage.sqlite_database import DataBase
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def setup_config(app, shared_state):
|
|
25
|
+
@app.get('/hostnames')
|
|
26
|
+
def hostnames_ui():
|
|
27
|
+
message = """<p>
|
|
28
|
+
At least one hostname must be kept.
|
|
29
|
+
</p>"""
|
|
30
|
+
back_button = f'''<p>
|
|
31
|
+
{render_button("Back", "secondary", {"onclick": "location.href='/'"})}
|
|
32
|
+
</p>'''
|
|
33
|
+
return render_form("Hostnames",
|
|
34
|
+
hostname_form_html(shared_state, message, show_restart_button=True,
|
|
35
|
+
show_skip_management=True) + back_button)
|
|
36
|
+
|
|
37
|
+
@app.post("/api/hostnames")
|
|
38
|
+
def hostnames_api():
|
|
39
|
+
return save_hostnames(shared_state, timeout=1, first_run=False)
|
|
40
|
+
|
|
41
|
+
@app.post("/api/hostnames/import-url")
|
|
42
|
+
def import_hostnames_from_url():
|
|
43
|
+
"""Fetch URL and parse hostnames, return JSON for JS to populate fields."""
|
|
44
|
+
response.content_type = 'application/json'
|
|
45
|
+
try:
|
|
46
|
+
data = request.json
|
|
47
|
+
url = data.get('url', '').strip()
|
|
48
|
+
|
|
49
|
+
if not url:
|
|
50
|
+
return {"success": False, "error": "No URL provided"}
|
|
51
|
+
|
|
52
|
+
# Validate URL
|
|
53
|
+
parsed = urlparse(url)
|
|
54
|
+
if parsed.scheme not in ("http", "https") or not parsed.netloc:
|
|
55
|
+
return {"success": False, "error": "Invalid URL format"}
|
|
56
|
+
|
|
57
|
+
if "/raw/eX4Mpl3" in url:
|
|
58
|
+
return {"success": False, "error": "Example URL detected. Please provide a real URL."}
|
|
59
|
+
|
|
60
|
+
# Fetch content
|
|
61
|
+
try:
|
|
62
|
+
resp = requests.get(url, timeout=15)
|
|
63
|
+
resp.raise_for_status()
|
|
64
|
+
content = resp.text
|
|
65
|
+
except requests.RequestException as e:
|
|
66
|
+
return {"success": False, "error": f"Failed to fetch URL: {str(e)}"}
|
|
67
|
+
|
|
68
|
+
# Parse hostnames
|
|
69
|
+
allowed_keys = extract_allowed_keys(Config._DEFAULT_CONFIG, 'Hostnames')
|
|
70
|
+
results = extract_kv_pairs(content, allowed_keys)
|
|
71
|
+
|
|
72
|
+
if not results:
|
|
73
|
+
return {"success": False, "error": "No hostnames found in the provided URL"}
|
|
74
|
+
|
|
75
|
+
# Validate each hostname
|
|
76
|
+
valid_hostnames = {}
|
|
77
|
+
invalid_hostnames = {}
|
|
78
|
+
for shorthand, hostname in results.items():
|
|
79
|
+
domain_check = extract_valid_hostname(hostname, shorthand)
|
|
80
|
+
domain = domain_check.get('domain')
|
|
81
|
+
if domain:
|
|
82
|
+
valid_hostnames[shorthand] = domain
|
|
83
|
+
else:
|
|
84
|
+
invalid_hostnames[shorthand] = domain_check.get('message', 'Invalid')
|
|
85
|
+
|
|
86
|
+
if not valid_hostnames:
|
|
87
|
+
return {"success": False, "error": "No valid hostnames found in the provided URL"}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
"success": True,
|
|
91
|
+
"hostnames": valid_hostnames,
|
|
92
|
+
"errors": invalid_hostnames
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
except Exception as e:
|
|
96
|
+
return {"success": False, "error": f"Error: {str(e)}"}
|
|
97
|
+
|
|
98
|
+
@app.get("/api/skip-login")
|
|
99
|
+
def get_skip_login():
|
|
100
|
+
"""Return list of hostnames with skipped login."""
|
|
101
|
+
response.content_type = 'application/json'
|
|
102
|
+
skip_db = DataBase("skip_login")
|
|
103
|
+
login_required_sites = ['al', 'dd', 'dl', 'nx']
|
|
104
|
+
skipped = []
|
|
105
|
+
for site in login_required_sites:
|
|
106
|
+
if skip_db.retrieve(site):
|
|
107
|
+
skipped.append(site)
|
|
108
|
+
return {"skipped": skipped}
|
|
109
|
+
|
|
110
|
+
@app.delete("/api/skip-login/<shorthand>")
|
|
111
|
+
def clear_skip_login(shorthand):
|
|
112
|
+
"""Clear skip login preference for a hostname."""
|
|
113
|
+
response.content_type = 'application/json'
|
|
114
|
+
shorthand = shorthand.lower()
|
|
115
|
+
login_required_sites = ['al', 'dd', 'dl', 'nx']
|
|
116
|
+
if shorthand not in login_required_sites:
|
|
117
|
+
return {"success": False, "error": f"Invalid shorthand: {shorthand}"}
|
|
118
|
+
|
|
119
|
+
skip_db = DataBase("skip_login")
|
|
120
|
+
skip_db.delete(shorthand)
|
|
121
|
+
info(f'Skip login preference cleared for "{shorthand.upper()}"')
|
|
122
|
+
return {"success": True}
|
|
123
|
+
|
|
124
|
+
@app.get('/flaresolverr')
|
|
125
|
+
def flaresolverr_ui():
|
|
126
|
+
"""Web UI page for configuring FlareSolverr."""
|
|
127
|
+
skip_db = DataBase("skip_flaresolverr")
|
|
128
|
+
is_skipped = skip_db.retrieve("skipped")
|
|
129
|
+
current_url = Config('FlareSolverr').get('url') or ""
|
|
130
|
+
|
|
131
|
+
skip_indicator = ""
|
|
132
|
+
if is_skipped:
|
|
133
|
+
skip_indicator = '''
|
|
134
|
+
<div class="skip-indicator" style="margin-bottom:1rem; padding:0.75rem; background:var(--code-bg, #f8f9fa); border-radius:0.25rem; font-size:0.875rem;">
|
|
135
|
+
<span style="color:#dc3545;">⚠️ FlareSolverr setup was skipped</span>
|
|
136
|
+
<p style="margin:0.5rem 0 0 0; font-size:0.75rem; color:var(--secondary, #6c757d);">
|
|
137
|
+
Some sites (like AL) won't work until FlareSolverr is configured.
|
|
138
|
+
</p>
|
|
139
|
+
</div>
|
|
140
|
+
'''
|
|
141
|
+
|
|
142
|
+
form_content = f'''
|
|
143
|
+
{skip_indicator}
|
|
144
|
+
<span><a href="https://github.com/FlareSolverr/FlareSolverr?tab=readme-ov-file#installation" target="_blank">FlareSolverr</a>
|
|
145
|
+
must be running and reachable to Quasarr for some sites to work.</span><br><br>
|
|
146
|
+
<label for="url">FlareSolverr URL</label>
|
|
147
|
+
<input type="text" id="url" name="url" placeholder="http://192.168.0.1:8191/v1" value="{current_url}"><br>
|
|
148
|
+
'''
|
|
149
|
+
|
|
150
|
+
form_html = f'''
|
|
151
|
+
<form action="/api/flaresolverr" method="post" onsubmit="return handleSubmit(this)">
|
|
152
|
+
{form_content}
|
|
153
|
+
{render_button("Save", "primary", {"type": "submit", "id": "submitBtn"})}
|
|
154
|
+
</form>
|
|
155
|
+
<p style="font-size:0.875rem; color:var(--secondary, #6c757d); margin-top:1rem;">
|
|
156
|
+
A restart is recommended after configuring FlareSolverr.
|
|
157
|
+
</p>
|
|
158
|
+
<div class="section-divider" style="margin-top:1.5rem; padding-top:1rem; border-top:1px solid var(--divider-color, #dee2e6);">
|
|
159
|
+
{render_button("Restart Quasarr", "secondary", {"type": "button", "onclick": "confirmRestart()"})}
|
|
160
|
+
</div>
|
|
161
|
+
<p>{render_button("Back", "secondary", {"onclick": "location.href='/';"})}</p>
|
|
162
|
+
<script>
|
|
163
|
+
var formSubmitted = false;
|
|
164
|
+
function handleSubmit(form) {{
|
|
165
|
+
if (formSubmitted) return false;
|
|
166
|
+
formSubmitted = true;
|
|
167
|
+
var btn = document.getElementById('submitBtn');
|
|
168
|
+
if (btn) {{ btn.disabled = true; btn.textContent = 'Saving...'; }}
|
|
169
|
+
return true;
|
|
170
|
+
}}
|
|
171
|
+
function confirmRestart() {{
|
|
172
|
+
if (confirm('Restart Quasarr now?')) {{
|
|
173
|
+
fetch('/api/restart', {{ method: 'POST' }})
|
|
174
|
+
.then(response => response.json())
|
|
175
|
+
.then(data => {{
|
|
176
|
+
if (data.success) {{
|
|
177
|
+
showRestartOverlay();
|
|
178
|
+
}}
|
|
179
|
+
}})
|
|
180
|
+
.catch(error => {{
|
|
181
|
+
showRestartOverlay();
|
|
182
|
+
}});
|
|
183
|
+
}}
|
|
184
|
+
}}
|
|
185
|
+
function showRestartOverlay() {{
|
|
186
|
+
document.body.innerHTML = `
|
|
187
|
+
<div style="text-align:center; padding:2rem; font-family:system-ui,-apple-system,sans-serif;">
|
|
188
|
+
<h2>Restarting Quasarr...</h2>
|
|
189
|
+
<p id="restartStatus">Waiting <span id="countdown">10</span> seconds...</p>
|
|
190
|
+
<div id="spinner" style="display:none; margin-top:1rem;">
|
|
191
|
+
<div style="display:inline-block; width:24px; height:24px; border:3px solid #ccc; border-top-color:#333; border-radius:50%; animation:spin 1s linear infinite;"></div>
|
|
192
|
+
<style>@keyframes spin {{ to {{ transform: rotate(360deg); }} }}</style>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
`;
|
|
196
|
+
startCountdown(10);
|
|
197
|
+
}}
|
|
198
|
+
function startCountdown(seconds) {{
|
|
199
|
+
var countdownEl = document.getElementById('countdown');
|
|
200
|
+
var statusEl = document.getElementById('restartStatus');
|
|
201
|
+
var spinnerEl = document.getElementById('spinner');
|
|
202
|
+
var remaining = seconds;
|
|
203
|
+
var interval = setInterval(function() {{
|
|
204
|
+
remaining--;
|
|
205
|
+
if (countdownEl) countdownEl.textContent = remaining;
|
|
206
|
+
if (remaining <= 0) {{
|
|
207
|
+
clearInterval(interval);
|
|
208
|
+
statusEl.textContent = 'Reconnecting...';
|
|
209
|
+
spinnerEl.style.display = 'block';
|
|
210
|
+
tryReconnect();
|
|
211
|
+
}}
|
|
212
|
+
}}, 1000);
|
|
213
|
+
}}
|
|
214
|
+
function tryReconnect() {{
|
|
215
|
+
var statusEl = document.getElementById('restartStatus');
|
|
216
|
+
var attempts = 0;
|
|
217
|
+
function attempt() {{
|
|
218
|
+
attempts++;
|
|
219
|
+
fetch('/', {{ method: 'HEAD', cache: 'no-store' }})
|
|
220
|
+
.then(response => {{
|
|
221
|
+
if (response.ok) {{
|
|
222
|
+
statusEl.textContent = 'Connected! Reloading...';
|
|
223
|
+
setTimeout(function() {{ window.location.href = '/'; }}, 500);
|
|
224
|
+
}} else {{
|
|
225
|
+
scheduleRetry();
|
|
226
|
+
}}
|
|
227
|
+
}})
|
|
228
|
+
.catch(function() {{
|
|
229
|
+
scheduleRetry();
|
|
230
|
+
}});
|
|
231
|
+
}}
|
|
232
|
+
function scheduleRetry() {{
|
|
233
|
+
statusEl.textContent = 'Reconnecting... (attempt ' + attempts + ')';
|
|
234
|
+
setTimeout(attempt, 1000);
|
|
235
|
+
}}
|
|
236
|
+
attempt();
|
|
237
|
+
}}
|
|
238
|
+
</script>
|
|
239
|
+
'''
|
|
240
|
+
return render_form("Configure FlareSolverr", form_html)
|
|
241
|
+
|
|
242
|
+
@app.post('/api/flaresolverr')
|
|
243
|
+
def set_flaresolverr_url():
|
|
244
|
+
"""Save FlareSolverr URL from web UI."""
|
|
245
|
+
url = request.forms.get('url', '').strip()
|
|
246
|
+
config = Config("FlareSolverr")
|
|
247
|
+
|
|
248
|
+
if not url:
|
|
249
|
+
return render_fail("Please provide a FlareSolverr URL.")
|
|
250
|
+
|
|
251
|
+
if not url.startswith("http://") and not url.startswith("https://"):
|
|
252
|
+
url = "http://" + url
|
|
253
|
+
|
|
254
|
+
# Validate URL format
|
|
255
|
+
if not re.search(r"/v\d+$", url):
|
|
256
|
+
return render_fail("FlareSolverr URL must end with /v1 (or similar version path).")
|
|
257
|
+
|
|
258
|
+
try:
|
|
259
|
+
headers = {"Content-Type": "application/json"}
|
|
260
|
+
data = {
|
|
261
|
+
"cmd": "request.get",
|
|
262
|
+
"url": "http://www.google.com/",
|
|
263
|
+
"maxTimeout": 30000
|
|
264
|
+
}
|
|
265
|
+
resp = requests.post(url, headers=headers, json=data, timeout=30)
|
|
266
|
+
if resp.status_code == 200:
|
|
267
|
+
json_data = resp.json()
|
|
268
|
+
if json_data.get("status") == "ok":
|
|
269
|
+
config.save("url", url)
|
|
270
|
+
# Clear skip preference since we now have a working URL
|
|
271
|
+
DataBase("skip_flaresolverr").delete("skipped")
|
|
272
|
+
# Update user agent from FlareSolverr response
|
|
273
|
+
solution = json_data.get("solution", {})
|
|
274
|
+
solution_ua = solution.get("userAgent")
|
|
275
|
+
if solution_ua:
|
|
276
|
+
shared_state.update("user_agent", solution_ua)
|
|
277
|
+
info(f'FlareSolverr URL configured: "{url}"')
|
|
278
|
+
return render_reconnect_success(
|
|
279
|
+
"FlareSolverr URL saved successfully! A restart is recommended.")
|
|
280
|
+
else:
|
|
281
|
+
return render_fail(f"FlareSolverr returned unexpected status: {json_data.get('status')}")
|
|
282
|
+
except requests.RequestException as e:
|
|
283
|
+
return render_fail(f"Could not reach FlareSolverr: {str(e)}")
|
|
284
|
+
|
|
285
|
+
return render_fail("Could not reach FlareSolverr at that URL (expected HTTP 200).")
|
|
286
|
+
|
|
287
|
+
@app.get("/api/flaresolverr/status")
|
|
288
|
+
def get_flaresolverr_status():
|
|
289
|
+
"""Return FlareSolverr configuration status."""
|
|
290
|
+
response.content_type = 'application/json'
|
|
291
|
+
skip_db = DataBase("skip_flaresolverr")
|
|
292
|
+
is_skipped = bool(skip_db.retrieve("skipped"))
|
|
293
|
+
current_url = Config('FlareSolverr').get('url') or ""
|
|
294
|
+
|
|
295
|
+
# Test connection if URL is set
|
|
296
|
+
is_working = False
|
|
297
|
+
if current_url and not is_skipped:
|
|
298
|
+
is_working = check_flaresolverr(shared_state, current_url)
|
|
299
|
+
|
|
300
|
+
return {
|
|
301
|
+
"skipped": is_skipped,
|
|
302
|
+
"url": current_url,
|
|
303
|
+
"working": is_working
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
@app.delete("/api/skip-flaresolverr")
|
|
307
|
+
def clear_skip_flaresolverr():
|
|
308
|
+
"""Clear skip FlareSolverr preference."""
|
|
309
|
+
response.content_type = 'application/json'
|
|
310
|
+
skip_db = DataBase("skip_flaresolverr")
|
|
311
|
+
skip_db.delete("skipped")
|
|
312
|
+
info('Skip FlareSolverr preference cleared')
|
|
313
|
+
return {"success": True}
|
|
314
|
+
|
|
315
|
+
@app.post("/api/restart")
|
|
316
|
+
def restart_quasarr():
|
|
317
|
+
"""Restart Quasarr. In Docker with the restart loop, exit(0) triggers restart."""
|
|
318
|
+
response.content_type = 'application/json'
|
|
319
|
+
info("Restart requested via web UI")
|
|
320
|
+
|
|
321
|
+
def delayed_exit():
|
|
322
|
+
time.sleep(0.5)
|
|
323
|
+
# Send SIGINT to main process - triggers KeyboardInterrupt handler
|
|
324
|
+
os.kill(os.getpid(), signal.SIGINT)
|
|
325
|
+
|
|
326
|
+
threading.Thread(target=delayed_exit, daemon=True).start()
|
|
327
|
+
return {"success": True, "message": "Restarting..."}
|
|
@@ -9,6 +9,7 @@ from Cryptodome.Cipher import AES
|
|
|
9
9
|
from PIL import Image, ImageChops
|
|
10
10
|
|
|
11
11
|
from quasarr.providers.log import info, debug
|
|
12
|
+
from quasarr.providers.utils import is_flaresolverr_available
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class CNL:
|
|
@@ -137,7 +138,7 @@ def decrypt_content(content_items: list[dict], mirror: str | None) -> list[str]:
|
|
|
137
138
|
decrypted_links.extend(urls)
|
|
138
139
|
debug(f"[Item {idx} | hoster={hoster_name}] Decrypted {len(urls)} URLs")
|
|
139
140
|
except Exception as e:
|
|
140
|
-
# Log and keep going; one bad item won
|
|
141
|
+
# Log and keep going; one bad item won't stop the rest.
|
|
141
142
|
info(f"[Item {idx} | hoster={hoster_name}] Error during decryption: {e}")
|
|
142
143
|
|
|
143
144
|
return decrypted_links
|
|
@@ -160,6 +161,11 @@ def calculate_pixel_based_difference(img1, img2):
|
|
|
160
161
|
|
|
161
162
|
|
|
162
163
|
def solve_captcha(hostname, shared_state, fetch_via_flaresolverr, fetch_via_requests_session):
|
|
164
|
+
# Check if FlareSolverr is available
|
|
165
|
+
if not is_flaresolverr_available(shared_state):
|
|
166
|
+
raise RuntimeError("FlareSolverr is required for CAPTCHA solving but is not configured. "
|
|
167
|
+
"Please configure FlareSolverr in the web UI.")
|
|
168
|
+
|
|
163
169
|
al = shared_state.values["config"]("Hostnames").get(hostname)
|
|
164
170
|
captcha_base = f"https://www.{al}/files/captcha"
|
|
165
171
|
|
|
@@ -195,7 +201,7 @@ def solve_captcha(hostname, shared_state, fetch_via_flaresolverr, fetch_via_requ
|
|
|
195
201
|
for image_id, raw_bytes in images:
|
|
196
202
|
img = Image.open(BytesIO(raw_bytes))
|
|
197
203
|
|
|
198
|
-
# if it
|
|
204
|
+
# if it's a palette (P) image with an indexed transparency, go through RGBA
|
|
199
205
|
if img.mode == "P" and "transparency" in img.info:
|
|
200
206
|
img = img.convert("RGBA")
|
|
201
207
|
|
|
@@ -17,6 +17,7 @@ from quasarr.providers.log import info, debug
|
|
|
17
17
|
from quasarr.providers.sessions.al import retrieve_and_validate_session, invalidate_session, unwrap_flaresolverr_body, \
|
|
18
18
|
fetch_via_flaresolverr, fetch_via_requests_session
|
|
19
19
|
from quasarr.providers.statistics import StatsHelper
|
|
20
|
+
from quasarr.providers.utils import is_flaresolverr_available
|
|
20
21
|
|
|
21
22
|
hostname = "al"
|
|
22
23
|
|
|
@@ -552,6 +553,12 @@ def get_al_download_links(shared_state, url, mirror, title, password):
|
|
|
552
553
|
This is set by the search module, not a user password.
|
|
553
554
|
"""
|
|
554
555
|
|
|
556
|
+
# Check if FlareSolverr is available - AL requires it
|
|
557
|
+
if not is_flaresolverr_available(shared_state):
|
|
558
|
+
info(f'"{hostname.upper()}" requires FlareSolverr which is not configured. '
|
|
559
|
+
f'Please configure FlareSolverr in the web UI to use this site.')
|
|
560
|
+
return {}
|
|
561
|
+
|
|
555
562
|
release_id = password # password field carries release_id for AL
|
|
556
563
|
|
|
557
564
|
al = shared_state.values["config"]("Hostnames").get(hostname)
|
|
@@ -10,6 +10,7 @@ from bs4 import BeautifulSoup
|
|
|
10
10
|
|
|
11
11
|
from quasarr.providers.cloudflare import flaresolverr_get, is_cloudflare_challenge
|
|
12
12
|
from quasarr.providers.log import info, debug
|
|
13
|
+
from quasarr.providers.utils import is_flaresolverr_available
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def resolve_wd_redirect(url, user_agent):
|
|
@@ -47,8 +48,13 @@ def get_wd_download_links(shared_state, url, mirror, title, password):
|
|
|
47
48
|
try:
|
|
48
49
|
output = requests.get(url)
|
|
49
50
|
if output.status_code == 403 or is_cloudflare_challenge(output.text):
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
if is_flaresolverr_available(shared_state):
|
|
52
|
+
info("WD is protected by Cloudflare. Using FlareSolverr to bypass protection.")
|
|
53
|
+
output = flaresolverr_get(shared_state, url)
|
|
54
|
+
else:
|
|
55
|
+
info("WD is protected by Cloudflare but FlareSolverr is not configured. "
|
|
56
|
+
"Please configure FlareSolverr in the web UI to access this site.")
|
|
57
|
+
return {"links": [], "imdb_id": None}
|
|
52
58
|
|
|
53
59
|
soup = BeautifulSoup(output.text, "html.parser")
|
|
54
60
|
|
|
@@ -76,6 +82,10 @@ def get_wd_download_links(shared_state, url, mirror, title, password):
|
|
|
76
82
|
link_tags = body.find_all(
|
|
77
83
|
"a", href=True, class_=lambda c: c and "background-" in c
|
|
78
84
|
)
|
|
85
|
+
except RuntimeError as e:
|
|
86
|
+
# Catch FlareSolverr not configured error
|
|
87
|
+
info(f"WD access failed: {e}")
|
|
88
|
+
return {"links": [], "imdb_id": None}
|
|
79
89
|
except Exception:
|
|
80
90
|
info(f"WD site has been updated. Grabbing download links for {title} not possible!")
|
|
81
91
|
return {"links": [], "imdb_id": None}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import requests
|
|
6
6
|
from bs4 import BeautifulSoup
|
|
7
7
|
|
|
8
|
+
from quasarr.providers.utils import is_flaresolverr_available
|
|
9
|
+
|
|
8
10
|
|
|
9
11
|
def is_cloudflare_challenge(html: str) -> bool:
|
|
10
12
|
soup = BeautifulSoup(html, "html.parser")
|
|
@@ -39,9 +41,14 @@ def update_session_via_flaresolverr(info,
|
|
|
39
41
|
sess,
|
|
40
42
|
target_url: str,
|
|
41
43
|
timeout: int = 60):
|
|
44
|
+
# Check if FlareSolverr is available
|
|
45
|
+
if not is_flaresolverr_available(shared_state):
|
|
46
|
+
info("FlareSolverr is not configured. Cannot bypass Cloudflare protection.")
|
|
47
|
+
return False
|
|
48
|
+
|
|
42
49
|
flaresolverr_url = shared_state.values["config"]('FlareSolverr').get('url')
|
|
43
50
|
if not flaresolverr_url:
|
|
44
|
-
info("Cannot proceed without FlareSolverr. Please
|
|
51
|
+
info("Cannot proceed without FlareSolverr. Please configure it in the web UI!")
|
|
45
52
|
return False
|
|
46
53
|
|
|
47
54
|
fs_payload = {
|
|
@@ -104,6 +111,12 @@ def ensure_session_cf_bypassed(info, shared_state, session, url, headers):
|
|
|
104
111
|
|
|
105
112
|
# If page is protected, try FlareSolverr
|
|
106
113
|
if resp.status_code == 403 or is_cloudflare_challenge(resp.text):
|
|
114
|
+
# Check if FlareSolverr is available before attempting bypass
|
|
115
|
+
if not is_flaresolverr_available(shared_state):
|
|
116
|
+
info("Cloudflare protection detected but FlareSolverr is not configured. "
|
|
117
|
+
"Please configure FlareSolverr in the web UI to access this site.")
|
|
118
|
+
return None, None, None
|
|
119
|
+
|
|
107
120
|
info("Encountered Cloudflare protection. Solving challenge with FlareSolverr...")
|
|
108
121
|
flaresolverr_result = update_session_via_flaresolverr(info, shared_state, session, url)
|
|
109
122
|
if not flaresolverr_result:
|
|
@@ -156,7 +169,13 @@ def flaresolverr_get(shared_state, url, timeout=60):
|
|
|
156
169
|
"""
|
|
157
170
|
Core function for performing a GET request via FlareSolverr only.
|
|
158
171
|
Used internally by FlareSolverrSession.get()
|
|
172
|
+
|
|
173
|
+
Returns None if FlareSolverr is not available.
|
|
159
174
|
"""
|
|
175
|
+
# Check if FlareSolverr is available
|
|
176
|
+
if not is_flaresolverr_available(shared_state):
|
|
177
|
+
raise RuntimeError("FlareSolverr is not configured. Please configure it in the web UI.")
|
|
178
|
+
|
|
160
179
|
flaresolverr_url = shared_state.values["config"]('FlareSolverr').get('url')
|
|
161
180
|
if not flaresolverr_url:
|
|
162
181
|
raise RuntimeError("FlareSolverr URL not configured in shared_state.")
|