Skip to content

Instantly share code, notes, and snippets.

@Stolas
Created September 16, 2023 08:36
Show Gist options
  • Save Stolas/b99790cb104154837a311f5c1124e3c6 to your computer and use it in GitHub Desktop.
Save Stolas/b99790cb104154837a311f5c1124e3c6 to your computer and use it in GitHub Desktop.
VEKN Cal Checker
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
from dateutil.relativedelta import *
import time
def get_events(countires, future_months=3):
events = []
for country in my_countries:
event_uri = f"https://www.vekn.net/event-calendar?country={country}"
now = datetime.now()
for n in range(1,future_months):
current_month = now + relativedelta(months=+n)
date = current_month.strftime("%Y-%m")
specific_month_uri = f"{event_uri}&date={date}"
resp = requests.get(specific_month_uri)
soup = BeautifulSoup(resp.text, features="lxml")
cal = soup.find("table", {"class": "vekn-cal"})
for event in cal.find_all("p"):
day = event.parent.find("h2").text
date_obj = datetime.strptime(f"{date}-{day}", "%Y-%m-%d")
event_date = date_obj.strftime("%dth of %B, %Y (%A)")
event_line = f"{event_date}: {event.text.strip()}"
events.append(event_line)
# print(event_line)
return events
if __name__ == '__main__':
my_countries = ["NL", "BE", "DE", "GB"] # Todo; Make Configurable.
displayed_events = []
for event in get_events(my_countries):
if event not in displayed_events:
print(event)
# Todo; Send Discord message to myself.
displayed_events.append(event)
time.sleep(60*60*12) # Every 12 hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment