From b454ebd6e5d9896b2404b0cfe25524867fc08d55 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Wed, 20 Jan 2021 23:00:26 +1300 Subject: [PATCH] Remove origin from caption URL --- tools/converters.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/converters.py b/tools/converters.py index 68d34b8..3a8e3ae 100644 --- a/tools/converters.py +++ b/tools/converters.py @@ -2,7 +2,7 @@ import configuration import datetime import re import time -from urllib.parse import urlparse, parse_qs, quote_plus +from urllib.parse import urlparse, urlencode, parse_qs def length_text_to_seconds(text): s = text.split(":") @@ -214,12 +214,12 @@ def get_language_label_from_url(url_string): return label def get_subtitle_api_url(id, label, language_code): - subtitle_api_url = "{}/api/v1/captions/{}?".format(configuration.website_origin, id) + subtitle_api_url = "/api/v1/captions/{}?".format(id) + params = {} - if label == "": - label = language_code - subtitle_api_url += "lang=" + quote_plus(language_code) + if label: + params["label"] = label else: - subtitle_api_url += "label=" + quote_plus(label) + params["lang"] = language_code - return subtitle_api_url + return subtitle_api_url + urlencode(params)