README
MOZ Mozscape API Library
Node-mozscape is a node.js module for asynchronously communicating with the MOZ Mozscape APIs.
APIs It supports
- url-metrics
- links
- anchor-text
- top-pages
- metadata
This is reworked the from the tremendous previous api library - Linkscape API Library
Installation
Use npm to install node-mozscape
npm install mozscape
Dependencies
Usage
var Mozscape = require('mozscape').Mozscape;
var moz = new Mozscape('your-access-id', 'your-secret');
moz.urlMetrics('www.google.com', ['url', 'links'], function(err, res) {
if (err) {
console.log(err);
return;
}
console.log(res);
});
Methods Available
urlMetrics
moz.urlMetrics(url, cols, callback)
urlThe URL you want metrics for, ex:'www.google.com'colsAn array of strings for the columns you want in the response (seeMozscape.URL_METRICS_FLAGS). Ex:['title', 'url', 'links']callbackA function to be called asynchronously once the response comes back from the API. The function should accept 2 arguments in the following order:error, resultwhere error will either be an object or null, and result will be an object containing the response from seoMOZ.
links
moz.links(url, scope, options, callback)
urlThe URL you want to get links for, ex:www.google.comscopeThe scope of the results as per the seoMOZ API docs, ex:page_to_pageoptionsAn object with any of the following:sortAs per the seoMOZ API docs, ex:page_authorityfilterAn array of strings, ex:['internal', external', 'nofollow']targetColsArray of strings for the columns returned for the target of the link, seeMozscape.URL_METRICS_FLAGSsourceColsArray of strings for the columns returned for the source of the link, seeMozscape.URL_METRICS_FLAGSlinkColsArray of strings for the columns for the link itself, seeLinkscape.LINK_FLAGS
callbackSame as urlMetrics.
anchorText
moz.anchorText(url, scope, cols, callback)
urlThe URL you want to get anchor texts for, ex:www.google.comscopeScope of the link as per the MOZ API docs, ex:phrase_to_pagecolsArray of strings for the columns returned, seeMozscape.ANCHOR_TEXT_FLAGScallbackSame as urlMetrics.
topPages
moz.topPages(url, cols, options, callback)
urlThe subdomain you want results forcolsAn array of strings for the columns you want in the response (seeMozscape.URL_METRICS_FLAGS). Ex:['title', 'url', 'links']optionsAn object with any of the following:offsetReturn starting at the nth resultlimitHow many results to return (max 1000)
callbackSame as urlMetrics
metadata
moz.metadata(option, callback)
optionA string of any of the following:last_updatenext_updateindex_stats
callbackSame as urlMetrics