Skip to content

Commit

Permalink
Updated URL for publictransport.sg to mytransport.sg
Browse files Browse the repository at this point in the history
  • Loading branch information
cpwc committed Jan 3, 2015
1 parent 531c34c commit 004f0fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tasks/compare-publictransport-streetdirectory.js
Expand Up @@ -5,7 +5,7 @@ var cheerio = require('cheerio');


module.exports = function(grunt){ module.exports = function(grunt){


grunt.registerTask('comparePTSD', 'Compare publictransport.sg to streetdirectory.com', function(){ grunt.registerTask('comparePTSD', 'Compare mytransport.sg to streetdirectory.com', function(){


var data = grunt.file.readJSON('data/2/bus-services.json'); var data = grunt.file.readJSON('data/2/bus-services.json');
var services = data.services.map(function(s){ var services = data.services.map(function(s){
Expand All @@ -14,7 +14,7 @@ module.exports = function(grunt){
grunt.log.writeln(service); grunt.log.writeln(service);
grunt.util.async.parallel([ grunt.util.async.parallel([
function(done){ function(done){
needle.head('http://www.publictransport.sg/content/publictransport/en/homepage/Ajax/map_ajaxlib.getBusRouteByServiceId.' + service + '.html', function(err, res){ needle.head('http://www.mytransport.sg/content/mytransport/ajax_lib/map_ajaxlib.getBusRouteByServiceId.' + service + '.html', function(err, res){
var len = parseInt(res.headers['content-length'], 10); var len = parseInt(res.headers['content-length'], 10);
var exists = len > 2000; // Exists when length is > 2K var exists = len > 2000; // Exists when length is > 2K
done(null, exists); done(null, exists);
Expand Down
4 changes: 2 additions & 2 deletions tasks/fetch-bus-services.js
Expand Up @@ -11,8 +11,8 @@ module.exports = function(grunt){


grunt.util.async.parallel([ grunt.util.async.parallel([
function(done){ function(done){
grunt.log.writeln('Request to publictransport.sg'); grunt.log.writeln('Request to mytransport.sg');
needle.get('http://www.publictransport.sg/content/publictransport/en/homepage/map.html', function(err, res, body){ needle.get('http://www.mytransport.sg/content/mytransport/map.html', function(err, res, body){
var $ = cheerio.load(body); var $ = cheerio.load(body);


var data = { var data = {
Expand Down
8 changes: 4 additions & 4 deletions tasks/fetch-bus-stops-routes.js
Expand Up @@ -5,7 +5,7 @@ var cheerio = require('cheerio');


module.exports = function(grunt){ module.exports = function(grunt){


grunt.registerTask('fetchBusStopsRoutes', 'Fetch bus stops and routes from publictransport.sg', function(){ grunt.registerTask('fetchBusStopsRoutes', 'Fetch bus stops and routes from mytransport.sg', function(){
var badlines = {}; // Store the bad route lines, report 'em var badlines = {}; // Store the bad route lines, report 'em
var stops = {}; // Store ALL the bus stops var stops = {}; // Store ALL the bus stops
var _ = grunt.util._; var _ = grunt.util._;
Expand All @@ -17,7 +17,7 @@ module.exports = function(grunt){
return function(allDone){ return function(allDone){
grunt.util.async.parallel([ grunt.util.async.parallel([
function(done){ function(done){
needle.get('http://www.publictransport.sg/content/publictransport/en/homepage/Ajax/map_ajaxlib.getBusRouteByServiceId.' + service + '.html', function(err, res, body){ needle.get('http://www.mytransport.sg/content/mytransport/ajax_lib/map_ajaxlib.getBusRouteByServiceId.' + service + '.html', function(err, res, body){
var $ = cheerio.load(body); var $ = cheerio.load(body);


var routeStops = { 1: [], 2: [] }; var routeStops = { 1: [], 2: [] };
Expand Down Expand Up @@ -50,7 +50,7 @@ module.exports = function(grunt){
}); });
}, },
function(done){ function(done){
needle.get('http://www.publictransport.sg/kml/busroutes/' + service + '-1.kml', function(err, res, body){ needle.get('http://www.mytransport.sg/kml/busroutes/' + service + '-1.kml', function(err, res, body){
if (err) throw err; if (err) throw err;
if (res.statusCode != 200) throw new Error('Status code: ' + res.statusCode); if (res.statusCode != 200) throw new Error('Status code: ' + res.statusCode);


Expand All @@ -77,7 +77,7 @@ module.exports = function(grunt){
done(null, []); done(null, []);
return; return;
} }
needle.get('http://www.publictransport.sg/kml/busroutes/' + service + '-2.kml', function(err, res, body){ needle.get('http://www.mytransport.sg/kml/busroutes/' + service + '-2.kml', function(err, res, body){
if (err) throw err; if (err) throw err;
if (res.statusCode != 200) throw new Error('Status code: ' + res.statusCode); if (res.statusCode != 200) throw new Error('Status code: ' + res.statusCode);


Expand Down

0 comments on commit 004f0fc

Please sign in to comment.