collect-feeds
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -8,3 +8,3 @@ 'use strict'; | ||
const Queue = require('promise-queue'); | ||
const queue = new Queue(5, Infinity); | ||
const queue = new Queue(6, Infinity); | ||
const gotOptions = { | ||
@@ -18,16 +18,22 @@ headers: { | ||
function findFeed(url) { | ||
return queue.add(() => Promise.all([feedFinder(url), rssFinder({url, gotOptions})])) | ||
return Promise.all([queue.add(() => feedFinder(url)), queue.add(() => rssFinder({url, gotOptions}))]) | ||
.then(result => { | ||
const feedUrl1 = result[0][0] || null; | ||
const res2 = result[1]; | ||
const feedUrl2 = res2.feedUrls && res2.feedUrls.length > 0 ? res2.feedUrls[0].url : null; | ||
const feedUrls1 = result[0]; | ||
const feedUrls2 = result[1].feedUrls.map(v => v.url); | ||
if (feedUrl1 === feedUrl2) { | ||
return feedUrl2; | ||
if (feedUrls1[0] && feedUrls1[0] === feedUrls2[0]) { | ||
return feedUrls2[0]; | ||
} | ||
const feedUrls = unique(filterEmpties([].concat(res2.feedUrls.map(v => v.url), result[0]))); | ||
for (let i = 0, len = feedUrls2.length; i < len; i++) { | ||
const feedUrl = feedUrls2[i]; | ||
if (feedUrls1.includes(feedUrl)) { | ||
return feedUrl; | ||
} | ||
} | ||
const feedUrls = unique(filterEmpties(feedUrls2.concat(feedUrls1))); | ||
console.warn(`Should check the url '${url}'. \n Found different feed URLs: \n - ${feedUrls.join('\n - ')}`); | ||
return feedUrl2 || feedUrl1; | ||
return feedUrls2[0] || feedUrls1[0] || null; | ||
}); | ||
@@ -34,0 +40,0 @@ } |
{ | ||
"name": "collect-feeds", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A CLI for collect feed URLs.", | ||
@@ -18,3 +18,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"feed-finder": "github:dailyrandomphoto/feed-finder#master", | ||
"feed-finder": "github:dailyrandomphoto/feed-finder#b77a900b004ae5c7178593d9aef6525eb1d5eb69", | ||
"fs-extra": "^8.1.0", | ||
@@ -21,0 +21,0 @@ "promise-queue": "^2.2.5", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
10390
186