find-rss
Advanced tools
Comparing version 1.5.10 to 1.5.11
@@ -6,3 +6,3 @@ (function() { | ||
iconv = require('iconv'); | ||
iconv = require('iconv-lite'); | ||
@@ -19,2 +19,8 @@ request = require('request'); | ||
var body, candidates, urlObject; | ||
if (typeof req === "string") { | ||
req = { | ||
url: req | ||
}; | ||
} | ||
req.encoding = null; | ||
if (finder.favicon == null) { | ||
@@ -26,6 +32,6 @@ finder.favicon = true; | ||
} | ||
if (!/^https?/.test(req)) { | ||
if (!/^https?/.test(req.url)) { | ||
return callback(new Error("Not HTTP URL is provided."), null); | ||
} | ||
urlObject = url.parse(req); | ||
urlObject = url.parse(req.url); | ||
body = ""; | ||
@@ -51,7 +57,7 @@ candidates = []; | ||
}, function(cb) { | ||
var cand, _i, _len; | ||
for (_i = 0, _len = candidates.length; _i < _len; _i++) { | ||
cand = candidates[_i]; | ||
var cand, i, len; | ||
for (i = 0, len = candidates.length; i < len; i++) { | ||
cand = candidates[i]; | ||
if (cand.link != null) { | ||
cand.url = req; | ||
cand.url = req.url; | ||
cand.sitename = cand.title; | ||
@@ -62,3 +68,3 @@ } else { | ||
} else { | ||
cand.url = "" + urlObject.protocol + "//" + urlObject.host + cand.href; | ||
cand.url = urlObject.protocol + "//" + urlObject.host + cand.href; | ||
} | ||
@@ -78,3 +84,4 @@ } | ||
return async.forEach(candidates, function(cand, _cb) { | ||
return requestAndEncodeWithDetectCharset(cand.url, function(err, body) { | ||
req.url = cand.url; | ||
return requestAndEncodeWithDetectCharset(req, function(err, body) { | ||
if (err) { | ||
@@ -106,4 +113,4 @@ return _cb(); | ||
return async.each(candidates, function(cand, _cb) { | ||
var guess, _ref; | ||
if (((_ref = cand.favicon) != null ? _ref.length : void 0) > 0) { | ||
var guess, ref; | ||
if (((ref = cand.favicon) != null ? ref.length : void 0) > 0) { | ||
if (/^https?/.test(cand.favicon)) { | ||
@@ -113,6 +120,6 @@ return _cb(); | ||
if (cand.favicon.charAt(0) === '/') { | ||
cand.favicon = "" + urlObject.protocol + "//" + urlObject.host + cand.favicon; | ||
cand.favicon = urlObject.protocol + "//" + urlObject.host + cand.favicon; | ||
return _cb(); | ||
} else { | ||
cand.favicon = "" + urlObject.protocol + "//" + urlObject.host + "/" + cand.favicon; | ||
cand.favicon = urlObject.protocol + "//" + urlObject.host + "/" + cand.favicon; | ||
return _cb(); | ||
@@ -122,3 +129,3 @@ } | ||
} else { | ||
guess = "" + urlObject.protocol + "//" + urlObject.host + "/favicon.ico"; | ||
guess = urlObject.protocol + "//" + urlObject.host + "/favicon.ico"; | ||
return request(guess, function(err, res, body) { | ||
@@ -154,8 +161,5 @@ if (err || (res != null ? res.statusCode : void 0) !== 200) { | ||
requestAndEncodeWithDetectCharset = function(url, callback) { | ||
return request.get({ | ||
uri: url, | ||
encoding: null | ||
}, function(err, res, body) { | ||
var charset, converter; | ||
requestAndEncodeWithDetectCharset = function(req, callback) { | ||
return request.get(req, function(err, res, body) { | ||
var charset; | ||
if (err) { | ||
@@ -169,4 +173,3 @@ return callback(err, null); | ||
if (charset !== ('utf-8' || 'UTF-8')) { | ||
converter = new iconv.Iconv(charset, 'utf-8//TRANSLIT//IGNORE'); | ||
body = converter.convert(body).toString(); | ||
body = iconv.decode(body, charset); | ||
} | ||
@@ -173,0 +176,0 @@ return callback(null, body); |
@@ -18,3 +18,3 @@ | ||
module.exports = exports = function(htmlBody, callback) { | ||
var argumentIsCandidate, cand, candidates, favicon, feedparser, parser, sitename, sitenameFlag, _i, _len; | ||
var argumentIsCandidate, cand, candidates, favicon, feedparser, i, len, parser, sitename, sitenameFlag; | ||
candidates = []; | ||
@@ -73,4 +73,4 @@ sitename = ""; | ||
} else { | ||
for (_i = 0, _len = candidates.length; _i < _len; _i++) { | ||
cand = candidates[_i]; | ||
for (i = 0, len = candidates.length; i < len; i++) { | ||
cand = candidates[i]; | ||
cand.sitename = sitename; | ||
@@ -77,0 +77,0 @@ cand.favicon = favicon; |
{ | ||
"name": "find-rss", | ||
"description": "find rss feeds", | ||
"version": "1.5.10", | ||
"version": "1.5.11", | ||
"author": "nikezono", | ||
"dependencies": { | ||
"async": "*", | ||
"feedparser": "^0.19.2", | ||
"htmlparser2": "^3.7.3", | ||
"iconv": "^2.1.4", | ||
"jschardet": "^1.1.0", | ||
"feedparser": "*", | ||
"htmlparser2": "*", | ||
"iconv-lite": "^0.4.11", | ||
"jschardet": "*", | ||
"request": "*" | ||
}, | ||
"devDependencies": { | ||
"codeclimate-test-reporter": "0.0.3", | ||
"coffee-errors": "^0.8.6", | ||
"codeclimate-test-reporter": "*", | ||
"coffee-errors": "*", | ||
"coffee-script": "*", | ||
"coffeelint": "^1.6.0", | ||
"grunt": "^0.4.5", | ||
"grunt-coffeelint": "0.0.13", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-contrib-coffee": "^0.11.1", | ||
"grunt-contrib-copy": "^0.6.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-istanbul": "^0.3.0", | ||
"grunt-mocha-test": "^0.12.0", | ||
"grunt-notify": "^0.3.1", | ||
"istanbul": "^0.3.2", | ||
"mocha": "^1.21.4", | ||
"underscore": "^1.7.0" | ||
"grunt": "*", | ||
"grunt-coffeelint": "*", | ||
"grunt-contrib-clean": "*", | ||
"grunt-contrib-coffee": "*", | ||
"grunt-contrib-copy": "*", | ||
"grunt-contrib-watch": "*", | ||
"grunt-istanbul": "*", | ||
"grunt-mocha-test": "*", | ||
"grunt-notify": "*", | ||
"istanbul": "*", | ||
"mocha": "*", | ||
"underscore": "*" | ||
}, | ||
@@ -32,0 +31,0 @@ "keywords": [ |
Floating dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 3 instances in 1 package
15
234
10142
6
+ Addediconv-lite@^0.4.11
+ Addedaddressparser@1.0.1(transitive)
+ Addeddom-serializer@2.0.0(transitive)
+ Addeddomhandler@5.0.3(transitive)
+ Addeddomutils@3.1.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedfeedparser@2.2.10(transitive)
+ Addedhtmlparser2@9.1.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjschardet@3.1.2(transitive)
+ Addedlodash.assign@4.2.0(transitive)
+ Addedlodash.get@4.4.2(transitive)
+ Addedlodash.has@4.5.2(transitive)
+ Addedlodash.uniq@4.5.0(transitive)
+ Addedmri@1.2.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsax@1.3.0(transitive)
+ Addedstring_decoder@1.1.1(transitive)
- Removediconv@^2.1.4
- Removedaddressparser@0.1.3(transitive)
- Removeddom-serializer@0.2.2(transitive)
- Removeddomelementtype@1.3.1(transitive)
- Removeddomhandler@2.4.2(transitive)
- Removeddomutils@1.7.0(transitive)
- Removedentities@1.1.22.2.0(transitive)
- Removedfeedparser@0.19.2(transitive)
- Removedhtmlparser2@3.10.1(transitive)
- Removediconv@2.3.5(transitive)
- Removedisarray@0.0.1(transitive)
- Removedjschardet@1.6.0(transitive)
- Removednan@2.19.0(transitive)
- Removedreadable-stream@1.0.343.6.2(transitive)
- Removedresanitize@0.3.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsax@0.6.1(transitive)
- Removedstring_decoder@0.10.311.3.0(transitive)
- Removedvalidator@1.5.1(transitive)
Updatedfeedparser@*
Updatedhtmlparser2@*
Updatedjschardet@*