import requests
from bs4 import BeautifulSoup
import json

# Assuming the HTML content is stored locally or can be fetched directly. If you have the URL, use requests to fetch it.
# For demonstration, the HTML content will be loaded from a local file. Replace this with requests.get(url).text if fetching from a URL.

html_content = """<div class="fl-col fl-node-cv7pq8del1o2" data-node="cv7pq8del1o2">
	<div class="fl-col-content fl-node-content"><div class="fl-module fl-module-rich-text fl-node-ib1aslx8douh" data-node="ib1aslx8douh">
	<div class="fl-module-content fl-node-content">
		<div class="fl-rich-text">
	<h3><strong>Cookie &amp; Wine Pairings</strong></h3>
<h4><strong>February 1-29 | 11:30-2:30 &amp; 3-6 PM</strong></h4>
<p>From February 1-29, redeem your ticket at any time. Enjoy a delicious pairing of 5 Bull Run wines and 5 different types of cookies.. This limited-time event offers the chance to taste many wines not usually offered in our traditional Wine Tastings.</p>
</div>
	</div>
</div>
<div class="fl-module fl-module-button fl-node-207px4jzk9te" data-node="207px4jzk9te">
	<div class="fl-module-content fl-node-content">
		<div class="fl-button-wrap fl-button-width-auto fl-button-left fl-button-has-icon">
			<a href="https://www.exploretock.com/thewineryatbullrun?tock_source=tock&amp;tock_medium=search_nav" target="_blank" class="fl-button" rel="noopener">
					<i class="fl-button-icon fl-button-icon-before fal fa-ticket-alt" aria-hidden="true"></i>
						<span class="fl-button-text">GET YOUR TICKETS HERE</span>
					</a>
</div>
	</div>
</div>
<div class="fl-module fl-module-rich-text fl-node-w9txpr60iv2f" data-node="w9txpr60iv2f">
	<div class="fl-module-content fl-node-content">
		<div class="fl-rich-text">
	<h3><strong>Fifth Annual Barrel Tastings</strong></h3>
<h4><strong>March 2,3,9.10 | Tours Between 11-5PM</strong></h4>
<p>The Winery at Bull Run’s Fifth Annual Barrel Tastings, our exclusive Production Barn Tour and Tasting Event, gives guests an opportunity to sample future wine releases straight from the barrel. Our team of winemaking experts will guide you through the wine production process from grape to glass, as well as the specifics of each wine you'll be tasting. Enjoy hors d'oeuvres, by Founding Farmers, paired perfectly with each wine throughout the tour.</p>
</div>
	</div>
</div>
<div class="fl-module fl-module-button fl-node-drzvum8xoc4p" data-node="drzvum8xoc4p">
	<div class="fl-module-content fl-node-content">
		<div class="fl-button-wrap fl-button-width-auto fl-button-left fl-button-has-icon">
			<a href="https://www.exploretock.com/thewineryatbullrun/event/462563/fifth-annual-barrel-tastings" target="_blank" class="fl-button" rel="noopener">
					<i class="fl-button-icon fl-button-icon-before fal fa-ticket-alt" aria-hidden="true"></i>
						<span class="fl-button-text">GET YOUR TICKETS HERE</span>
					</a>
</div>
	</div>
</div>
<div class="fl-module fl-module-rich-text fl-node-nzfjhdrvy09t" data-node="nzfjhdrvy09t">
	<div class="fl-module-content fl-node-content">
		<div class="fl-rich-text">
	<h3><strong>St. Patrick's Day R-Rated Comedy Night</strong></h3>
<h4><strong>March 15 | 7-8:30 PM</strong></h4>
<p>Join us for an evening of wine &amp; laughter to kick off St. Patrick's Day Weekend!<br>
On Friday, March 15th, The Winery at Bull Run will host two great comedians in our Production Barn. The show will start at 7pm, but doors will open at 5pm for food, wine and revelry. Seating will begin at 6:45pm in the Tank Room. Dress in green for the St. Patrick's Day theme to be entered to win a raffle prize at the end of the show! Ages 21+ Only.</p>
</div>
	</div>
</div>
<div class="fl-module fl-module-button fl-node-n4zut7w09oq5" data-node="n4zut7w09oq5">
	<div class="fl-module-content fl-node-content">
		<div class="fl-button-wrap fl-button-width-auto fl-button-left fl-button-has-icon">
			<a href="https://www.exploretock.com/thewineryatbullrun/event/459948/st-patricks-day-r-rated-comedy-night" target="_blank" class="fl-button" rel="noopener">
					<i class="fl-button-icon fl-button-icon-before fal fa-ticket-alt" aria-hidden="true"></i>
						<span class="fl-button-text">GET YOUR TICKETS HERE</span>
					</a>
</div>
	</div>
</div>
<div class="fl-module fl-module-rich-text fl-node-8qn1aziuhco2" data-node="8qn1aziuhco2">
	<div class="fl-module-content fl-node-content">
		<div class="fl-rich-text">
	<h3><strong>Spring Craft Workshop</strong></h3>
<h4><strong>March 24 | 11:30-1:30</strong></h4>
<p>Join instructor Liz Sandhu to make your own unique piece of Spring décor. This charming piece can be hung on your front door or porch, in your kitchen, or just about anywhere you like! Your ticket includes all supplies, expert instruction, and a glass of Bull Run wine of your choice. ** If the 11:30am class fills up, we will add a 2:30pm class too!</p>
</div>
	</div>
</div>
<div class="fl-module fl-module-button fl-node-mo689fspdqv7" data-node="mo689fspdqv7">
	<div class="fl-module-content fl-node-content">
		<div class="fl-button-wrap fl-button-width-auto fl-button-left fl-button-has-icon">
			<a href="https://www.exploretock.com/thewineryatbullrun/event/467776/spring-craft-workshop" target="_blank" class="fl-button" rel="noopener">
					<i class="fl-button-icon fl-button-icon-before fal fa-ticket-alt" aria-hidden="true"></i>
						<span class="fl-button-text">GET YOUR TICKETS HERE</span>
					</a>
</div>
	</div>
</div>
</div>
</div>"""

soup = BeautifulSoup(html_content, 'html.parser')
events = []

# Since your provided HTML does not include a direct 'location', assuming 'The Winery at Bull Run' as a static location for all events.
event_location = "The Winery at Bull Run"

# Find all event divs (assuming they are distinguished by a class that includes 'fl-module-rich-text')
for event_div in soup.find_all("div", class_="fl-module-rich-text"):
    # Extract event name, date and time, and description
    event_name = event_div.find("h3").text.strip() if event_div.find("h3") else "No Event Name"
    event_date_time = event_div.find("h4").text.strip() if event_div.find("h4") else "No Date and Time"
    event_description = event_div.find("p").text.strip() if event_div.find("p") else "No Description"
    
    # Assuming the next sibling div contains the image URL (adjust based on actual structure)
    image_div = event_div.find_next_sibling("div", class_="fl-module-photo")
    image_url = image_div.find("img")["src"] if image_div and image_div.find("img") else "No Image URL"

    event = {
        "name": event_name,
        "location": event_location,
        "date_time": event_date_time,
        "description": event_description,
        "image_url": image_url
    }

    events.append(event)

# Convert the list of events to JSON
json_data = json.dumps(events, indent=4)

# Print or save the JSON data
print(json_data)

