Hello there,

i can't find my error. Every time i run this function it returns an empty 
array. 
The array im talking is about is hoster.
I hope someone can help me.

portal.getHosterByStream = function(stream, callback) {
request(URL + stream, function (error, response, body) {
if (!error && response.statusCode === 200) {
var hoster = [];
var $ = cheerio.load(body);
var information = $('body div[id=frmMain] div[id=dontbeevil] 
div[id=Vadda]').html();
var items_hoster = $(information).find("ul[id=HosterList]").html();
 $(items_hoster).each(function (i, item) {
var rel = $(item).attr('rel');

if (rel != undefined) {
request(MIRROR + rel, function (error, response, body) {
if (!error && response.statusCode === 200) {
var host = JSON.parse(body);

var href = "";
var positionHref = 9;
var i = 0;
 while (host.Stream.substr(positionHref + i, 1) != '"') {
href = util.format('%s%s', href, host.Stream.substr(positionHref + i, 1));

i++;
}
hoster.push(href);
} else {
console.log('error second request');
}
});
}
});
callback(hoster);
} else {
console.log('error request page');
}
});
}

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to