Switch Theme:

Bulk downloading of images off my gallery  [RSS] Share on facebook Share on Twitter Submit to Reddit
»
Author Message
Advert


Forum adverts like this one are shown to any user who is not logged in. Join us by filling out a tiny 3 field form and you will get your own, free, dakka user account which gives a good range of benefits to you:
  • No adverts like this in the forums anymore.
  • Times and dates in your local timezone.
  • Full tracking of what you have read so you can skip to your first unread post, easily see what has changed since you last logged in, and easily see what is new at a glance.
  • Email notifications for threads you want to watch closely.
  • Being a part of the oldest wargaming community on the net.
If you are already a member then feel free to login now.




Made in gb
Leader of the Sept







Hi

I'm keen to re-download all my gallery images. Is there an elegant way to do a bulk download, or do I need to do it one at a time?

Please excuse any spelling errors. I use a tablet frequently and software keyboards are a pain!

Terranwing - w3;d1;l1
51st Dunedinw2;d0;l0
Cadre Coronal Afterglow w1;d0;l0 
   
Made in in
[MOD]
Otiose in a Niche






Hyderabad, India

Not that I know of. Lego Burner would have to chime in to say if there's a backend solution he could offer to users.

There's a block delete button so maybe...

 
   
Made in gb
[ADMIN]
Decrepit Dakkanaut






London, UK

There's no built-in or trivial way to do it, but you could learn and use wget to script it, then delete all files you download under a certain size to automatically cut out thumbnails.

If you are able to learn the basics of python, BeautifulSoup would let you download them all with metadata in 20 or so lines of code.

Check out our new, fully plastic tabletop wargame - Maelstrom's Edge, made by Dakka!
 
   
Made in gb
Leader of the Sept







Thanks Legoburner. I’ll sic my son on it


Automatically Appended Next Post:
Aaaaand he’s done

Hopefully this hasn’t tripped any botscraping warnings

Here’s the code he used, in case it’s useful to anyone else

Spoiler:
import os
import requests
from bs4 import BeautifulSoup
from urllib.parse import urlparse

pagething = 0
while pagething <= 2700:
URL = f"https://www.dakkadakka.com/core/gallery-search.jsp?p=1&u=3309&dq=&ll=4&auction=0&unapproved=0&coolnesslow=0&coolnesshigh=10&paintjoblow=0&paintjobhigh=10&sort1=7&sort2=0&skip=90&en=&st=&utype=&start={str(pagething)}"
OUTPUT_DIR = "images"

os.makedirs(OUTPUT_DIR, exist_ok=True)

headers = {
"User-Agent": "Mozilla/5.0"
}

response = requests.get(URL, headers=headers)
response.raise_for_status()

soup = BeautifulSoup(response.text, "lxml"

images = soup.select("img[src*='images.dakkadakka.com/gallery']"
print(f"Found {len(images)} thumbnails"

for img in images:
thumb_url = img["src"]

full_url = thumb_url.replace("_mb-", "-"

filename = os.path.basename(urlparse(full_url).path)
filepath = os.path.join(OUTPUT_DIR, filename)

if os.path.exists(filepath):
continue

are = requests.get(full_url, headers=headers)
if r.status_code == 200:
with open(filepath, "wb" as f:
f.write(r.content)
print(f"Downloaded: {filename}"
else:
print(f"Failed: {full_url}"
pagething += 90

This message was edited 1 time. Last update was at 2026/01/25 17:51:44


Please excuse any spelling errors. I use a tablet frequently and software keyboards are a pain!

Terranwing - w3;d1;l1
51st Dunedinw2;d0;l0
Cadre Coronal Afterglow w1;d0;l0 
   
Made in gb
[ADMIN]
Decrepit Dakkanaut






London, UK

Ethically should add a 1 second timer between requests, but otherwise nicely done!

Check out our new, fully plastic tabletop wargame - Maelstrom's Edge, made by Dakka!
 
   
 
Forum Index » Nuts & Bolts
Go to: