| 1 | # thingy_grabber |
| 2 | Script for archiving thingiverse things. Due to this being a glorified webscraper, it's going to be very fragile. |
| 3 | |
| 4 | ## Usage: |
| 5 | ```` |
| 6 | usage: thingy_grabber.py [-h] [-v] [-d DIRECTORY] {collection,thing,user,version} ... |
| 7 | |
| 8 | positional arguments: |
| 9 | {collection,thing,user,version} |
| 10 | Type of thing to download |
| 11 | collection Download an entire collection |
| 12 | thing Download a single thing. |
| 13 | user Download all things by a user |
| 14 | version Show the current version |
| 15 | |
| 16 | optional arguments: |
| 17 | -h, --help show this help message and exit |
| 18 | -v, --verbose Be more verbose |
| 19 | -d DIRECTORY, --directory DIRECTORY |
| 20 | Target directory to download into |
| 21 | ```` |
| 22 | |
| 23 | ### Things |
| 24 | `thingy_grabber.py thing thingid` |
| 25 | This will create a directory named after the title of the thing with the given ID and download the files into it. |
| 26 | |
| 27 | ### Collections |
| 28 | `thingy_grabber.py collection user_name collection_name` |
| 29 | 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. |
| 30 | |
| 31 | This will create a series of directorys `user-collection/thing-name` for each thing in the collection. |
| 32 | |
| 33 | 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. |
| 34 | |
| 35 | ### User designs |
| 36 | `thingy_grabber.py user_name` |
| 37 | Where `user_name` is the name of a creator. |
| 38 | |
| 39 | This will create a series of directories `user designs/thing-name` for each thing that user has designed. |
| 40 | |
| 41 | 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. |
| 42 | |
| 43 | ## Requirements |
| 44 | python3, beautifulsoup4, requests, lxml |
| 45 | |
| 46 | ## Current features: |
| 47 | - can download an entire collection, creating seperate subdirs for each thing in the collection |
| 48 | - If you run it again with the same settings, it will check for updated files and only update what has changed. This should make it suitible for syncing a collection on a cronjob |
| 49 | - 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. |
| 50 | |
| 51 | ## Changelog |
| 52 | * v0.4.0 |
| 53 | - Added a changelog |
| 54 | - Now download associated images |
| 55 | - support `-d` to specify base download directory |
| 56 | |
| 57 | ## Todo features (maybe): |
| 58 | - better progress support |
| 59 | - better batch mode |
| 60 | - less perfunctory error checking / handling |
| 61 | - attempt to use -failed dirs for resuming |
| 62 | |