Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

find-rss

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-rss - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

83

lib/find-rss.js
// 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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc