Hacksburg / hacksburg.github.io

Hacksburg website
Other
2 stars 2 forks source link

rss_to_json script fails on free events #30

Closed hacksburg-john closed 1 year ago

hacksburg-john commented 1 year ago

The rss_to_json script uses a regex query to extract event info from meetup rss strings: https://github.com/Hacksburg/hacksburg.github.io/blob/master/rss_to_json.ipynb?short_path=6c08775#L41

If the rss string is missing a "Price: " field (which is common for free events) the regex doesn't match and the script fails to run. It can be temporarily bypassed by adding a fake price field to the RSS.

Example string with price:

<p><img style="float:left; margin-right:4px" src="https://secure.meetupstatic.com/photos/event/1/1/0/c/event_490684364.jpeg" alt="photo" class="photo" />New River Makers</p> <p><p>Attendees will learn how to do basic CNC operations and think like a machinist. Details will be given for the operation of the Hacksburg CNC gantry router, generously donated by Onefinity and Torc Robotics, and we will show the machining of a demo part. Feel free to attend only this first part.</p> <p>If you intend on getting CNC trained as a Hacksburg member, we will schedule a time to hold Part 2, where I will teach the CAM programming on the computer and give you remote access to our CAM computer. You will then receive a homework assignment, in the form of a STEP file that you will generate a machining plan and gcode for. You will then execute the plan, with me or another Hacksburg member, to confirm your ability to do CAM programming and CNC machining.</p> <p>This class is for attendees age 16 and up. The class is free for Hacksburg members and $5 for non-members. If you are bringing an attendee under 18, you (the parent/guardian) must stay for the entire duration of the class and approve all shop tool use.</p> </p> <p>Blacksburg, VA  24060 - USA</p> <p>Sunday, August 27 at 1:00 PM</p> <p>1</p> <p>Price: 5.00 USD</p> <p>https://www.meetup.com/hacksburgva/events/295114339/</p>

Example string without price:

<p><img style="float:left; margin-right:4px" src="https://secure.meetupstatic.com/photos/event/1/1/0/c/event_490684364.jpeg" alt="photo" class="photo" />New River Makers</p> <p><p>Hacksburg is a non-profit Makerspace located in Blacksburg, VA. Started in 2014, we're a community workshop focused on enabling creatives and entrepreneurs in the New River Valley to complete projects that would otherwise be out of reach. Whether you need equipment, mentorship, or just some space to work, Hacksburg is meant to be an accessible, collaborative, and affordable resource for building anything from rockets to robots to rocking chairs.</p> <p>Hacksburg members must be 18+, but all ages are welcome at this open house. If you are bringing attendees under 18, you (parent/guardian) must stay for the duration of the class.</p> </p> <p>Blacksburg, VA  24060 - USA</p> <p>Wednesday, September 6 at 3:00 PM</p> <p>3</p> <p>https://www.meetup.com/hacksburgva/events/295210629/</p>
MrDerples commented 1 year ago

I've rejiggered the regex so that the price capture group is None when the Price field is absent. Am I correct in thinking you'll handle rendering of Nones and prices of 0 or less in the caller?

hacksburg-john commented 1 year ago

See https://regex101.com/r/HLCFll for sample strings and testing