Skip to content

Instantly share code, notes, and snippets.

@MartinWeiss12
Last active December 12, 2023 03:37
Show Gist options
  • Save MartinWeiss12/7b75c1689d564c8d34ffbffdadca4670 to your computer and use it in GitHub Desktop.
Save MartinWeiss12/7b75c1689d564c8d34ffbffdadca4670 to your computer and use it in GitHub Desktop.
Download Images
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