summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSamuel Bartík <[email protected]>2022-01-02 05:31:42 +0100
committerGitHub <[email protected]>2022-01-01 23:31:42 -0500
commit3653ef163fb76b716d2a00522c6faf9593697003 (patch)
treea00f4db756adfc68e3feb5f374d304c5d66ed695
parent68a9f2fb0c14ed2f844980ca63a704dd0afab340 (diff)
downloadbazarr-3653ef163fb76b716d2a00522c6faf9593697003.tar.gz
bazarr-3653ef163fb76b716d2a00522c6faf9593697003.zip
Added validation for V.I.P. account status in titulky providerv1.0.3-beta.2
-rw-r--r--libs/subliminal_patch/providers/titulky.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/subliminal_patch/providers/titulky.py b/libs/subliminal_patch/providers/titulky.py
index 7e7b63d09..7b33acd04 100644
--- a/libs/subliminal_patch/providers/titulky.py
+++ b/libs/subliminal_patch/providers/titulky.py
@@ -5,6 +5,7 @@ import math
import re
import zipfile
from random import randint
+from urllib.parse import urlparse, parse_qs
from threading import Thread
import rarfile
@@ -266,9 +267,14 @@ class TitulkyProvider(Provider, ProviderSubtitleArchiveMixin):
allow_redirects=False,
timeout=self.timeout)
+ location_qs = parse_qs(urlparse(res.headers['Location']).query)
+
# If the response is a redirect and doesnt point to an error message page, then we are logged in
- if res.status_code == 302 and 'msg_type=i' in res.headers['Location']:
- return True
+ if res.status_code == 302 and location_qs['msg_type'][0] == 'i':
+ if 'omezené' in location_qs['msg'][0]:
+ raise AuthenticationError("V.I.P. account is required for this provider to work!")
+ else:
+ return True
else:
raise AuthenticationError("Login failed")
@@ -279,8 +285,10 @@ class TitulkyProvider(Provider, ProviderSubtitleArchiveMixin):
allow_redirects=False,
timeout=self.timeout)
+ location_qs = parse_qs(urlparse(res.headers['Location']).query)
+
# If the response is a redirect and doesnt point to an error message page, then we are logged out
- if res.status_code == 302 and 'msg_type=i' in res.headers['Location']:
+ if res.status_code == 302 and location_qs['msg_type'][0] == 'i':
return True
else:
raise AuthenticationError("Logout failed.")