Last active
July 29, 2025 04:59
-
-
Save Vocaned/15a6df03f3e91c1c3929365325942ca4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ./download_workshop.sh [steam workshop URL] | |
set -e | |
workshop_id=$(echo "$1" | grep -Po 'steamcommunity\.com/(sharedfiles|workshop)/filedetails/.*id=\K(\d+)') | |
if [ -z "$workshop_id" ]; then | |
echo "Could not extract ID from given URL" | |
exit 1 | |
fi | |
details=$(curl -s "https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/" -F "itemcount=1" -F "publishedfileids[0]=$workshop_id") | |
name=$(echo "$details" | jq ".response.publishedfiledetails[0].title") | |
if [ "$name" = "null" ]; then | |
echo "Could not find workshop item \"$workshop_id\". It might require logging in to an account that owns the game." | |
echo "Full output:" | |
echo "$details" | jq ".response.publishedfiledetails[0]" | |
exit 1 | |
fi | |
app_id=$(echo "$details" | jq ".response.publishedfiledetails[0].consumer_app_id") | |
echo "Downloading $name" | |
tmp=$(mktemp -d) | |
trap 'rm -r "$tmp"' EXIT | |
steamcmd +force_install_dir "$tmp" +login anonymous +workshop_download_item "$app_id" "$workshop_id" +quit &> /dev/null | |
if [ -d "$PWD/$workshop_id" ]; then | |
rm -r "$PWD/$workshop_id" | |
fi | |
mv "$tmp/steamapps/workshop/content/$app_id/$workshop_id" "$PWD" | |
if [ "$?" -eq 0 ]; then | |
echo "Downloaded $workshop_id to \"$PWD\"" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment