Socket
Socket
Sign inDemoInstall

find-rss

Package Overview
Dependencies
71
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.10 to 1.5.11

47

lib/find-rss.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc