diff --git a/.gitignore b/.gitignore index 5a5a389..060dbcb 100644 --- a/.gitignore +++ b/.gitignore @@ -167,3 +167,4 @@ test/acceptanceTest.html config/config.json data/metadata.json data/book_N.json +data/photo/* diff --git a/api/download.py b/api/download.py index bf4965c..3e26d11 100644 --- a/api/download.py +++ b/api/download.py @@ -79,3 +79,16 @@ class Download: json.dump(result, f, indent=4) f.close() + def download_photos(cls) : + print("Downloading photos") + + photos = cls.api.get( + "items/Fotos", + params=None + ) + + for photo in tqdm(photos): + data = cls.api.get_file("assets/" + photo["photo"]) + file = open("./data/photo/" + str(photo["id"]) + ".jpg", "wb") + file.write(data) + file.close() \ No newline at end of file diff --git a/build.py b/build.py index dd5e620..88b5a89 100644 --- a/build.py +++ b/build.py @@ -9,3 +9,4 @@ dl = download.Download(api) dl.download_edition("N") dl.download_question_metadata() +dl.download_photos()