Last active
September 28, 2019 16:25
-
-
Save hamletbatista/abcf083af79d0a9354242c977a5410ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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