[deviantart] unescape \' in JSON data (#6653)

https://github.com/mikf/gallery-dl/issues/6653#issuecomment-2833783238
This commit is contained in:
Mike Fährmann
2025-04-28 09:42:16 +02:00
parent 9b43a3677e
commit 0725eab34f
2 changed files with 16 additions and 1 deletions

View File

@@ -868,7 +868,9 @@ x2="45.4107524%" y2="71.4898596%" id="app-root-3">\
yield self.api.deviation(deviation_uuid)
def _unescape_json(self, json):
return json.replace('\\"', '"').replace("\\\\", "\\")
return json.replace('\\"', '"') \
.replace("\\'", "'") \
.replace("\\\\", "\\")
class DeviantartUserExtractor(DeviantartExtractor):

View File

@@ -942,6 +942,19 @@ __tests__ = (
"num" : range(1, 4),
},
{
"#url" : "https://www.deviantart.com/exusiasword/art/Zenith-and-Silpha-combo-1186254616",
"#comment" : "JSON escapes in 'additionalMedia' (#6653)",
"#category": ("", "deviantart", "deviation"),
"#class" : deviantart.DeviantartDeviationExtractor,
"#archive" : False,
"#pattern" : (
r"https://wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/54e06808-f21d-4b8d-bd48-bdea03cf0af5/djm9jx4-23fc1032-ee0d-460b-ac52-fcdf5e871317\.jpg\?token=ey.+",
r"https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/54e06808-f21d-4b8d-bd48-bdea03cf0af5/djm9jx4-7710b540-c27c-41f2-ae84-9d050ec170bc\.png\?token=ey.+",
r"https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/54e06808-f21d-4b8d-bd48-bdea03cf0af5/djm9jx4-e04525ea-b781-451a-ae70-b66243417868\.png\?token=ey.+",
),
},
{
"#url" : "https://deviantart.com/view/904858796/",
"#comment" : "/view/ URLs",