Who is Playing at the Bar

Today we are going to use a combination of web scraping with Python and Shortcuts to ask Siri who is playing at my local hangout in Bacliff, Noah’s Ark.

The python code could be run as a lambda function on AWS, but since we have Pythonista installed, we’ll just run it on the phone.

Note that to run this in Pythonista it will be necessary to install Mechanize. I did this via StaSh.

from mechanize import Browser
from bs4 import BeautifulSoup as BS
br = Browser()
url = "https://noahsarkbarandgrill.com/live-music/"

br.addheaders = [('User-agent', 'Firefox')]
soup = BS(br.response().read(),"html.parser")
for performance in soup.find_all('div', class_="et_pb_text_inner"):
    for i in performance.find_all('p'):
      a = i.text.strip().splitlines()
      output = " ".join(a)