The layout for website’s html tags have been changed now, html tags are not same now on that page which instructor has used to demonstrate.
But I’ve followed the same flow as instructor for scrapping an image but every time I run the different image is scrapped, so can you demonstrate how can I scrap an image of my choice (for example how can I scrap the first image from left on that website), please help me out as I’m not familiar with html.
Following is my code to scrap image(sense of the code is as per instructor of this video):
import bs4
import requests
url=‘https://www.passiton.com/inspirational-quotes?page=2’
response=requests.get(url)
print(response.content)
soup=bs4.BeautifulSoup(response.content)
div_element=soup.findAll(‘div’,id=‘all_quotes’)
div=div_element[0]
div.img.attrs[‘src’]
with open(‘inspiration.jpg’,‘wb’) as f:
image_url=div.img.attrs[‘src’]
response=requests.get(image_url)
f.write(response.content)