Skip to content

Instantly share code, notes, and snippets.

@micycle1
Last active April 6, 2024 14:26
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save micycle1/735006a338e4bea1a9c06377610886e7 to your computer and use it in GitHub Desktop.
Save micycle1/735006a338e4bea1a9c06377610886e7 to your computer and use it in GitHub Desktop.
Downloading full-size media from DeviantArt

For direct image URL, the image quality is much lower than the original upload (the resolution and size of the original upload can be found in the right sidebar). This is not the case few years ago when the original image was accessible through right click, but on 2017, Wix acquired DeviantArt, and has been migrating the images to their own image hosting system from the original DeviantArt system. They linked most of the direct images to a stripped-down version of the original images; hence the bad image quality. Below are the three different formats of direct image URLs I found:

  • URL with /v1/fill inside: this means that the image went through Wix's encoding system and is modified to a specific size and quality. In this case, you remove ?token= and its values, add /intermediary in front of /f/ in the URL, and change the image settings right after /v1/fill/ to w_5100,h_5100,bl,q_100. The definitions of the values can be found in Wix's Image Service, but basically, w_5100,h_5100 requests the width and height of the image to be 5100x5100 pixels, bl requires the baseline JPEG version, and q_100 sets the quality to 100% of the original. The reasons to have this dimension are: (1) 5100 pixels is the limit of the system; anything above it will result in 400 Bad Request. (2) according to the Wix's API:

    In case the required image is larger than the original, upscale should be enabled (lg_1) in order for a proportional upscale to be applied. If upscale is not enabled, the returned image will maintain the original size.

    Example: original URL vs modified URL. The original url has a file size of 153 KB and 1024x1280 resolution, while the modified URL has a file size of 2.03 MB and 2190x2738 resolution. The result is still not as good as the original upload (4.2 MB and 2700×3375 resolution), but this is the closest I can get

    UPDATE: for new uploads, this trick no longer works. However, the image quality can still be changed. To do this, you keep everything in the image URL the same and change the part q_\d+,strp to q_100

  • URL with /f/ but no /v1/fill inside: this is the original image, so just download it

  • URL with https://img\d{2} or https://pre\d{2}: this means that the image went through DeviantArt's system and is modified to a specific size. I could not figure out how to get the original image from these types of links, i.e. find https://orig\d{2} from them, so I just download the image as is

@Lt-knb
Copy link

Lt-knb commented Apr 6, 2024

URL with /f/ but no /v1/fill inside: this is the original image, so just download it

It says Unauthorized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment