mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-04 22:58:03 +00:00
Add support for (some) Atom feeds. #231
This commit is contained in:
parent
9bc8f54233
commit
80c0e6a4e0
@ -42,16 +42,27 @@ var Fetcher = function(url, reloadInterval, encoding) {
|
||||
var parser = new FeedMe();
|
||||
|
||||
parser.on("item", function(item) {
|
||||
var description = item.description || '';
|
||||
var regex = /(<([^>]+)>)/ig;
|
||||
description = description.replace(regex, "");
|
||||
|
||||
if (item.title && description && item.pubdate) {
|
||||
var title = item.title;
|
||||
var description = item.description || item.summary || item.content || '';
|
||||
var pubdate = item.pubdate || item.published || item.updated;
|
||||
|
||||
if (title && description && pubdate) {
|
||||
|
||||
var regex = /(<([^>]+)>)/ig;
|
||||
description = description.replace(regex, "");
|
||||
|
||||
items.push({
|
||||
title: item.title,
|
||||
title: title,
|
||||
description: description,
|
||||
pubdate: item.pubdate,
|
||||
pubdate: pubdate,
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
console.log("Can't parse feed item:");
|
||||
console.log(item);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user