From agi-super-team
Scrapes all images from a given URL using Python3/curl, with fallback to browser automation for JavaScript-rendered pages. Downloads images locally.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agi-super-team:image-scraperThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Scrape all images from a given URL and download them locally.
Scrape all images from a given URL and download them locally.
#!/usr/bin/env python3
"""Download all images from a URL."""
import sys
import os
import re
import urllib.request
import urllib.error
from html.parser import HTMLParser
class ImageParser(HTMLParser):
def __init__(self):
super().__init__()
self.images = []
def handle_starttag(self, tag, attrs):
if tag == 'img':
for attr, val in attrs:
if attr == 'src' and val:
self.images.append(val)
if tag == 'source':
for attr, val in attrs:
if attr == 'src' and val:
self.images.append(val)
def scrape_images(url, output_dir="images"):
os.makedirs(output_dir, exist_ok=True)
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
with urllib.request.urlopen(req, timeout=15) as resp:
html = resp.read().decode('utf-8', errors='ignore')
parser = ImageParser()
parser.feed(html)
# Deduplicate and filter
seen = set()
urls = []
for img in parser.images:
if img.startswith('//'):
img = 'https:' + img
if img.startswith('http') and img not in seen:
seen.add(img)
urls.append(img)
print(f"Found {len(urls)} images")
for i, img_url in enumerate(urls):
try:
ext = os.path.splitext(img_url.split('?')[0])[1] or '.jpg'
fname = f"{output_dir}/img_{i:03d}{ext}"
urllib.request.urlretrieve(img_url, fname)
print(f" [{i+1}] {fname}")
except Exception as e:
print(f" [{i+1}] FAILED: {e}")
return urls
if __name__ == "__main__":
url = sys.argv[1] if len(sys.argv) > 1 else input("URL: ")
scrape_images(url)
Usage:
python3 /path/to/image-scraper.py "https://example.com/article"
# Extract image URLs and download
curl -sL "URL" | grep -oP 'https?://[^"]+\.(jpg|jpeg|png|webp|gif)' | sort -u | head -20 | while read url; do
curl -sL "$url" -o "images/$(echo $url | md5sum | cut -d' ' -f1).${url##*.}"
done
Use OpenClaw's browser tool when the page is JavaScript-rendered or Method 1 fails.
# 1. Open page in browser
browser(action=open, url="URL")
# 2. Get page content and extract images via JavaScript
browser(action=act, targetId="TAB_ID", request={
"kind": "evaluate",
"fn": "() => Array.from(document.querySelectorAll('img')).map(img => img.src)"
})
# 3. Download each image with curl
Referer, Accept)./images/ by defaultimg_000.jpg, img_001.png, etc.npx claudepluginhub aaaaqwq/agi-super-team --plugin agi-super-teamDownloads images from Google Gemini conversation pages using Chrome automation, opening lightbox previews, renaming files, and packaging as ZIP.
Downloads an entire website as local files (markdown, screenshots, multiple formats) by combining site mapping and scraping into organized directories. Useful for offline documentation, bulk saving, or local reference copies.
Downloads files (PDFs, CSVs, images) from websites using the browser's authenticated session, preserving cookies and login state. Also reads downloaded PDF content.