The easy way to download the highest resolution DeviantArt Galleries. For more information check this article.
1. Install python dependencies:
pip install -r requirements.txt
sudo pip3 install selenium
2. Install Chromium:
-
Debian Based
sudo apt install chromium-browser
-
Arch
sudo pacman -S chromium
3. Download the Chrome Driver.
- Download Chrome Driver. Note, the version should match your version of Chrome installed.
- Copy
chromedriver
into the folderdeviantart-scraper
.
To begin downloading images, use the following steps. Images will be downloaded into a default folder images
. Additionally, a metadata file gallery.txt
will be generated, containing the names of the files downloaded.
python3 devianart.py
The following command-line arguments are supported.
python3 devianart.py --help
usage: devianart.py [-h] [-d DIR] [-f FILENAME] [-u URL] [-c COUNT] [-r]
optional arguments:
-h, --help show this help message and exit
-d DIR, --dir DIR Directory to store images. Default: ./images
-f FILENAME, --filename FILENAME
Explicit base filename to use. Default: downloaded
filename
-u URL, --url URL DeviantArt gallery url to scrape images from. Default:
deviantart.com
-c COUNT, --count COUNT
Maximum number of images to download. Default: 25
-r, --random Download a random image. Default: False
You can automatically download and set the desktop background wallpaper by using the command-line arguments with a script or desktop background image changer utility. The following example demonstrates this for Windows wallpaper.ps1 and Linux Mint using wallpaper.sh.
The following Windows PowerShell script will automatically download and set the desktop wallpaper. To run this automatically every day:
- Open Task Scheduler by pressing Win + R, type taskschd.msc, and press Enter.
- In the Task Scheduler window, click on Create Task in the right-hand pane.
- For Triggers, set to run Daily.
- For Actions, in the Program/script field, enter powershell.exe.
- In the Add arguments (optional) field, enter -File "C:\Path\To\Your\Script\wallpaper.ps1"
- Click OK to save the task.
# Get the current logged-in user's profile path
$userProfile = [System.Environment]::GetFolderPath('UserProfile')
# Replace "\Documents\deviantart-scraper" with the path to deviantart-scraper.
$deviantArtScraperFolder = "Documents\deviantart-scraper"
# Define the folder containing the wallpapers.
$wallpaperFolder = "$userProfile\$deviantArtScraperFolder\images"
# Delete existing wallpaper files
Remove-Item -Path "$wallpaperFolder\wallpaper.jpg" -ErrorAction SilentlyContinue
Remove-Item -Path "$wallpaperFolder\wallpaper.png" -ErrorAction SilentlyContinue
Remove-Item -Path "$wallpaperFolder\wallpaper.jpeg" -ErrorAction SilentlyContinue
Remove-Item -Path "$wallpaperFolder\wallpaper.bmp" -ErrorAction SilentlyContinue
$url = "https://www.deviantart.com/topic/random"
# Download image
python "$userProfile\$deviantArtScraperFolder\devianart.py" -f wallpaper -c 1 -r -u $url
# Get all image files in the folder
$wallpapers = Get-ChildItem -Path $wallpaperFolder -Recurse | Where-Object { $_.Extension -match "jpg|jpeg|png|bmp" }
# Check if any wallpapers were found
if ($null -eq $wallpapers -or $wallpapers.Count -eq 0) {
Write-Host "No wallpapers found in the specified folder: $wallpaperFolder"
exit
}
# Select a random wallpaper
$randomWallpaper = Get-Random -InputObject $wallpapers
# Output the selected file for debugging
Write-Host "Selected file: "$randomWallpaper.FullName
# Set the wallpaper using SystemParametersInfo
$code = @"
using System;
using System.Runtime.InteropServices;
public class Wallpaper {
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
public static void SetWallpaper(string path) {
SystemParametersInfo(0x0014, 0, path, 0x01 | 0x02);
}
}
"@
Add-Type -TypeDefinition $code
[Wallpaper]::SetWallpaper($randomWallpaper.FullName)
The following Linux bash script will automatically download and set the desktop wallpaper.
#!/bin/bash
USER=$(whoami)
ORIGINAL_DIR=$(pwd)
# Fix to allow cronjob to accurately set the desktop background. https://askubuntu.com/a/198508
fl=$(find /proc -maxdepth 2 -user $USER -name environ -print -quit)
while [ -z $(grep -z DBUS_SESSION_BUS_ADDRESS "$fl" | cut -d= -f2- | tr -d '\000' ) ]
do
fl=$(find /proc -maxdepth 2 -user $USER -name environ -newer "$fl" -print -quit)
done
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS "$fl" | cut -d= -f2-)
echo $DBUS_SESSION_BUS_ADDRESS > /var/tmp/wallpaper.log
# Delete cached wallpaper.
rm -f /var/tmp/wallpaper.jpg /var/tmp/wallpaper.jpeg /var/tmp/wallpaper.gif /var/tmp/wallpaper.png
# Download image.
cd /home/$USER/Documents/deviantart-scraper/
python3 devianart.py -d /var/tmp -f wallpaper -c 1 -r >> /var/tmp/wallpaper.log
FILE_PATH=$(tail -n 1 /var/tmp/wallpaper.log)
cd $ORIGINAL_DIR
# Delete cached wallpaper.
rm -f /home/$USER/.cache/wallpaper/*
echo "Downloaded $FILE_PATH" >> /var/tmp/wallpaper.log
# Set new wallpaper.
gsettings set org.gnome.desktop.background picture-options "zoom"
gsettings set org.gnome.desktop.background picture-uri file://$FILE_PATH
You can automatically run the above bash script via cron job with the following command.
chmod +x wallpaper.sh
crontab -e
Paste the following lines to the end of the cron file.
# Add a cron job to run this script every 15 minutes.
*/15 * * * * /home/YOUR_USER_NAME/Documents/deviantart-scraper/wallpaper.sh
@reboot /home/YOUR_USER_NAME/Documents/deviantart-scraper/wallpaper.sh
The code is licensed under the MIT License.
Disclaimer: All art you download using this script belongs to their rightful owners. Please support them by purchasing their art.