Extract .jpg from HTML source code with Python-ThrowExceptions

Exception or error:

I set up this code to extract the links from the following website. The problem is that it breaks into register 19 and doesn’t continue with the listing.
You can help me.

import urllib.request    
import os 

tematica = 'fun'

url = "https://www.shutterstock.com/es/search/" + tematica
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
data_content = response.read()

Html_file= open("html_file.html","wb")
Html_file.write(data_content)
Html_file.close()

html=codecs.open("html_file.html", 'r', 'utf-8').read()

soup = BeautifulSoup(html)

for i,img_element in enumerate(soup.findAll('img', None)):
    try:
        img_src = img_element['src']
        print(i,img_src)
    except:
        pass
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *