-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_images_tool.py
More file actions
27 lines (25 loc) · 999 Bytes
/
check_images_tool.py
File metadata and controls
27 lines (25 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
import urllib.request
import re
def check_asin_images(asin):
print(f"Checking images for ASIN: {asin}")
# Try the standard ASIN-based URL pattern first
for i in range(1, 10):
v = f"{i:02d}"
url = f"https://images-na.ssl-images-amazon.com/images/P/{asin}.{v}._SCLZZZZZZZ_.jpg"
try:
req = urllib.request.Request(url, method='HEAD')
with urllib.request.urlopen(req) as resp:
if resp.status == 200:
content_length = resp.getheader('Content-Length')
if content_length and int(content_length) > 5000:
print(f"VALID: {url} (Size: {content_length})")
else:
print(f"INVALID (small/empty): {url}")
except Exception as e:
# print(f"ERROR: {url} - {e}")
pass
if __name__ == "__main__":
asins = ["B0D9R7Q449", "B0FBXD383M"]
for asin in asins:
check_asin_images(asin)