-
-
Save neckothy/8668611c764ab2449fc8d42d222e5fa4 to your computer and use it in GitHub Desktop.
Attempt to save ComiXology covers by checking URLs sequentially from a starting id
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
import requests | |
BASE_URL = "https://m.media-amazon.com/images/S/cmx-images-prod/Item" | |
START_ID = 1036934 | |
ATTEMPTS = 10 | |
for attempt in range(ATTEMPTS): | |
current_id = START_ID + attempt | |
with requests.get(f"{BASE_URL}/{current_id}/{current_id}.jpg") as response: | |
if response.status_code == 200: | |
print(f"{current_id}: writing to file") | |
with open(f"{current_id}.jpg", "wb") as f: | |
f.write(response.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment