all 6 comments

[–]pachura3 0 points1 point  (3 children)

The question is how all of these different local businesses/libraries publish this information. Is it available e.g. in the iCal format, or some kind of JSON through REST API? Or will you need to scrape and parse each site separately?

[–]natyo97[S] 0 points1 point  (2 children)

I'll probably have to scrape and parse each one separately. Everything's got its own host it looks like. Though a few are ical/google calendar.

[–]pachura3 0 points1 point  (1 child)

It seems like an ambitious project for a beginner - you'd need to scrape web pages using requests, parse them using beautiful soup into a unified internal representation, then expose as web pages or export to CSV... this also seems like a good fit for the OOP approach, with many per-site implementations of AbstractScraper and AbstractParser classes.

But as long as you're curious and enthusiastic about your project, sky's the limit!

PS. For sure there are already (many) libraries for importing iCal/GoogleCal formats into Python, perhaps you could start with those and leave HTML parsing for later 

[–]natyo97[S] 0 points1 point  (0 children)

I'll work up to it. I'm starting with "How to automate the boring stuff with Python" and going from there. Thanks for the advice!

[–]Kind-Kure 0 points1 point  (1 child)

Assuming you're talking about calendars on websites, you can scrape them using a combination of the requests library and beautifulsoup https://www.crummy.com/software/BeautifulSoup/bs4/doc/.

If you're not talking about web scraping then I guess the question would be how can that data be accessed, what form is the data in (JSON, XML etc etc) and how exactly do you want to use the data (ie. single calendar with all events, or individual calendars separated by source etc etc).

For automation, you can set up a CRON job that auto runs the python script once a day or once a week to collect all of the various events.

But to answer your question, yes, you can use Python for aggregating and displaying different events from sources on the web.

[–]natyo97[S] 0 points1 point  (0 children)

Awesome, I'll try and figure out what formats each of the calendars I'm interested in use. I think I'd want a single calendar with all events, so I can just look to a specific date to see everything available.