I want to download all the jpg and png images from the website but I need them to download in order and maybe if it’s possible naming them during the download. For example download 1000 images, in order from 1 to 1000 with the name of order. For example 3rd picture will be named 3, or 300 picture will be named 300. I’m newbie in coding and I need this for my project. I can download them manually, but it will take time and I want to learn how to automate such process.
Advertisement
Answer
You may use the following approach
JavaScript
x
18
18
1
# IMPORT LIBRARIES
2
# choose libraries to be used
3
4
def download_images_from_url(url):
5
count = 1 # initialize counter
6
# loop
7
8
# write code to download the image from website
9
10
# write code to store it locally
11
12
# rename the image using count variable
13
14
count+=1 #update counter
15
16
url = "https://www.website.com"
17
download_images_from_url(url)
18