Created
July 27, 2018 17:58
-
-
Save trwatson/dea3243365a879f36ebd03e9e748da5f to your computer and use it in GitHub Desktop.
Thingiverse Thing Downloader for Linux
This file contains 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 | |
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