Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: do not use regex to parse_json

NTFSvolume64146fea4ff1
diff --git a/cyberdrop_dl/utils/javascript.py b/cyberdrop_dl/utils/javascript.py
index e5afb76ab..a79f364c3 100644
--- a/cyberdrop_dl/utils/javascript.py
+++ b/cyberdrop_dl/utils/javascript.py
@@ -34,12 +34,13 @@ def parse_js_vars(js_text: str) -> dict:
return data
-def parse_json_to_dict(js_text: str) -> dict:
+def parse_json_to_dict(js_text: str, use_regex: bool = True) -> dict:
json_str = js_text.replace("\t", "").replace("\n", "").replace("'", '"').strip()
- json_str = scape_urls(json_str)
- json_str = re.sub(*QUOTE_KEYS_REGEX, json_str)
- json_str = re.sub(*QUOTE_VALUES_REGEX, json_str)
- json_str = recover_urls(json_str)
+ if use_regex:
+ json_str = scape_urls(json_str)
+ json_str = re.sub(*QUOTE_KEYS_REGEX, json_str)
+ json_str = re.sub(*QUOTE_VALUES_REGEX, json_str)
+ json_str = recover_urls(json_str)
return json.loads(json_str)