Comparing version 1.3.3 to 1.3.4
// Generated by CoffeeScript 1.7.1 | ||
module.exports = function(req, callback) { | ||
var async, candidates, detectEncoding, favicon, htmlparser, iconv, parser, request, sitename, sitenameFlag, url; | ||
var async, candidates, favicon, htmlparser, iconv, jschardet, parser, request, sitename, sitenameFlag, url; | ||
htmlparser = require("htmlparser2"); | ||
detectEncoding = require("detect-encoding"); | ||
jschardet = require("jschardet"); | ||
iconv = require('iconv'); | ||
@@ -41,3 +41,3 @@ async = require('async'); | ||
}, function(err, res, body) { | ||
var obj; | ||
var charset, converter, obj; | ||
if (err != null) { | ||
@@ -48,50 +48,47 @@ callback(err, null); | ||
obj = url.parse(req); | ||
return detectEncoding(body, function(err, result) { | ||
var charset, converter; | ||
charset = result; | ||
if (charset !== ('utf-8' || 'UTF-8')) { | ||
converter = new iconv.Iconv(charset, 'utf-8'); | ||
body = converter.convert(body).toString(); | ||
charset = jschardet.detect(body).encoding; | ||
if (charset !== ('utf-8' || 'UTF-8')) { | ||
converter = new iconv.Iconv(charset, 'utf-8'); | ||
body = converter.convert(body).toString(); | ||
} | ||
parser.write(body); | ||
parser.end(); | ||
return async.forEach(candidates, function(cand, cb) { | ||
var guess; | ||
cand.sitename = sitename; | ||
if (cand.href.match(/[http|https]:\/\//)) { | ||
cand.url = cand.href; | ||
} else { | ||
cand.url = "" + obj.protocol + "//" + obj.host + cand.href; | ||
} | ||
parser.write(body); | ||
parser.end(); | ||
return async.forEach(candidates, function(cand, cb) { | ||
var guess; | ||
cand.sitename = sitename; | ||
if (cand.href.match(/[http|https]:\/\//)) { | ||
cand.url = cand.href; | ||
if (favicon.length > 0) { | ||
if (favicon.match(/[http|https]:\/\//)) { | ||
cand.favicon = favicon; | ||
return cb(); | ||
} else { | ||
cand.url = "" + obj.protocol + "//" + obj.host + cand.href; | ||
} | ||
if (favicon.length > 0) { | ||
if (favicon.match(/[http|https]:\/\//)) { | ||
cand.favicon = favicon; | ||
if (favicon.charAt(0) === '/') { | ||
cand.favicon = "" + obj.protocol + "//" + obj.host + favicon; | ||
return cb(); | ||
} else { | ||
if (favicon.charAt(0) === '/') { | ||
cand.favicon = "" + obj.protocol + "//" + obj.host + favicon; | ||
return cb(); | ||
} else { | ||
cand.favicon = "" + obj.protocol + "//" + obj.host + "/" + favicon; | ||
return cb(); | ||
} | ||
cand.favicon = "" + obj.protocol + "//" + obj.host + "/" + favicon; | ||
return cb(); | ||
} | ||
} else { | ||
guess = "" + obj.protocol + "//" + obj.host + "/favicon.ico"; | ||
return request(guess, function(err, res, body) { | ||
if (res.statusCode === 200) { | ||
cand.favicon = guess; | ||
} | ||
return cb(); | ||
}); | ||
} | ||
}, function() { | ||
if (candidates.length === 0) { | ||
return callback('no such rss feeds.', null); | ||
} else { | ||
return callback(null, candidates); | ||
} | ||
}); | ||
} else { | ||
guess = "" + obj.protocol + "//" + obj.host + "/favicon.ico"; | ||
return request(guess, function(err, res, body) { | ||
if (res.statusCode === 200) { | ||
cand.favicon = guess; | ||
} | ||
return cb(); | ||
}); | ||
} | ||
}, function() { | ||
if (candidates.length === 0) { | ||
return callback('no such rss feeds.', null); | ||
} else { | ||
return callback(null, candidates); | ||
} | ||
}); | ||
}); | ||
}; |
{ | ||
"name": "find-rss", | ||
"description": "find rss feeds", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"author": "nikezono", | ||
"dependencies": { | ||
"async": "*", | ||
"detect-encoding": "0.0.3", | ||
"htmlparser2": "*", | ||
"iconv": "^2.1.4", | ||
"jschardet": "^1.1.0", | ||
"request": "*" | ||
@@ -12,0 +12,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
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
9487
92
+ Addedjschardet@^1.1.0
+ Addedjschardet@1.6.0(transitive)
- Removeddetect-encoding@0.0.3
- Removeddetect-encoding@0.0.3(transitive)