In the video, in the website used, sir is using article tag to scrape an image. However, there is no article tag being shown on the webpage currently. So, I am getting an error on using article tag in my code. Please tell what I should do
Problem in web scapping-image scapping
Hey @abhaygarg2001, actually the html file of the website keeps on changing. This is the reason mentor’s code is no longer working.
Anyways now there are two way out:
- The easiest hack is to us elements = soup.findAll(‘img’), and find all img tags directly and see manually by printing all elements which belong to quotes or which belong to background image or any other image.
- The more logical way is to use,
div = soup.findAll('div',attrs = {'class' :'col-6 col-lg-3 text-center margin-30px-bottom sm-margin-30px-top'})
because i noticed that all 32 quotes have this class attribute the same value. so i used that to get those 32 elements only.
Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section.