Commit c0192d8d authored by yPhil's avatar yPhil

Merge branch 'mastodon'

parents 197c08fc a7ca6393
Pipeline #52927 passed with stage
in 34 seconds
......@@ -45,15 +45,11 @@ function getFeed (urlfeed, callback) {
}
};
var req = request (urlfeed);
// var req = request(options);
// var req = request (urlfeed);
var req = request(options);
var feedparser = new FeedParser ();
var feedItems = [];
req.setHeader('user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36');
req.setHeader('accept', 'text/html,application/xhtml+xml');
req.on ('response', function (res) {
var stream = this;
if (res && typeof res !== 'undefined' && res.statusCode === 200 && res.headers['content-type'] && res.headers['content-type'].includes('xml')) {
......@@ -61,7 +57,7 @@ function getFeed (urlfeed, callback) {
} else {
// console.log ('getFeed: Content-type Error read %s (%s) .', urlfeed, res.headers['content-type']);
// callback (res.headers['content-type']);
callback (res.headers['content-type']);
return;
}
});
......@@ -78,16 +74,16 @@ function getFeed (urlfeed, callback) {
}
}).on ('end', function () {
var meta = this.meta;
callback (null, feedItems, meta.title, meta.link);
callback ('Feed OK', feedItems, meta.title, meta.link);
}).on ('error', function (err) {
callback ('Bad feed: ' + err);
callback ('Bad feed: ', err);
});
}
router.get('/feed', function(req, res) {
getFeed(req.query.feedurl, function (err, feedItems, feedTitle, feedLink) {
if (!err) {
if (feedItems) {
res.send({
feedItems: feedItems,
feedLink: feedLink,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment