## Usage:
`thingy_grabber.py 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.
+This will create a series of directorys `user-collection/thing-name` for each thing in the collection.
+If a thing's directory already exists, it will be skipped.
+
+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.
+
## Requirements
python3, beautifulsoup4, requests, lxml
- download a single thing
- download things by designer
- less perfunctory error checking / handling
-- resume failed things
+- attempt to use -failed dirs for resuming
+- detect updated models and redownload them
file_links = file_soup.find_all('a', {'class':'file-download'})
files = [("{}{}".format(URL_BASE, x['href']), x["title"]) for x in file_links]
- for url, name in files:
- data_req = requests.get(url)
- with open(name, 'wb') as handle:
- handle.write(data_req.content)
+ try:
+ for url, name in files:
+ data_req = requests.get(url)
+ with open(name, 'wb') as handle:
+ handle.write(data_req.content)
+ except Exception as exception:
+ print("Failed to download {} - {}".format(name, exception))
+ os.chdir(base_dir)
+ os.rename(title, "{}_failed".format(title))
+ return
+
os.chdir(base_dir)
def main():