Skip to content

Instantly share code, notes, and snippets.

@hamletbatista
Last active September 28, 2019 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamletbatista/abcf083af79d0a9354242c977a5410ea to your computer and use it in GitHub Desktop.
Save hamletbatista/abcf083af79d0a9354242c977a5410ea to your computer and use it in GitHub Desktop.
r = session.get('https://touringplans.com/disneyland/attractions/duration')
ride_durations = dict()
for tr in r.html.find("#center > table > tr"): #element selected copied from Chrome Developer Tools
ride = tr.find("td:nth-child(1)")[0].text
duration = tr.find("td:nth-child(2)")[0].text
print(ride, duration)
#parse duration
m = re.search("([^\s]+) minutes?", duration) # this regular expression helps us extract the actual duration number
#if m is not None:
print(m.groups(1))
ride_durations[ride] = float(m.groups(1)[0])
#Example ride durations extracted
#Millennium Falcon FASTPASS Kiosk 0 minutes
#('0',)
#Buzz Lightyear Astro Blasters FASTPASS Kiosk 1 minutes
#('1',)
#Fantasmic! FASTPASS Kiosk 1 minutes
#('1',)
#Gadget's Go Coaster 1 minutes
#('1',)
#Haunted Mansion FASTPASS Kiosk 1 minutes
#('1',)
#it's a small world FASTPASS Kiosk 1 minutes
#('1',)
#Matterhorn Bobsleds FASTPASS Kiosk 1 minutes
#('1',)
#Starcade 1 minutes
#('1',)
#Astro Orbitor 1.5 minutes
#('1.5',)
#Mad Tea Party 1.5 minutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment