index.js
function requestGoogleNewsRSS(params, callback) {
    // parse the params
    var returnObject = parseGoogleNewsRSSParams(params);
    returnObject.newsArray = null;
    // if no error from the parsing object
    if (!returnObject.error) {
        // make a request to the RSS using the URL
        var request = require("request");
        request({uri: returnObject.url}, 
        function(error, response, body) {
            // if no error in the call
            if (!error) {
                // parse the RSS data
                var parsedData = parseGoogleNewsRSSData(body);
                // if parsing runs okay, add data to the return object and return it
                if (parsedData.error == false) {
                    returnObject.error = false;      
                    returnObject.errorMessage = null;
                    returnObject.newsArray = parsedData.data;
                    callback(returnObject);
                }                    
                // otherwise parsing failed, indicate such
                else {
                    returnObject.error = true;
                    returnObject.errorMessage = 'Error with parsing data return from Google News.';
                    callback(returnObject);
                }
            }
            // otherwise indicate bad request
            else {
                returnObject.error = true;
                returnObject.errorMessage = 'Error with request for data from Google News.';
                callback(returnObject);
            }
        });        
    }
    // otherwise send back error true object from original params parsing
    else {
        callback(returnObject);
    }
}
function requestGoogleNewsRSS(params, callback) {
    // parse the params
    var returnObject = parseGoogleNewsRSSParams(params);
    returnObject.newsArray = null;
    // if no error from the parsing object
    if (!returnObject.error) {
        // make a request to the RSS using the URL
        var request = require("request");
        request({uri: returnObject.url}, 
        function(error, response, body) {
            // if no error in the call
            if (!error) {
                // parse the RSS data
                var parsedData = parseGoogleNewsRSSData(body);
                // if parsing runs okay, add data to the return object and return it
                if (parsedData.error == false) {
                    returnObject.error = false;      
                    returnObject.errorMessage = null;
                    returnObject.newsArray = parsedData.data;
                    callback(returnObject);
                }                    
                // otherwise parsing failed, indicate such
                else {
                    returnObject.error = true;
                    returnObject.errorMessage = 'Error with parsing data return from Google News.';
                    callback(returnObject);
                }
            }
            // otherwise indicate bad request
            else {
                returnObject.error = true;
                returnObject.errorMessage = 'Error with request for data from Google News.';
                callback(returnObject);
            }
        });        
    }
    // otherwise send back error true object from original params parsing
    else {
        callback(returnObject);
    }
}
function requestGoogleNewsRSS ( params , callback ) { // parse the params
 var returnObject = parseGoogleNewsRSSParams ( params ) ; returnObject . newsArray = null ; // if no error from the parsing object
 if ( ! returnObject . error ) { // make a request to the RSS using the URL
 var request = require ( "request" ) ; request ( { uri : returnObject . url } , function ( error , response , body ) { // if no error in the call
 if ( ! error ) { // parse the RSS data
 var parsedData = parseGoogleNewsRSSData ( body ) ; // if parsing runs okay, add data to the return object and return it
 if ( parsedData . error == false ) { returnObject . error = false ; returnObject . errorMessage = null ; returnObject . newsArray = parsedData . data ; callback ( returnObject ) ; } // otherwise parsing failed, indicate such
 else { returnObject . error = true ; returnObject . errorMessage = 'Error with parsing data return from Google News.' ; callback ( returnObject ) ; } } // otherwise indicate bad request
 else { returnObject . error = true ; returnObject . errorMessage = 'Error with request for data from Google News.' ; callback ( returnObject ) ; } } ) ; } // otherwise send back error true object from original params parsing
 else { callback ( returnObject ) ; } }
makes a call to get the HTML from the rotten tomatoes front page uses the request package to achieve this
makes a call to get the HTML from the rotten tomatoes front page uses the request package to achieve this