Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from sys to util, to avoid deprecation warnings #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions node-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Rob Righter - @robrighter
http://github.com/robrighter/node-xml
**********************************************************************/
var sys = require('sys'), http = require('http');
var util = require('util'), http = require('http');
var xml = require("./node-xml");

// variable for holding the callback function which is passed to the
Expand Down Expand Up @@ -87,10 +87,10 @@ var parser = new xml.SaxParser(function(cb) {

// @TODO handle warnings and errors properly
cb.onWarning(function(msg) {
sys.puts('<WARNING>'+msg+"</WARNING>");
util.puts('<WARNING>'+msg+"</WARNING>");
});
cb.onError(function(msg) {
sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
util.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
});
});

Expand Down Expand Up @@ -120,7 +120,7 @@ exports.parseURL = function(url, cb) {
function get_rss(url) {
var u = require('url'), http = require('http');
var parts = u.parse(url);
//sys.puts(JSON.stringify(parts));
//util.puts(JSON.stringify(parts));

// set the default port to 80
if(!parts.port) { parts.port = 80; }
Expand All @@ -130,8 +130,8 @@ exports.parseURL = function(url, cb) {
var client = http.createClient(parts.port, parts.hostname);
var request = client.request('GET', parts.pathname, {'host': parts.hostname});
request.addListener('response', function (response) {
//sys.puts('STATUS: ' + response.statusCode);
//sys.puts('HEADERS: ' + JSON.stringify(response.headers));
//util.puts('STATUS: ' + response.statusCode);
//util.puts('HEADERS: ' + JSON.stringify(response.headers));

// check to see the type of status
switch(response.statusCode) {
Expand All @@ -149,18 +149,18 @@ exports.parseURL = function(url, cb) {
case 301:
case 302:
if(redirection_level > 10) {
sys.puts("too many redirects");
util.puts("too many redirects");
}
else {
sys.puts("redirect to "+response.headers.location);
util.puts("redirect to "+response.headers.location);
get_rss(response.headers.location);
}
break;
default:
/*
response.setEncoding('utf8');
response.addListener('data', function (chunk) {
//sys.puts('BODY: ' + chunk);
//util.puts('BODY: ' + chunk);
});
*/
break;
Expand Down