positional arguments:
{collection,thing,user,batch,version}
Type of thing to download
- collection Download an entire collection
+ collection Download one or more entire collection(s)
thing Download a single thing.
- user Download all things by a user
+ user Download all things by one or more users
batch Perform multiple actions written in a text file
version Show the current version
````
### Things
-`thingy_grabber.py thing thingid`
-This will create a directory named after the title of the thing with the given ID and download the files into it.
+`thingy_grabber.py thing thingid1 thingid2 ...`
+This will create a directory named after the title of the thing(s) with the given ID(s) and download the files into it.
### Collections
-`thingy_grabber.py collection user_name collection_name`
-Where `user_name` is the name of the creator of the collection (not nes. your name!) and `collection_name` is the name of the collection you want.
+`thingy_grabber.py collection user_name collection_name1 collection_name2`
+Where `user_name` is the name of the creator of the collection (not nes. your name!) and `collection_name1...etc` are the name(s) of the collection(s) you want.
This will create a series of directorys `user-collection/thing-name` for each thing in the collection.
If for some reason a download fails, it will get moved sideways to `thing-name-failed` - this way if you rerun it, it will only reattmpt any failed things.
### User designs
-`thingy_grabber.py user_name`
-Where `user_name` is the name of a creator.
+`thingy_grabber.py user user_name1, user_name2..`
+Where `user_name1.. ` are the names of creator.
This will create a series of directories `user designs/thing-name` for each thing that user has designed.
If you are using linux, you can just add an appropriate call to the crontab. If you are using windows, it's a bit more of a faff, but at least according to [https://www.technipages.com/scheduled-task-windows](this link), you should be able to with a command something like this (this is not tested!): `schtasks /create /tn thingy_grabber /tr "c:\path\to\thingy_grabber.py -d c:\path\to\output\directory batch c:\path\to\batchfile.txt" /sc weekly /d wed /st 13:00:00`
You may have to play with the quotation marks to make that work though.
+## Examples
+`thingy_grabber.py collection cwoac bike`
+Download the collection 'bike' by the user 'cwoac'
+`thingy_grabber.py -d downloads -l warning thing 1234 4321 1232`
+Download the three things 1234, 4321 and 1232 into the directory downloads. Only give warnings.
+`thingy_grabber.py -d c:\downloads -l debug user jim bob`
+Download all designs by jim and bob into directories under `c:\downloads`, give lots of debug messages
+`
+
## Requirements
python3, beautifulsoup4, requests, lxml
- If there is an updated file, the old directory will be moved to `name_timestamp` where `timestamp` is the last upload time of the old files. The code will then copy unchanged files across and download any new ones.
## Changelog
+* v0.6.0
+ - added support for downloading multiple things/design sets/collections from the command line
* v0.5.0
- better logging options
- batch mode
try:
os.mkdir(image_dir)
for imagelink in imagelinks:
- url = imagelink['data-full']
+ url = next(filter(None,[imagelink[x] for x in ['data-full',
+ 'data-large',
+ 'data-medium',
+ 'data-thumb']]), None)
+ if not url:
+ logging.warning("Unable to find any urls for {}".format(imagelink))
+ continue
+
filename = os.path.basename(url)
if filename.endswith('stl'):
filename = "{}.png".format(filename)
subparsers = parser.add_subparsers(
help="Type of thing to download", dest="subcommand")
collection_parser = subparsers.add_parser(
- 'collection', help="Download an entire collection")
+ 'collection', help="Download one or more entire collection(s)")
collection_parser.add_argument(
- "owner", help="The owner of the collection to get")
+ "owner", help="The owner of the collection(s) to get")
collection_parser.add_argument(
- "collection", help="The name of the collection to get")
+ "collections", nargs="+", help="Space seperated list of the name(s) of collection to get")
thing_parser = subparsers.add_parser(
'thing', help="Download a single thing.")
- thing_parser.add_argument("thing", help="Thing ID to download")
+ thing_parser.add_argument("things", nargs="*", help="Space seperated list of thing ID(s) to download")
user_parser = subparsers.add_parser(
- "user", help="Download all things by a user")
- user_parser.add_argument("user", help="The user to get the designs of")
+ "user", help="Download all things by one or more users")
+ user_parser.add_argument("users", nargs="+", help="A space seperated list of the user(s) to get the designs of")
batch_parser = subparsers.add_parser(
"batch", help="Perform multiple actions written in a text file")
batch_parser.add_argument(
logging.basicConfig(level=getattr(logging, args.log_level.upper()))
if args.subcommand.startswith("collection"):
- Collection(args.owner, args.collection, args.directory).download()
+ for collection in args.collections:
+ Collection(args.owner, collection, args.directory).download()
if args.subcommand == "thing":
- Thing(args.thing).download(args.directory)
+ for thing in args.things:
+ Thing(thing).download(args.directory)
if args.subcommand == "user":
- Designs(args.user, args.directory).download()
+ for user in args.users:
+ Designs(user, args.directory).download()
if args.subcommand == "version":
print("thingy_grabber.py version {}".format(VERSION))
if args.subcommand == "batch":