mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-28 10:38:26 +00:00
Added validation for V.I.P. account status in titulky provider
This commit is contained in:
parent
68a9f2fb0c
commit
3653ef163f
1 changed files with 11 additions and 3 deletions
|
@ -5,6 +5,7 @@ import math
|
||||||
import re
|
import re
|
||||||
import zipfile
|
import zipfile
|
||||||
from random import randint
|
from random import randint
|
||||||
|
from urllib.parse import urlparse, parse_qs
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
import rarfile
|
import rarfile
|
||||||
|
@ -266,8 +267,13 @@ class TitulkyProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
allow_redirects=False,
|
allow_redirects=False,
|
||||||
timeout=self.timeout)
|
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 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']:
|
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
|
return True
|
||||||
else:
|
else:
|
||||||
raise AuthenticationError("Login failed")
|
raise AuthenticationError("Login failed")
|
||||||
|
@ -279,8 +285,10 @@ class TitulkyProvider(Provider, ProviderSubtitleArchiveMixin):
|
||||||
allow_redirects=False,
|
allow_redirects=False,
|
||||||
timeout=self.timeout)
|
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 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
|
return True
|
||||||
else:
|
else:
|
||||||
raise AuthenticationError("Logout failed.")
|
raise AuthenticationError("Logout failed.")
|
||||||
|
|
Loading…
Reference in a new issue