replace json.loads with direct calls to JSONDecoder.decode

This commit is contained in:
Mike Fährmann
2023-02-07 23:14:53 +01:00
parent b7337d810e
commit dd884b02ee
42 changed files with 117 additions and 154 deletions

View File

@@ -7,8 +7,7 @@
"""Extractors for https://lightroom.adobe.com/"""
from .common import Extractor, Message
from .. import text
import json
from .. import text, util
class LightroomGalleryExtractor(Extractor):
@@ -46,7 +45,7 @@ class LightroomGalleryExtractor(Extractor):
# Get config
url = "https://lightroom.adobe.com/shares/" + self.href
response = self.request(url)
album = json.loads(
album = util.json_loads(
text.extr(response.text, "albumAttributes: ", "\n")
)
@@ -75,7 +74,7 @@ class LightroomGalleryExtractor(Extractor):
url = base_url + next_url
page = self.request(url).text
# skip 1st line as it's a JS loop
data = json.loads(page[page.index("\n") + 1:])
data = util.json_loads(page[page.index("\n") + 1:])
base_url = data["base"]
for res in data["resources"]: