diff --git a/config.js b/config.js index ff5fd3d..a6b9801 100644 --- a/config.js +++ b/config.js @@ -14,7 +14,7 @@ var db = new db_js("rss_chan"); const get_rss = function(url,min_id){ return parser.parseURL(url).then(feed=>feed.items).then(items=>{ - let idx = items.findIndex(i => i.prop_1 === min_id); + let idx = items.findIndex(i => parseInt(i.guid) === min_id); if(idx>=0) return items.slice(0,idx); else return items; }); diff --git a/manual.js b/manual.js index 23df532..0c83ef5 100644 --- a/manual.js +++ b/manual.js @@ -33,12 +33,12 @@ const get_url = function(opts){ } const get_rss = function(url,min_id){ - return parser.parseURL(url).then(feed=>feed.items - .sort((a, b)=>(parseInt(a.guid)-parseInt(b.guid))) - .filter((v)=>(parseInt(v.guid)>min_id))); + return parser.parseURL(url).then(feed=>feed.items).then(items=>{ + let idx = items.findIndex(i => parseInt(i.guid) === min_id); + if(idx>=0) return items.slice(0,idx); + else return items; + }); } -console.log(get_url({org:ORG.BR, lang:'de',since:-2})) - -get_rss(get_url({org:ORG.BR, lang:'de',since:-2}),79710).then(r=>r.forEach(item=>{ +get_rss(get_url({org:ORG.BR, lang:'de',since:-3}),79718).then(r=>r.forEach(item=>{ console.log(`${item.title} (${item.guid}): ${item.link}`); }));