metlinkr 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in metlinkr.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/metlinkr.rb ADDED
@@ -0,0 +1,89 @@
1
+ require 'mechanize'
2
+ require 'nokogiri'
3
+
4
+ class Metlinkr
5
+
6
+ START_URL = "http://jp.metlinkmelbourne.com.au/metlink/XSLT_TRIP_REQUEST2?language=en&itdLPxx_view=advanced"
7
+ def self.instance
8
+ @instance ||= new
9
+ end
10
+
11
+ def initialize
12
+ agent.user_agent = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/12.0.742.112)'
13
+ end
14
+
15
+ def route(from, to, options = {:methods => :all, :ignore_earlier_journey => true, :limit => 1})
16
+ page = agent.get(START_URL)
17
+
18
+ f = page.form('tripRequest')
19
+
20
+ # Shitty hack for forcing address
21
+
22
+ f.anyObjFilter_origin = 29
23
+ f.execIdentifiedLoc_origin = 1
24
+ f.execStopList_origin = 0
25
+
26
+ f.anyObjFilter_destination = 29
27
+ f.execIdentifiedLoc_destination = 1
28
+ f.execStopList_destination = 0
29
+
30
+ f.name_origin = from
31
+ f.name_destination = to
32
+
33
+ select_methods(f, options[:methods])
34
+
35
+ results = f.click_button
36
+
37
+ body = results.body
38
+
39
+ doc = Nokogiri::HTML(body)
40
+
41
+ links = doc.search('tr.p4 td.dontprint a, tr.p2 td.dontprint a')
42
+
43
+ links.shift if options[:ignore_earlier_journey]
44
+
45
+ links = links.slice(0, options[:limit])
46
+ links.map do |link|
47
+ href = link.attributes['href'].value
48
+ fetch_and_parse_journey_from_href(href)
49
+ end
50
+ end
51
+
52
+ private
53
+
54
+ def agent
55
+ @agent ||= Mechanize.new
56
+ end
57
+
58
+ def fetch_and_parse_journey_from_href(href)
59
+ Journey.parse(agent.get(href).body)
60
+ end
61
+
62
+ METHOD_MAPPING = {
63
+ :train => 'inclMOT_1',
64
+ :tram => 'inclMOT_4',
65
+ :bus => 'inclMOT_5',
66
+ :vline => 'inclMOT_0',
67
+ :regional_bus => 'inclMOT_6',
68
+ :skybus => 'inclMOT_3'
69
+ }
70
+
71
+ ALL_METHODS = [:tram, :train, :bus, :vline, :regional_bus, :skybus]
72
+
73
+ def select_methods(form, methods = :all)
74
+ if methods == :all
75
+ methods = ALL_METHODS
76
+ end
77
+
78
+ (ALL_METHODS - [methods].flatten).each do |method|
79
+ form.checkbox_with(:name => METHOD_MAPPING[method]).uncheck
80
+ end
81
+
82
+ end
83
+ end
84
+
85
+ $LOAD_PATH << File.dirname(__FILE__)
86
+ require 'metlinkr/version'
87
+ require 'metlinkr/journey'
88
+ require 'metlinkr/step'
89
+
@@ -0,0 +1,33 @@
1
+ require 'nokogiri'
2
+ class Metlinkr
3
+ class Journey
4
+ attr_accessor :steps
5
+
6
+ def self.parse(html)
7
+ journey = new
8
+
9
+ doc = Nokogiri::HTML(html)
10
+
11
+ rows = doc.xpath("//table[@text-align='top']/tr")
12
+
13
+ rows = rows.to_a.reject do |row|
14
+ # Reject the hidden ones
15
+ klass = row.attributes['class'].value rescue ""
16
+ klass =~ /addinfo|jpText/
17
+ end
18
+
19
+ rows.shift # Get rid of header row
20
+
21
+ if rows.length % 3 != 0
22
+ raise "Rows not a multiple of 3"
23
+ end
24
+
25
+ journey.steps = []
26
+ rows.each_slice(3) do |row_set|
27
+ journey.steps << Step.parse(row_set)
28
+ end
29
+
30
+ journey
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,77 @@
1
+ class Metlinkr
2
+ class Step
3
+ attr_reader :method, :origin, :destination, :departure_time, :arrival_time, :duration, :route
4
+
5
+ def self.parse(row_set)
6
+ step = new
7
+ step.parse(row_set)
8
+ end
9
+
10
+ def parse(row_set)
11
+ @row_set = row_set
12
+
13
+ parse_method
14
+ parse_origin
15
+ parse_destination
16
+ parse_route
17
+ parse_departure_time
18
+ parse_arrival_time
19
+ parse_duration
20
+
21
+ @row_set = nil
22
+
23
+ self
24
+ end
25
+
26
+ protected
27
+
28
+ def parse_method
29
+ @method = case @row_set[0].xpath("td[1]/img").first.attributes['alt'].value
30
+ when /\btram\b/i
31
+ :tram
32
+ when /\btrain\b/i
33
+ :train
34
+ when /\bbus\b/i
35
+ :bus
36
+ when /\bwalk\b/i
37
+ :walk
38
+ else
39
+ nil
40
+ end
41
+ end
42
+
43
+ def parse_origin
44
+ @origin = clean_stop_name(@row_set[0].xpath("td")[3].content)
45
+ end
46
+
47
+ def parse_destination
48
+ @destination = clean_stop_name(@row_set[2].xpath("td")[3].content)
49
+ end
50
+
51
+ def parse_route
52
+ @route = @row_set[1].xpath("td/strong").first.content.strip rescue nil
53
+ end
54
+
55
+ def parse_departure_time
56
+ @departure_time = clean_time(@row_set[0].xpath("td/span").first.content) rescue nil
57
+ end
58
+
59
+ def parse_arrival_time
60
+ # Why the FUCK is that div there?
61
+ @arrival_time = clean_time(@row_set[2].xpath("td/div/span").first.content) rescue nil
62
+ end
63
+
64
+ def parse_duration
65
+ @row_set[1].xpath("td").last.content.match(/Time (\d+ min)/)
66
+ @duration = $1
67
+ end
68
+
69
+ def clean_stop_name(stop)
70
+ stop.gsub(/^(From( Stop)?)|(Get off at( stop)?)|(To)\b/i, '').gsub(/(\d+)-/, 'Stop \1 - ').gsub(/[^ -z]+/, ' ').strip
71
+ end
72
+
73
+ def clean_time(time)
74
+ time.gsub(/^.*,/, '').gsub(' ', '').strip
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,3 @@
1
+ class Metlinkr
2
+ VERSION = "0.0.2"
3
+ end
data/metlinkr.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "metlinkr/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "metlinkr"
7
+ s.version = Metlinkr::VERSION
8
+ s.authors = ["Jack Chen (chendo)"]
9
+ s.email = []
10
+ s.homepage = ""
11
+ s.summary = %q{Web-scrapin' the Metlink journey planner}
12
+ s.description = %q{A gem to operate the Metlink journey planner}
13
+
14
+ s.rubyforge_project = "metlinkr"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "capybara-mechanize"
24
+ s.add_runtime_dependency "nokogiri"
25
+
26
+ end
@@ -0,0 +1,321 @@
1
+
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="EN" xmlns="http://www.w3.org/1999/xhtml"><!--WEB, v1.23.2.11-->
3
+ <head xmlns="">
4
+ <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
+ <title>Viclink Journey Planner - Your guide to public transport in Victoria</title><meta name="DC.Keywords" content="Metlink, melbourne public transport system, met link, train, trains, tram, trams, bus, buses, The Met, the met, metcard, public transport, transport, australia, Melbourne, Victoria, rail, Revitalising Victorian Rail, guide, route, reservation, vacation, holiday, time tables, timetables, timetable, travel, passenger, V-Line, V-Line Passenger, nightrider, Nightrider, Night Rider, night rider, City Circle, city circle"><meta name="Keywords" content="Metlink, melbourne public transport system, met link, train, trains, tram, trams, bus, buses, The Met, the met, metcard, public transport, transport, australia, Melbourne, Victoria, rail, guide, route,reservation, vacation, holiday, time tables, timetables, timetable, travel, passenger, V-Line, V-Line Passenger, nightrider, Nightrider, Night Rider, night rider, City Circle, city circle"><meta name="DC.Description" content="Welcome to Metlink - Your guide to public transport in metropolitan Melbourne. Find out about public train, tram and bus services throughout Melbourne and Victoria, Australia."><meta name="Description" content="Welcome to Metlink - Your guide to public transport in metropolitan Melbourne. Find out about public train, tram and bus services throughout Melbourne and Victoria, Australia."><meta name="DC.Publisher" content="Metlink Victoria Pty Ltd"><meta name="DC.Creator" content="Metlink Victoria Pty Ltd"><meta name="DC.Identifier" content="http://www.metlinkmelbourne.com.au"><meta http-equiv="Content-Language" content="en-au"><meta http-equiv="expires" content="0"><meta http-equiv="Pragma" content="no-cache"><!--
6
+ Copyright © 2007 Metlink Victoria Pty Ltd. All rights reserved
7
+ For more information or to report a bug, please contact Metlink at feedback@metlinkmelbourne.com.au or call 131 638.
8
+ --><!-- - links to stylesheet --><link rel="stylesheet" href="css/common.css" type="text/css"><link rel="stylesheet" href="css/style.css" type="text/css"><link rel="stylesheet" href="css/efa9_trips_jp.css"><link rel="stylesheet" href="css/phase2_jp.css" type="text/css"><link rel="stylesheet" href="css/efa9_print_jp.css" type="text/css" media="print"><link rel="stylesheet" href="css/efa9_metlink_jp_legtt.css" type="text/css"><!-- break frames --><script language="JavaScript" type="text/javascript"><!--
9
+ if (window != window.top)
10
+ top.location.href = location.href;
11
+ // --></script><!-- - links to all the JavaScript code for nav and popup windows --><script language="JavaScript" src="script/js_code.js" type="text/javascript"></script><script language="JavaScript" src="script/efa9_metlink_web.js" type="text/javascript"></script><script language="JavaScript" src="script/efa9_metlink_web_legtt.js" type="text/javascript"></script><script language="JavaScript" type="text/javascript">var mapDisplayCentre = false;</script><script language="JavaScript" type="text/javascript"><!--
12
+
13
+ function addToFavourites()
14
+ {
15
+ if(document.all)
16
+ {
17
+ window.external.AddFavorite("http://www.metlinkmelbourne.com.au/index.php","Metlink - Victoria\'s Official Public Transport Web site")
18
+ }
19
+ }
20
+
21
+ // NOTE: this is no longer used due to accessibility issues
22
+ function emailToFriend()
23
+ {
24
+ var url = escape("http://www.metlinkmelbourne.com.au/");
25
+
26
+ var width = 550;
27
+ var height = 500;
28
+ var leftPos = (screen.availWidth-width) / 2
29
+ var topPos = (screen.availHeight-height) / 2
30
+
31
+ // displays the image selector
32
+ emailWindow = window.open('/tools/email_to_friend.php?url=' + url,'imageWindow','toolbar=no,width=' + width + ',height=' + height + ',directories=no,status=no,scrollbars=yes,resize=yes,menubar=no,top=' + topPos + ',left=' + leftPos);
33
+ if(emailWindow != null && emailWindow.opener == null)
34
+ {
35
+ emailWindow.opener = window;
36
+ }
37
+ emailWindow.focus();
38
+ }
39
+
40
+ function swapText(show)
41
+ {
42
+ if (show == 'metro')
43
+ {
44
+ document.getElementById('metTag').style.display="block";
45
+ document.getElementById('vicTag').style.display="none";
46
+ document.getElementById('map').src = "images/metlink/mapBtn_met.gif";
47
+ }
48
+ else if (show == 'vic')
49
+ {
50
+ document.getElementById('metTag').style.display="none";
51
+ document.getElementById('vicTag').style.display="block";
52
+ document.getElementById('map').src = "images/metlink/mapBtn_vic.gif";
53
+ }
54
+ }
55
+
56
+ // --></script><script type="text/javascript" language="JavaScript">
57
+ // Date and Time Strings
58
+
59
+ var dayString = new Array ( "Sun",
60
+ "Mon",
61
+ "Tue",
62
+ "Wed",
63
+ "Thu",
64
+ "Fri",
65
+ "Sat");
66
+ var monthString = new Array ( "January",
67
+ "February",
68
+ "March",
69
+ "April",
70
+ "May",
71
+ "June",
72
+ "July",
73
+ "August",
74
+ "September",
75
+ "October",
76
+ "November",
77
+ "December");
78
+ </script></head>
79
+ <body onload="">
80
+ <div id="wrapper">
81
+ <div id="outer">
82
+ <div id="headerMain" class="dontprint">
83
+ <div id="header">
84
+ <h1><a href="http://www.viclink.com.au" title="Viclink"><span>Viclink</span></a></h1>
85
+ <div id="utilities">
86
+ <ul>
87
+ <li>
88
+ <a href="http://www.metlinkmelbourne.com.au/myway" title="Log in to MyWay">Login</a>
89
+ </li>
90
+ <li>
91
+ <a href="http://feedback.metlinkmelbourne.com.au/default.aspx">Feedback</a>
92
+ </li>
93
+ <li>
94
+ <a href="http://store.metlinkmelbourne.com.au/metcard/store/">Buy online</a>
95
+ </li>
96
+ </ul>
97
+ </div>
98
+ <div id="utilities_search">
99
+ <p class="byline">Your guide to public transport in Melbourne and Victoria</p>
100
+ <ul>
101
+ <li><a href="http://www.metlinkmelbourne.com.au/search" title="Search all content on this website">Search</a></li>
102
+ </ul>
103
+ </div>
104
+ </div>
105
+ <div id="mainNav">
106
+ <ul>
107
+ <li id="home" class="first"><a href="http://www.metlinkmelbourne.com.au"><span>Home</span></a></li>
108
+ <li id="timetables"><a href="http://www.metlinkmelbourne.com.au/timetables"><span>Timetables</span></a></li>
109
+ <li id="maps_stations_stops"><a href="http://www.metlinkmelbourne.com.au/maps_stations_stops"><span>Maps stations stops</span></a></li>
110
+ <li id="fares_tickets"><a href="http://www.metlinkmelbourne.com.au/fares_tickets"><span>Fares &amp; tickets</span></a></li>
111
+ <li id="using_public_transport"><a href="http://www.metlinkmelbourne.com.au/using_public_transport"><span>Using public transport</span></a></li>
112
+ <li id="accessible_transport"><a href="http://www.metlinkmelbourne.com.au/accessible_transport"><span>Accessible transport</span></a></li>
113
+ <li id="news"><a href="http://www.metlinkmelbourne.com.au/news"><span>News</span></a></li>
114
+ <li id="about_metlink"><a href="http://www.metlinkmelbourne.com.au/about_metlink"><span>About Metlink</span></a></li>
115
+ </ul>
116
+ </div>
117
+ <div id="subUtilities">
118
+ <div id="journeyPlanner">
119
+ <a href="http://jp.metlinkmelbourne.com.au/">Journey Planner</a>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ <div id="container">
124
+ <div id="clearheader"></div>
125
+ <div class="outerwrap">
126
+ <div class="printonly">
127
+ <img src="images/metlink/metlink.gif" alt="Viclink"/>
128
+ </div>
129
+ <div style="float:left" class="outerwrap">
130
+ <div id="centrecontent">
131
+ <div id="content">
132
+ <div class="section">
133
+ <div class="top_right">
134
+ <div class="top_left">
135
+ <h1>Travel Plan</h1>
136
+ <div class="bottom_right">
137
+ <div class="bottom_left"></div>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ <div class="sectionDescription"><!--Start MAIN-->
142
+ <table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
143
+ <tbody>
144
+ <tr>
145
+ <td valign="top" width="100%">
146
+ <a name="startcontent"/><!-- Table STARTS HERE -->
147
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
148
+ <tbody>
149
+ <tr>
150
+ <td valign="top" width="100%"><!-- Left -->
151
+ <form method="post" action="XSLT_TRIP_REQUEST2" name="tripRequest" xmlns=""><input type="hidden" name="sessionID" value="VICWA06_732007765"><input type="hidden" name="language" value="en"><input type="hidden" name="requestID" value="1"><input type="hidden" name="command" value=""><input type="hidden" name="itdLPxx_view" value=""><input type="hidden" name="itdLPxx_soi" value=""><input type="hidden" name="itdLPxx_legTT" value=""><input type="hidden" name="tripSelection" value=""><input type="hidden" name="tripSelector1" value="1"><div id="JPContent"><div class="jpHeaderBox"><div class="jpHeaderBoxHdr"><h2 class="h2">Option 1</h2></div><div class="base"><div class="baseInner"><div class="jpHeaderBoxInner"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="55%"><div class="jpBold " style="float:left;">From: </div><div class="jpText">29-High St/Barkers Rd (Kew)</div><div style="clear:left;"></div><div class="jpBold " style="float:left;">To: </div><div class="jpText">Sunshine Railway Station (Sunshine)</div><div style="clear:left;"></div><div class="jpBold " style="float:left;">Fares: </div><div class="jpText">Zone(s) 1 <a target="_blank" href="http://www.metlinkmelbourne.com.au/fares-tickets/metropolitan-fares-and-tickets/metcard/metcard-types/">Metcard</a></div></td><td width="45%"><div class="jpBold " style="float:left;">Departing: </div><div class="jpText">8:39 pm, Mon 5
152
+ December
153
+ 2011 </div><div style="clear:left;"></div><div class="jpBold " style="float:left;">Arriving: </div><div class="jpText">9:42 pm, Mon 5
154
+ December
155
+ 2011 </div><div style="clear:left;"></div><div class="jpBold " style="float:left;">Total Time: </div><div class="jpText">1 hr 3 min </div></td></tr><tr><td colspan="2" class="error"></td></tr></table><br><table width="100%" border="0" cellpadding="2" cellspacing="2" text-align="top"><tr class="h3"><th width="12%" colspan="2">Travel by</th><th width="5%"></th><th width="8%">Time</th><th width="37%">Details</th><th width="8%">Map</th><th width="30%" colspan="2">Information</th></tr><tr class="p2_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/TramIcon30px.gif" alt="Metro Tram"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"><span>Mon, 8:39 pm</span></td><td width="37%"><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19742" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="29-Barkers Rd/High St (Kew)" border="0" class="dontprint"></a></span><strong>From Stop <a href="http://www.metlinkmelbourne.com.au/stop/view/19742" class="soi" target="_blank">29-Barkers Rd/High St (Kew)</a></strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C1.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
156
+
157
+ </td></tr><tr class="p2_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Take the Route<strong> 109 tram towards Port Melbourne</strong></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 9 min<br>Zone(s): 1<br>Operator: Yarra Trams<br><br><a href="XSLT_TRIP_REQUEST2?language=en&amp;command=loadLegTT_1_1&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;tripSelection=on&amp;tripSelector1=1&amp;itdLPxx_view=detail&amp;itdLPxx_legTT=:1_1">Leg Timetable</a></td></tr><tr class="p2_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"><span>Mon, 8:48 pm</span></div></td><td><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19732" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="19-North Richmond Railway Station/Victoria St (Richmond)" border="0" class="dontprint"></a></span>Get off at stop <a href="http://www.metlinkmelbourne.com.au/stop/view/19732" class="soi" target="_blank">19-North Richmond Railway Station/Victoria St (Richmond)</a></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2"></td></tr><tr class="p3_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/WalkIcon30px.gif" alt="Walk"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"> </td><td width="37%"><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19732" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="19-North Richmond Railway Station/Victoria St (Richmond)" border="0" class="dontprint"></a></span><strong>From Stop <a href="http://www.metlinkmelbourne.com.au/stop/view/19732" class="soi" target="_blank">19-North Richmond Railway Station/Victoria St (Richmond)</a></strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C2.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
158
+
159
+ </td></tr><tr class="p3_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Walk</td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 4 min<br></td></tr><tr class="p3_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"> </div></td><td><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19977" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="North Richmond Railway Station (Richmond)" border="0" class="dontprint"></a></span><strong>To</strong><a href="http://www.metlinkmelbourne.com.au/stop/view/19977" class="soi" target="_blank"> North Richmond Railway Station (Richmond)</a></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2"></td></tr><tr class="p2_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/TrainIcon30px.gif" alt="Metro Train"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"><span>Mon, 8:52 pm</span></td><td width="37%"><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19977" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="North Richmond Railway Station (Richmond)" border="0" class="dontprint"></a></span><strong>From <a href="http://www.metlinkmelbourne.com.au/stop/view/19977" class="soi" target="_blank">North Richmond Railway Station (Richmond)</a><a href="http://www.metlinkmelbourne.com.au/stop/view/19977" class="soi" target="_blank"> Platform 1</a></strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C3.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
160
+
161
+ </td></tr><tr class="p2_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Take the<strong> train towards Parliament</strong></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 11 min<br>Frequency: 10 min<br>Zone(s): 1<br>Operator: Metro<br><br><a href="XSLT_TRIP_REQUEST2?language=en&amp;command=loadLegTT_1_3&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;tripSelection=on&amp;tripSelector1=1&amp;itdLPxx_view=detail&amp;itdLPxx_legTT=:1_3">Leg Timetable</a></td></tr><tr class="p2_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"><span>Mon, 9:03 pm</span></div></td><td><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/22180" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="Southern Cross Railway Station (Melbourne City)" border="0" class="dontprint"></a></span>Get off at <a href="http://www.metlinkmelbourne.com.au/stop/view/22180" class="soi" target="_blank">Southern Cross Railway Station (Melbourne City) Platform 9</a></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2"></td></tr><tr class="p3_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/WalkIcon30px.gif" alt="Walk"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"> </td><td width="37%"><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/22180" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="Southern Cross Railway Station (Melbourne City)" border="0" class="dontprint"></a></span><strong>From Stop <a href="http://www.metlinkmelbourne.com.au/stop/view/22180" class="soi" target="_blank">Southern Cross Railway Station (Melbourne City)</a><a href="http://www.metlinkmelbourne.com.au/stop/view/22180" class="soi" target="_blank"> Platform 9</a></strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C4.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
162
+
163
+ </td></tr><tr class="p3_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Walk</td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 6 min<br></td></tr><tr class="p3_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"> </div></td><td>To 1-Spencer St/Bourke St (Melbourne City)</td><td style="vertical-align:top;text-align:center;"></td><td colspan="2"></td></tr><tr class="p2_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/TramIcon30px.gif" alt="Metro Tram"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"><span>Mon, 9:09 pm</span></td><td width="37%"><strong>From Stop 1-Spencer St/Bourke St (Melbourne City)</strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C5.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
164
+
165
+ </td></tr><tr class="p2_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Take the Route<strong> 86 tram towards City (Docklands)</strong></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 2 min<br>Zone(s): 1<br>Operator: Yarra Trams<br><br><a href="XSLT_TRIP_REQUEST2?language=en&amp;command=loadLegTT_1_5&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;tripSelection=on&amp;tripSelector1=1&amp;itdLPxx_view=detail&amp;itdLPxx_legTT=:1_5">Leg Timetable</a></td></tr><tr class="p2_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"><span>Mon, 9:11 pm</span></div></td><td><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/18190" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="119-La Trobe St/Spencer St (Melbourne City)" border="0" class="dontprint"></a></span>Get off at stop <a href="http://www.metlinkmelbourne.com.au/stop/view/18190" class="soi" target="_blank">119-La Trobe St/Spencer St (Melbourne City)</a></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2"></td></tr><tr class="p3_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/WalkIcon30px.gif" alt="Walk"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"> </td><td width="37%"><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/18190" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="119-La Trobe St/Spencer St (Melbourne City)" border="0" class="dontprint"></a></span><strong>From Stop <a href="http://www.metlinkmelbourne.com.au/stop/view/18190" class="soi" target="_blank">119-La Trobe St/Spencer St (Melbourne City)</a></strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C6.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
166
+
167
+ </td></tr><tr class="p3_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Walk</td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 3 min<br></td></tr><tr class="p3_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"> </div></td><td><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19510" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="Jeffcott St/Spencer St (West Melbourne)" border="0" class="dontprint"></a></span><strong>To</strong><a href="http://www.metlinkmelbourne.com.au/stop/view/19510" class="soi" target="_blank"> Jeffcott St/Spencer St (West Melbourne)</a></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2"></td></tr><tr class="p2_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/BusIcon30px.gif" alt="Metro/Regional Bus"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"><span>Mon, 9:14 pm</span></td><td width="37%"><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19510" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="Jeffcott St/Spencer St (West Melbourne)" border="0" class="dontprint"></a></span><strong>From Stop <a href="http://www.metlinkmelbourne.com.au/stop/view/19510" class="soi" target="_blank">Jeffcott St/Spencer St (West Melbourne)</a></strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C7.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
168
+
169
+ </td></tr><tr class="p2_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Take the Route<strong> 219 bus towards Sunshine Park</strong></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 28 min<br>Zone(s): 1<br>Operator: Melbourne Bus Link<br><br><a href="XSLT_TRIP_REQUEST2?language=en&amp;command=loadLegTT_1_7&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;tripSelection=on&amp;tripSelector1=1&amp;itdLPxx_view=detail&amp;itdLPxx_legTT=:1_7">Leg Timetable</a></td></tr><tr class="p2_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"><span>Mon, 9:42 pm</span></div></td><td><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/18766" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="Sunshine Railway Station/Dickson St (Sunshine)" border="0" class="dontprint"></a></span>Get off at stop <a href="http://www.metlinkmelbourne.com.au/stop/view/18766" class="soi" target="_blank">Sunshine Railway Station/Dickson St (Sunshine) Platform Bay 10</a></td><td style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C8.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2"></td></tr></table><table width="100%" border="0" class="dontprint"><tr><td width="38%"><a href="XSLT_TRIP_REQUEST2?language=en&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;command=changeRequest&amp;itdLPxx_view=advanced&amp;itdLPxx_emailAddress_origin=invalid&amp;itdLPxx_emailAddress_destination=invalid"><img src="images/metlink/jp/modify.gif" alt="Modify" border="0"></a> <a href="XSLT_TRIP_REQUEST2?language=en&amp;itdLPxx_view=advanced"><img src="images/metlink/jp/searchagain.gif" alt="Search Again" border="0"></a></td><td width="62%"><div align="right"><a href="XSLT_TRIP_REQUEST2?language=en&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;command=tripRetoure&amp;itdLPxx_day=5&amp;itdLPxx_year=2011&amp;itdLPxx_month=12&amp;itdLPxx_hour=9&amp;itdLPxx_minute=42&amp;itdLPxx_ampm=pm&amp;itdLPxx_view=advanced&amp;itdLPxx_emailAddress_origin=invalid&amp;itdLPxx_emailAddress_destination=invalid"><img src="images/metlink/jp/return.gif" alt="Return Journey" width="121" height="23" border="0"></a> <a href="XSLT_TRIP_REQUEST2?language=en&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;command=tripGoOn&amp;itdLPxx_view=advanced&amp;itdLPxx_day=5&amp;itdLPxx_year=2011&amp;itdLPxx_month=12&amp;itdLPxx_hour=9&amp;itdLPxx_minute=42&amp;itdLPxx_ampm=pm&amp;itdLPxx_emailAddress_origin=invalid"><img src="images/metlink/jp/onward.gif" alt="Onward Journey" width="121" height="23" border="0"></a></div></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td width="12%"><p class="jpBold">Legend</p></td><td width="11%" align="center"><img src="images/metlink/means/TrainIcon30px.gif" alt="Metro Train"></td><td width="11%" align="center"><img src="images/metlink/means/TramIcon30px.gif" alt="Metro Tram"></td><td width="11%" align="center"><img src="images/metlink/means/BusIcon30px.gif" alt="Metro/Regional Bus"></td><td width="11%" align="center"><img src="images/metlink/means/RegionalTrainIcon30px.gif" alt="V/Line Train"></td><td width="11%" align="center"><img src="images/metlink/means/RegionalBusIcon30px.gif" alt="V/Line Coach"></td><td width="11%" align="center"><img src="images/metlink/means/WalkIcon30px.gif" alt="Walk"></td><td width="11%" align="center"><img src="images/metlink/means/CarIcon30px.gif" alt="Car"></td><td width="11%" align="center"><img src="images/metlink/means/CycleIcon30px.gif" alt="Cycle"></td></tr><tr><td> </td><td><p class="legend">Metro<br>Train</p></td><td><p class="legend">Metro<br>Tram</p></td><td><p class="legend">Metro/Regional<br>Bus</p></td><td><p class="legend">V/Line<br>Train</p></td><td><p class="legend">V/Line<br>Coach</p></td><td><p class="legend">Walk<br></p></td><td><p class="legend">Car<br></p></td><td><p class="legend">Cycle<br></p></td></tr></table><table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td width="12%"><p><strong><a href="http://www.metlinkmelbourne.com.au/fares-tickets/metropolitan-fares-and-tickets/metropolitan-zones/" target="_blank">Zones</a></strong></p></td><td width="15%"><p class="legend">1 = Zone 1</p></td><td width="14%"><p class="legend">2 = Zone 2</p></td><td width="16%"><p class="legend">C = City Saver</p></td><td width="15%"><p class="legend">V = V/Line</p></td><td width="28%"></td></tr></table><p class="dontprint"><a href="XSLT_TRIP_REQUEST2?language=en&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;language=en&amp;command=nop&amp;itdLPxx_view=advanced"><img src="images/metlink/jp/goback.gif" alt="Go Back" width="69" height="17" border="0"></a></p><p class="jpText dontprint">Haven't found what you're looking for? <a target="_blank" href="http://www.metlinkmelbourne.com.au/timetables/journey-planner-faqs/">Check the journey planner frequently asked questions.</a></p><span class="printonly" style="width:90%"><br><p class="jpText"><strong>Disclaimer</strong><br><br>The information provided by this Website is subject to change without notice, and is provided to you without warranties of any kind, either express or implied, subject to any consumer legislation. Please call the Metlink Call Centre on 131 638 prior to travel for the most up to date information available in relation to your required services.</p></span></div></div></div></div></div></form>
170
+ </td>
171
+ </tr>
172
+ </tbody>
173
+ </table>
174
+ </td>
175
+ </tr>
176
+ </tbody>
177
+ </table><!--End MAIN-->
178
+ </div>
179
+ <div id="sectionChildren"/>
180
+ </div>
181
+ </div>
182
+ </div>
183
+ </div>
184
+ <div id="left">
185
+ <div id="subNav">
186
+ <h1></h1>
187
+ <div class="dontprint" xmlns="">
188
+ <ul>
189
+ <li class="first"><a href="javascript:var wnd = open('WebHelp/en/Metlink_Journey_Planner.htm#Travel_Plan.htm', 'helpWnd', 'scrollbars=yes,resizable=yes');">What's on this page?</a></li>
190
+ <li><a href="javascript:var wnd = open('WebHelp/en/Metlink_Journey_Planner.htm#Step_1_enter_your_origin_and_destination.htm', 'helpWnd', 'scrollbars=yes,resizable=yes');">Getting started</a></li>
191
+ <li><a href="javascript:var wnd = open('WebHelp/en/Metlink_Journey_Planner.htm#Helpful_Tips.htm', 'helpWnd', 'scrollbars=yes,resizable=yes');">Helpful tips</a></li>
192
+ <li class="last"><a href="http://feedback.metlinkmelbourne.com.au/default.aspx?usage=JP&amp;url=http:%2F%2Fjp.metlinkmelbourne.com.au%2Fmetlink%2FXSLT_TRIP_REQUEST2%3FsessionID%3D0%26requestID%3D0%26name_origin%3D10002451%26type_origin%3DstopID%26name_destination%3D10001218%26type_destination%3DstopID%26itdDate%3D20111205%26itdTime%3D2050%26itdTripDateTimeDepArr%3Ddep%26ptOptionsActive%3D1%26includedMeans%3Dcheckbox%26inclMOT_0%3Don%26inclMOT_1%3Don%26inclMOT_2%3Don%26inclMOT_3%3Don%26inclMOT_4%3Don%26inclMOT_5%3Don%26inclMOT_6%3Don%26inclMOT_7%3Don%26inclMOT_8%3Don%26inclMOT_10%3Don%26changeSpeed%3Dnormal%26routeType%3DLEASTTIME%26imparedOptionsActive%3D1%26wheelchair%3D0%26noSolidStairs%3D0%26itOptionsActive%3D1%26trITDepMOT%3D100%26trITDepMOTvalue%3D10%26trITArrMOT%3D100%26trITArrMOTvalue%3D10%26useProxFootSearch%3D1%26" target="_blank">Customer feedback</a></li>
193
+ </ul>
194
+ <div class="naviBoxHead">
195
+ <h1></h1>
196
+ <div class="naviBox">
197
+ <div class="printLink"><a href="javascript:window.print();">Print Page</a></div>
198
+ <div class="emailafriendLink"><a href="XSLT_TRIP_REQUEST2?language=en&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;command=nop&amp;itdLPxx_view=mailAFriend:1&amp;itdLPxx_emailAddress_origin=invalid&amp;itdLPxx_emailAddress_destination=invalid">Email a friend</a></div>
199
+ <div>
200
+ <form method="post" action="http://www.metlinkmelbourne.com.au/bookmark/action"><input type="hidden" name="type" value="jpjourney"><input type="hidden" name="data" value="http://jp.metlinkmelbourne.com.au/metlink/XSLT_TRIP_REQUEST2?sessionID=0&amp;type_origin=stopID&amp;name_origin=10002451&amp;type_destination=stopID&amp;name_destination=10001218"><input type="hidden" name="default_label" value="Bookmark Label"><input type="hidden" name="redirectURL" value="http://jp.metlinkmelbourne.com.au/metlink/XSLT_TRIP_REQUEST2?sessionID=VICWA06_732007765&amp;requestID=1&amp;itdLPxx_view=overview"><input type="text" size="20" name="user_label" value="Bookmark Label">
201
+
202
+ <input type="submit" value="Add to My Way" name="AddBookmarkButton"></form>
203
+ </div>
204
+ </div>
205
+ </div>
206
+ </div>
207
+ </div>
208
+ </div>
209
+ </div>
210
+ <div id="right" class="dontprint">
211
+ <div class="right_inner">
212
+ <div id="toolbar-right">
213
+ <div class="CMSBoxSeparator" xmlns="">
214
+ <div class="CMSBox">
215
+ <div class="CMSBoxContent">
216
+ <h1>Service alterations</h1><div class="CMSBoxContentInner">
217
+ <div class="rightICS">
218
+ <table class="ics" cellspacing="0" cellpadding="0">
219
+ <tr>
220
+ <td>
221
+ <div>
222
+ <div style="float:left;"><img src="images/metlink/means/TrainIcon30px.gif" alt="Metro Train"> </div>Metropolitan trains<br><img src="images/metlink/jp/advanced.gif"> <a target="_blank" href="http://www.metlinkmelbourne.com.au/news/service-alterations/metropolitan-trains/extra-trains-for-melbourne-victory-v-adelaide-united-a-league-match-saturday-10-december-2011/">Extra trains for Melbourne Victory v Adelaide United A-League match: Saturday, 10 December 2011</a><br><br></div>
223
+ <div style="clear:both"></div>
224
+ <div>
225
+ <div style="float:left;"> </div>Regional general<br><img src="images/metlink/jp/advanced.gif"> <a target="_blank" href="http://www.viclink.com.au/off-peak-fares-not-available-for-any-journey-between-southern-cross-and-zone-b-stations-and-stops/">Off-peak fares not available for any journey between Southern Cross and Zone B stations and stops</a><br><br></div>
226
+ <div style="clear:both"></div>
227
+ <div>
228
+ <div style="float:left;"> </div>Metropolitan trains<br><img src="images/metlink/jp/advanced.gif"> <a target="_blank" href="http://www.metlinkmelbourne.com.au/news/news-promotions/epping-station-car-park-and-pedestrian-access-of-the-eastern-side-closure-from-thursday-6-january-2011">Epping Station car park and pedestrian access of the eastern side closure from Thursday, 6 January 2011</a><br><br></div>
229
+ <div style="clear:both"></div>
230
+ <div>
231
+ <div style="float:left;"><img src="images/metlink/means/NonVLineIcon30px.gif" alt="Non-V/Line Interstate Services"> </div>Regional trains<br><br></div>
232
+ <div style="clear:both"></div>
233
+ <div>
234
+ <div style="float:left;"> </div>Metropolitan trams<br><img src="images/metlink/jp/advanced.gif"> <a target="_blank" href="http://www.metlinkmelbourne.com.au/news/service-alterations/metropolitan-trams/temporary-closure-of-stop-24-on-route-59-to-airport-west-only-until-further-notice">Temporary closure of Stop 24 on Route 59 (to Airport West only): until further notice</a><br><br></div>
235
+ <div style="clear:both"></div><br><img src="images/metlink/jp/advanced.gif"> <a href="http://www.metlinkmelbourne.com.au/news/service-alterations/">More service alterations</a></td>
236
+ </tr>
237
+ </table>
238
+ </div>
239
+ </div>
240
+ </div>
241
+ </div>
242
+ </div>
243
+ <div class="CMSBoxSeparator" xmlns="">
244
+ <div class="CMSBox">
245
+ <div class="CMSBoxContent">
246
+ <h1>Announcements</h1><div class="CMSBoxContentInner">
247
+ <div class="rightICS">
248
+ <table class="ics" cellspacing="0" cellpadding="0">
249
+ <tr>
250
+ <td><img src="images/metlink/jp/advanced.gif"> <a href="http://www.metlinkmelbourne.com.au/news/">More announcements</a></td>
251
+ </tr>
252
+ </table>
253
+ </div>
254
+ </div>
255
+ </div>
256
+ </div>
257
+ </div>
258
+ <div class="CMSBoxSeparator" xmlns="">
259
+ <div class="CMSBox">
260
+ <div class="CMSBoxContent">
261
+ <h1>Hints and Tips</h1><div class="CMSBoxContentInner">
262
+ <div class="rightICS">
263
+ <table class="ics" cellspacing="0" cellpadding="0"></table>
264
+ </div>
265
+ </div>
266
+ </div>
267
+ </div>
268
+ </div>
269
+ </div>
270
+ </div>
271
+ </div>
272
+ </div>
273
+ <div id="clearfooter"></div>
274
+ </div>
275
+ <div id="footer" class="dontprint">
276
+ <ul>
277
+ <li class="first"><a href="http://feedback.metlinkmelbourne.com.au/default.aspx">Feedback</a></li>
278
+ <li><a href="http://www.metlinkmelbourne.com.au/footer/legal_disclaimer">Legal Disclaimer</a></li>
279
+ <li><a href="http://www.metlinkmelbourne.com.au/footer/privacy_policy">Privacy Policy</a></li>
280
+ <li><a href="http://www.metlinkmelbourne.com.au/footer/copyright">Copyright</a></li>
281
+ <li><a href="http://www.metlinkmelbourne.com.au/footer/w3c_accessibility">W3C Accessibility</a></li>
282
+ <li class="last"><a href="http://www.metlinkmelbourne.com.au/footer/sitemap">Sitemap</a></li>
283
+ </ul>
284
+ <ul id="Credits">
285
+ <li class="designIT"><a href="http://www.designit.com.au" target="_blank"><span>Developed by designIT</span></a></li>
286
+ <li class="eZpublish"><a href="http://www.ez.no/" target="_blank" class="last"><span>Powered by eZ Publish</span></a></li>
287
+ </ul>
288
+ <div id="footerDesc">
289
+ <p>© 2007</p>
290
+ </div>
291
+ </div>
292
+ <script language="JavaScript" type="text/javascript"><!--
293
+ var _rsCI="vic-metlink";
294
+ var _rsCG="0";
295
+ var _rsDT=0;
296
+ var _rsDU=0;
297
+ var _rsDO=0;
298
+ var _rsX6=0;
299
+ var _rsSI=escape(window.location);
300
+ var _rsLP=location.protocol.indexOf('https')>-1?'https:':'http:';
301
+ var _rsRP=escape(document.referrer);
302
+ var _rsND=_rsLP+'//secure-au.imrworldwide.com/';
303
+ if (parseInt(navigator.appVersion)>=4) {
304
+ var _rsRD=(new Date()).getTime();
305
+ var _rsSE=0;
306
+ var _rsSV="";
307
+ var _rsSM=0;
308
+ _rsCL='<scr'+'ipt language="JavaScript" type="text/javascript" src="'+_rsND+'v51.js"><\/scr'+'ipt>';
309
+ }
310
+ else{
311
+ _rsCL='<img src="'+_rsND+'cgi-bin/m?ci='+_rsCI+'&cg='+_rsCG+'&si='+_rsSI+'&rp='+_rsRP+'">';
312
+ }
313
+ document.write(_rsCL);
314
+ // -->
315
+ </script>
316
+ <noscript>
317
+ <img src="https://secure-au.imrworldwide.com/cgi-bin/m?ci=vic-metlink&amp;cg=0" alt=""/>
318
+ </noscript>
319
+ </div>
320
+ </body>
321
+ </html>
@@ -0,0 +1,3 @@
1
+ <tr class="p2_results"><td width="12%" colspan="2" style="text-align:center;"><img src="images/metlink/means/TramIcon30px.gif" alt="Metro Tram"></td><td width="5%" style="text-align:right;" alt="Departure" title="Departure">DEP:</td><td width="8%" style="text-align:left;"><span>Mon, 8:39 pm</span></td><td width="37%"><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19742" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="29-Barkers Rd/High St (Kew)" border="0" class="dontprint"></a></span><strong>From Stop <a href="http://www.metlinkmelbourne.com.au/stop/view/19742" class="soi" target="_blank">29-Barkers Rd/High St (Kew)</a></strong></td><td width="8%" style="vertical-align:top;text-align:center;"><a href="FILELOAD?Filename=VIC_4EDC940C1.pdf" target="_blank"><img src="images/metlink/jp/stopmap.gif" alt="Stop Map" width="38" height="29" border="0"></a></td><td colspan="2" width="30%">
2
+
3
+ </td></tr><tr class="p2_results"><td colspan="2"></td><td><div></div></td><td><div></div></td><td>Take the Route<strong> 109 tram towards Port Melbourne</strong></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2">Time 9 min<br>Zone(s): 1<br>Operator: Yarra Trams<br><br><a href="XSLT_TRIP_REQUEST2?language=en&amp;command=loadLegTT_1_1&amp;sessionID=VICWA06_732007765&amp;requestID=1&amp;tripSelection=on&amp;tripSelector1=1&amp;itdLPxx_view=detail&amp;itdLPxx_legTT=:1_1">Leg Timetable</a></td></tr><tr class="p2_results"><td colspan="2"><div align="center"></div></td><td><div align="right" alt="Arrival" title="Arrival">ARR:</div></td><td><div align="left"><span>Mon, 8:48 pm</span></div></td><td><span style="padding: 1px; margin-top: 2px;"><a href="http://www.metlinkmelbourne.com.au/stop/view/19732" target="_blank"><img src="images/metlink/jp/info.gif" height="12" width="12" alt="19-North Richmond Railway Station/Victoria St (Richmond)" border="0" class="dontprint"></a></span>Get off at stop <a href="http://www.metlinkmelbourne.com.au/stop/view/19732" class="soi" target="_blank">19-North Richmond Railway Station/Victoria St (Richmond)</a></td><td style="vertical-align:top;text-align:center;"></td><td colspan="2"></td></tr>
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Metlinkr::Journey do
4
+ let(:raw_shitty_html) do
5
+ File.read(File.dirname(__FILE__) + "/fixtures/multiple_journey.html")
6
+ end
7
+
8
+ subject do
9
+ Metlinkr::Journey.parse(raw_shitty_html)
10
+ end
11
+
12
+ it "parses journey effectively" do
13
+ subject.steps.length.should == 7
14
+
15
+ step = subject.steps.first
16
+
17
+ step.method.should == :tram
18
+ step.origin.should == "Stop 29 - Barkers Rd/High St (Kew)"
19
+ step.destination.should == "Stop 19 - North Richmond Railway Station/Victoria St (Richmond)"
20
+ step.departure_time.should == "8:39pm"
21
+ step.arrival_time.should == "8:48pm"
22
+ step.duration.should == "9 min"
23
+ step.route.should == "109 tram towards Port Melbourne"
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
2
+
3
+ require 'metlinkr'
data/spec/step_spec.rb ADDED
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Metlinkr::Step do
4
+ describe '#parse' do
5
+ let(:tram_snippet) do
6
+ File.read(File.dirname(__FILE__) + "/fixtures/tram_snippet.html")
7
+ end
8
+
9
+ let(:row_set) do
10
+ Nokogiri::HTML(tram_snippet).xpath("//tr")
11
+ end
12
+
13
+ subject do
14
+ Metlinkr::Step.parse(row_set)
15
+ end
16
+
17
+ it "parses the mode of transport" do
18
+ subject.method.should == :tram
19
+ end
20
+
21
+ it "parses the origin name" do
22
+ subject.origin.should == "Stop 29 - Barkers Rd/High St (Kew)"
23
+ end
24
+
25
+ it "parses the destination name" do
26
+ subject.destination.should == "Stop 19 - North Richmond Railway Station/Victoria St (Richmond)"
27
+ end
28
+
29
+ it "parses the route" do
30
+ subject.route.should == '109 tram towards Port Melbourne'
31
+ end
32
+
33
+ it "parses the departure time" do
34
+ subject.departure_time.should == "8:39pm"
35
+ end
36
+
37
+ it "parses the arrival time" do
38
+ subject.arrival_time.should == "8:48pm"
39
+ end
40
+
41
+ it "parses the duration" do
42
+ subject.duration.should == "9 min"
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: metlinkr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jack Chen (chendo)
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70299229069360 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70299229069360
25
+ - !ruby/object:Gem::Dependency
26
+ name: capybara-mechanize
27
+ requirement: &70299229068940 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70299229068940
36
+ - !ruby/object:Gem::Dependency
37
+ name: nokogiri
38
+ requirement: &70299229068520 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70299229068520
47
+ description: A gem to operate the Metlink journey planner
48
+ email: []
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - Rakefile
56
+ - lib/metlinkr.rb
57
+ - lib/metlinkr/journey.rb
58
+ - lib/metlinkr/step.rb
59
+ - lib/metlinkr/version.rb
60
+ - metlinkr.gemspec
61
+ - spec/fixtures/multiple_journey.html
62
+ - spec/fixtures/tram_snippet.html
63
+ - spec/journey_spec.rb
64
+ - spec/spec_helper.rb
65
+ - spec/step_spec.rb
66
+ homepage: ''
67
+ licenses: []
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project: metlinkr
86
+ rubygems_version: 1.8.10
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Web-scrapin' the Metlink journey planner
90
+ test_files:
91
+ - spec/fixtures/multiple_journey.html
92
+ - spec/fixtures/tram_snippet.html
93
+ - spec/journey_spec.rb
94
+ - spec/spec_helper.rb
95
+ - spec/step_spec.rb