i-promise-page-metrics
Advanced tools
Comparing version 0.0.2 to 0.0.4
22
index.js
"use strict"; | ||
const cheerio = require("cheerio"); | ||
const rp = require("request-promise"); | ||
@@ -36,3 +37,24 @@ | ||
}); | ||
}, | ||
moz: (url) => { | ||
return rp.post({ | ||
url: "http://www.checkmoz.com/", | ||
form: { | ||
"f_urls": url | ||
} | ||
}).then((data) => { | ||
const $ = cheerio.load(data); | ||
const metricsRow = $(".rowclass1 td"); | ||
return { | ||
da: $(metricsRow[1]).text(), | ||
pa: $(metricsRow[2]).text(), | ||
ranks: $(metricsRow[3]).text(), | ||
links: $(metricsRow[4]).text() | ||
}; | ||
}); | ||
} | ||
}; |
{ | ||
"name": "i-promise-page-metrics", | ||
"version": "0.0.2", | ||
"version": "0.0.4", | ||
"license": "MIT", | ||
"description": "Fetches different page metrics for a given URL", | ||
"dependencies": { | ||
"cheerio": "^0.20.0", | ||
"request": "^2.60.0", | ||
@@ -8,0 +9,0 @@ "request-promise": "^4.1.1" |
# i-promise-page-metrics | ||
> A node module for retrieving different page metrics for an URL | ||
For those of you who want to get page metrics for different URLs. This module will supply you with `Facebook` and `Google+` metrics. | ||
For those of you who want to get page metrics for different URLs. This module will supply you with `Facebook`, `Google+` and `Moz metrics. | ||
@@ -30,4 +30,9 @@ ## Install | ||
``` | ||
pageMetrics.moz(url) | ||
.then((response) => { | ||
//=> {da: 1, pa: 22, rank: 2, links: 100} | ||
}); | ||
```` | ||
## Running tests | ||
@@ -34,0 +39,0 @@ |
@@ -28,2 +28,14 @@ "use strict"; | ||
}); | ||
it("should return moz data", (done) => { | ||
pageMetrics.moz(url) | ||
.then((response) => { | ||
response.da.should.be.above(10); | ||
response.pa.should.be.above(10); | ||
response.ranks.should.be.above(1); | ||
response.links.should.be.above(100); | ||
done(); | ||
}); | ||
}); | ||
}); |
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
8394
90
57
3
+ Addedcheerio@^0.20.0
+ Addedabab@1.0.4(transitive)
+ Addedacorn@2.7.0(transitive)
+ Addedacorn-globals@1.0.9(transitive)
+ Addedboolbase@1.0.0(transitive)
+ Addedcheerio@0.20.0(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcss-select@1.2.0(transitive)
+ Addedcss-what@2.1.3(transitive)
+ Addedcssom@0.3.8(transitive)
+ Addedcssstyle@0.2.37(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddom-serializer@0.1.1(transitive)
+ Addeddomelementtype@1.3.1(transitive)
+ Addeddomhandler@2.3.0(transitive)
+ Addeddomutils@1.5.1(transitive)
+ Addedentities@1.0.01.1.2(transitive)
+ Addedescodegen@1.14.3(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedestraverse@4.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedhtmlparser2@3.8.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedjsdom@7.2.2(transitive)
+ Addedlevn@0.3.0(transitive)
+ Addednth-check@1.0.2(transitive)
+ Addednwmatcher@1.4.4(transitive)
+ Addedoptionator@0.8.3(transitive)
+ Addedparse5@1.5.1(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedpsl@1.14.0(transitive)
+ Addedreadable-stream@1.1.14(transitive)
+ Addedsax@1.4.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedsymbol-tree@3.2.4(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedwebidl-conversions@2.0.1(transitive)
+ Addedwhatwg-url-compat@0.6.5(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedxml-name-validator@2.0.1(transitive)
- Removedpsl@1.15.0(transitive)