So i am trying to extract the URL's and the descriptions under each picture from a website and then be able to download the pictures.
I haven't been able to get past the extraction point though.
I am using Beautifulsoup to extract the text that i want from the HTML tags and i got it to work for just the first link with the find() tag.
I started to work on getting the rest of the links with find_all() but i am getting stuck.
Can someone help me to figure out where i would need to use find_all() and do i need another for loop for the descriptions?
import requests
from bs4 import BeautifulSoup
import urllib
import csv
import time
URL = 'https://www.baps.org/vicharan'
content = requests.get(URL)
soup=BeautifulSoup(content.text, 'html.parser')
f = csv.writer(open('crawler.csv' , 'w'))
f.writerow(['description' , 'full_link'])
panelrow = soup.find('div' , {'class' : 'panelrow'})
main_class = panelrow.find_all('div' , {'class' : 'col-xl-3 col-lg-3 col-md-3 col-sm-12 col-xs-12 padding5'})
individual_classes = panelrow.find('a' , {'class' : 'highslidooo'})
for link in individual_classes.find_all('img'):
links=link.get('src')
full_link = 'https://www.baps.org' + links
description = link.get('alt')
f.writerow([description , full_link])
print('--------------------')
print(full_link)
print(description)