JavaScript
0
Вклад в тег
var express = require('express');
var app = express();
var request = require('request');
var cheerio = require('cheerio');
var port = 8080;
var url = "https://www.nasa.gov/rss/dyn/lg_image_of_the_day.rss";
var content = [];
request(url, function(err, res, body) {
var $ = cheerio.load(body);
$('enclosure').each(function(i, elem) {
content.push($(this).attr('url'));
});
for (var i = 0; i<content.length; i++) {
console.log(content[i]);
}
});
app.listen(port);