Last active
December 12, 2023 03:37
-
-
Save MartinWeiss12/7b75c1689d564c8d34ffbffdadca4670 to your computer and use it in GitHub Desktop.
Download Images
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
def download_images(folder, type): | |
top_49 = folder[f'{type} Image URL'][:49] | |
folder_path = os.path.abspath(f'{type}-Images') | |
for i, url in enumerate(top_49): | |
with open(os.path.join(folder_path, f'{type}-{i+1}.png'), 'wb') as file: | |
file.write(requests.get(url).content) | |
download_images(top_albums, 'Album') | |
download_images(top_artists, 'Artist') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment