Comparing version 1.0.1 to 1.0.2
// Generated by CoffeeScript 1.6.3 | ||
module.exports = function(req, callback) { | ||
var async, candidates, htmlparser, parser, request, url; | ||
var async, candidates, htmlparser, parser, request, sitename, sitenameFlag, url; | ||
htmlparser = require("htmlparser2"); | ||
async = require('async'); | ||
url = require('url'); | ||
request = require('request'); | ||
candidates = []; | ||
sitename = ''; | ||
sitenameFlag = false; | ||
parser = new htmlparser.Parser({ | ||
onopentag: function(name, attr) { | ||
if (name === "link" && attr.type === "application/rss+xml" || attr.type === "application/atom+xml") { | ||
return candidates.push(attr); | ||
candidates.push(attr); | ||
} | ||
if (name === "title") { | ||
return sitenameFlag = true; | ||
} | ||
}, | ||
ontext: function(text) { | ||
if (sitenameFlag) { | ||
return sitename = text; | ||
} | ||
}, | ||
onclosetag: function(name) { | ||
if (name === "title") { | ||
return sitenameFlag = false; | ||
} | ||
} | ||
}); | ||
async = require('async'); | ||
url = require('url'); | ||
request = require('request'); | ||
candidates = []; | ||
return request(req, function(err, res, body) { | ||
@@ -26,2 +41,3 @@ var obj; | ||
return async.forEach(candidates, function(cand, cb) { | ||
cand.sitename = sitename; | ||
if (cand.href.match(/[http|https]:\/\//)) { | ||
@@ -28,0 +44,0 @@ cand.url = cand.href; |
{ | ||
"name": "find-rss", | ||
"description": "find rss feeds", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": "nikezono", | ||
@@ -16,2 +16,4 @@ "dependencies": { | ||
"rss", | ||
"atom", | ||
"find", | ||
"feed" | ||
@@ -18,0 +20,0 @@ ], |
@@ -26,3 +26,4 @@ node-find-rss [![Build Status](https://travis-ci.org/nikezono/node-find-rss.png)](https://travis-ci.org/nikezono/node-find-rss) | ||
# => | ||
# [ { rel: 'alternate', | ||
# [ { sitename: 'Apple' | ||
rel: 'alternate', | ||
type: 'application/rss+xml', | ||
@@ -29,0 +30,0 @@ title: 'RSS', |
Sorry, the diff of this file is not supported yet
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
6137
56
32