Link to the page I am trying to scrape
I am exploring and understanding beautiful-soup in python, so i decided to try to web scrape Eventbrite's event data. I am wondering why my scraper function is not taking in any event listed in the page.The data frame is empty for some reason. Is it because I am calling the wrong class? I know that the site has an API, but i want to try to web scrape first before using API.
Here is my code so far
import requests
from bs4 import BeautifulSoup
import pandas as pd
event = []
location = []
price = []
date = []
eventbrite_url = "https://www.eventbrite.com/d/ca--san-diego/art-events/"
try:
page = requests.get(kpbs_url)
soup = BeautifulSoup(page.text, 'html.parser')
items = soup.find_all("li", {"class": "item"})
for item in items:
event.append(item.find('div', {"class": "eds-is-hidden-accessible"}).text.strip())
location.append(item.find('div', {"class": "card-text--truncated__one"}).text.strip())
date.append(item.find('div', {"class":"eds-text-color--primary-brand eds-l-pad-bot-1 eds-text-weight--heavy eds-text-bs"}).text.strip())
try:
price.append(item.find('div', {"class": "eds-media-card-content__sub eds-text-bm eds-text-color--grey-600 eds-1-mar-top-1 eds-media-card-content__sub--cropped"}).text.strip())
except:
price.append('Free')
final_df = pd.DataFrame(
{'Event': event,
'Location': location,
'Price': price,
'Date':date
})
except Exception as e:
print(e)
print("continuing....")