diff --git a/docs/configuration.rst b/docs/configuration.rst index 369407b8..9260c916 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1354,14 +1354,12 @@ extractor.deviantart.jwt Type ``bool`` Default - ``false`` + ``true`` Description Update `JSON Web Tokens `__ (the ``token`` URL parameter) of otherwise non-downloadable, low-resolution images to be able to download them in full resolution. - Note: This got patched by DeviantArt on 2023-09-19 and no longer works. - extractor.deviantart.mature --------------------------- diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index 6ceb9371..9c0814cf 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -42,7 +42,7 @@ class DeviantartExtractor(Extractor): self.offset = 0 def _init(self): - self.jwt = self.config("jwt", False) + self.jwt = self.config("jwt", True) self.flat = self.config("flat", True) self.extra = self.config("extra", False) self.original = self.config("original", True) @@ -355,6 +355,9 @@ class DeviantartExtractor(Extractor): if not sep: return + # 'images-wixmp' returns 401 errors, but just 'wixmp' still works + url = url.replace("//images-wixmp", "//wixmp", 1) + # header = b'{"typ":"JWT","alg":"none"}' payload = ( b'{"sub":"urn:app:","iss":"urn:app:","obj":[[{"path":"/f/' + @@ -367,7 +370,7 @@ class DeviantartExtractor(Extractor): "{}?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.{}.".format( url, # base64 of 'header' is precomputed as 'eyJ0eX...' - # binascii.a2b_base64(header).rstrip(b"=\n").decode(), + # binascii.b2a_base64(header).rstrip(b"=\n").decode(), binascii.b2a_base64(payload).rstrip(b"=\n").decode()) )