If anyone wants to download their photos semi-automatically (you only have to input a link to the album front page and a local location where to save them), this Python should do the trick. It is likely you will need to install the requests and BeautifulSoup modules.
import shutil # module to save images locally
import requests # module to allow http requests
from bs4 import BeautifulSoup # webscraping module
url = input("Enter album URL: " # paste in your album URL
folder = input("Enter a folder path for photos: " # enter photo archive path
# Note that a typical Windows path must be written thus:
# C:/Users/laptop/Documents/ME_pics/
# The album page contains a 'magic number', referred to below as member_number.
# We have to extract that to construct the full URL to the photo
# Set up base URL for photo locations
base_url = 'https://www.model-engineer.co.uk/wp-content/uploads/sites/4/images/member_albums/'
reqs = requests.get(url) # make http request to album page
soup = BeautifulSoup(reqs.text, 'html.parser' # drop result into soup tureen
urllist = [] # construct empty list
for link in soup.find_all('a': # find all links from album page
urllist.append(link.get('href') # add links to list
member_number = (urllist[1]) # magic number is within second item in list
mn = member_number[-6:] # extract number from that item
mn += '/' # add forward slash for housekeeping
base_url += mn # add member_number to base_url
photo_list = [] # construct empty list
for u in urllist: # look at each item in list
if u[0:6] == 'member': # find out if the url is a photo
photo_id = u[-6:] # last six charcters is its ID
photo_list.append(base_url + photo_id + ".jpg" # construct URL of photo
for p in photo_list: # now go through list and save pictures
file_name = folder + p[-10:] # full path to saved file
res = requests.get(p, stream = True) # get the image from the interweb
if res.status_code == 200: # check if successful
with open(file_name,'wb' as f: # open file for writing as binary
shutil.copyfileobj(res.raw, f) # weld it to the hard disk
print('Image sucessfully Downloaded: ',file_name)
else:
print('Image Couldn't be retrieved'
Edit: if the forum wants to put smiley faces in perfectly good Python code, that is its problem, not mine.
Edited By DC31k on 05/04/2023 10:39:13