diff --git a/roisin_dubh_listings.py b/roisin_dubh_listings.py index bfaf2e6..a602acb 100755 --- a/roisin_dubh_listings.py +++ b/roisin_dubh_listings.py @@ -1,11 +1,13 @@ #!/bin/python3 +# Script to scrape the event listings webpage for the Róisín Dubh pub in Galway and generate an RSS feed +# The page does appear to offer an RSS feed but it's broken and returns dates in the far future and distant past import requests -import json from datetime import datetime listings = requests.get("https://roisindubh.net/remote/searchlistings.json").json()["results"] +# using several print statements to prioritise code readability over efficiency (I/O speeds are unimportant to me) print('') print('Roisín Dubh Listingshttps://roisindubh.net/listings/') @@ -13,7 +15,34 @@ for listing in listings: print('') print('' + listing["pagetitle"] + '') print('https://roisindubh.net/listings/' + listing["alias"] + '') - print('' + listing["introtext"] + '') + + print(' ') + print('Ticket Allocation: ' + listing["ticket_allocation"] + '
') + print('Tickets remaining?: ' + str(listing["ticket_remaining"] == '1') + '
') + print('Event start time: ' + listing["event_date_time"] + '
') + print('Late night?: ' + str(listing["late_night"] == "1") + '
') + print('Postponed?: ' + str(listing["postponed"] == "1") + '
') + print('Sales start time: ' + listing["sales_start"] + '
') + print('On Sale?: ' + str(listing["on_sale"] == "1") + '
') + print('Tickets remaining?: ' + str(listing["ticket_remaining"] == '1') + '
') + + if listing["external_ticket_url"]: + print('External Ticket URL: ' + listing["external_ticket_url"] + '') + + # unparsed json object: + # "prices": { + # "regular": 10, + # "student": 0, + # "vip": 0, + # "ticket_limit": 10, + # "ticket_limit_per_transaction": 1, + # "discount": [] + # }, + + print(']]>
') print('' + datetime.strptime(listing["event_date_time"], '%Y-%m-%dT%H:%M:%S').strftime('%a, %d %b %Y %H:%M:%S %z') + '') print('
')