From 8a9fbbeaece5099e6bcac708a1fed8a80de5a2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Bart=C3=ADk?= <63553146+sambartik@users.noreply.github.com> Date: Wed, 9 Mar 2022 20:08:26 +0100 Subject: [PATCH] Fixed titulky provider UnicodeEncodeError --- libs/subliminal_patch/providers/titulky.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/subliminal_patch/providers/titulky.py b/libs/subliminal_patch/providers/titulky.py index e48e38d21..29a125ff4 100644 --- a/libs/subliminal_patch/providers/titulky.py +++ b/libs/subliminal_patch/providers/titulky.py @@ -5,7 +5,7 @@ import math import re import zipfile from random import randint -from urllib.parse import urlparse, parse_qs +from urllib.parse import urlparse, parse_qs, quote from threading import Thread import rarfile @@ -314,7 +314,7 @@ class TitulkyProvider(Provider, ProviderSubtitleArchiveMixin): # GET request a page. This functions acts as a requests.session.get proxy handling expired cached cookies # and subsequent relogging and sending the original request again. If all went well, returns the response. - def get_request(self, url, ref=None, __recursion=0): + def get_request(self, url, ref=server_url, __recursion=0): # That's deep... recursion... Stop. We don't have infinite memmory. And don't want to # spam titulky's server either. So we have to just accept the defeat. Let it throw! if __recursion >= 5: @@ -327,7 +327,7 @@ class TitulkyProvider(Provider, ProviderSubtitleArchiveMixin): url, timeout=self.timeout, allow_redirects=False, - headers={'Referer': ref if ref else self.server_url}) + headers={'Referer': quote(ref)}) # Check if we got redirected because login cookies expired. # Note: microoptimization - don't bother parsing qs for non 302 responses.