| import requests |
| from bs4 import BeautifulSoup |
| from datetime import datetime |
|
|
| def get_burning_man_dates(): |
| current_year = datetime.now().year |
| print(f"{current_year} is the current year") |
| url = "https://burningman.org/event/" |
| |
| response = requests.get(url) |
| if response.status_code == 200: |
| soup = BeautifulSoup(response.content, 'html.parser') |
| |
| |
| year_heading = soup.find('h1', string=lambda text: str(current_year) in text if text else False) |
| |
| if year_heading: |
| |
| date_paragraph = year_heading.find_next('p') |
| if date_paragraph: |
| result = f"Burning Man {current_year}: {date_paragraph.text.strip()}" |
| else: |
| result = f"Unable to find specific dates for Burning Man {current_year}." |
| else: |
| result = f"Unable to find information for Burning Man {current_year}." |
| else: |
| result = "Unable to fetch event dates at the moment." |
| |
| print(result) |
| return result |
|
|