Skip to content

Instantly share code, notes, and snippets.

@trwatson
Created July 27, 2018 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trwatson/dea3243365a879f36ebd03e9e748da5f to your computer and use it in GitHub Desktop.
Save trwatson/dea3243365a879f36ebd03e9e748da5f to your computer and use it in GitHub Desktop.
Thingiverse Thing Downloader for Linux
#!/bin/bash
thingid=${1}
descr=$(curl -s https://www.thingiverse.com/thing:${thingid} | grep -A1 "dc:title" | tail -n1 | tr -s " " | sed 's/<\/span>//g' | tr -cd 'A-Za-z0-9_-')
zipURL="https://www.thingiverse.com/thing:${thingid}/zip"
dlDir="$(dirname "$0")/thing_files"
mkdir -p ${dlDir}/${descr}
echo "Writing file: ${dlDir}/${descr}/${descr}.zip"
curl -sL ${zipURL} -o ${dlDir}/${descr}/${descr}.zip
cd ${dlDir}/${descr}/
unzip ${descr}.zip && rm -f ${descr}.zip
mkdir stl
echo "Moving STL Files: $(find . -iname "*.stl")"
find . -iname "*.stl" -exec mv {} stl \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment