Skip to content

eyupfidan/ahrefs-v3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ahrefs API v3 Node.js Client

This library allows you to interact with the Ahrefs API v3 with ease. You can use Ahrefs' comprehensive SEO data and analysis tools directly in your Node.js applications.

Getting Started

npm install ahrefs-v3

Usage

First, import the SiteExplorer class and create a new instance with an API key.

const { SiteExplorer } = require("ahrefs-v3");
const explorer = new SiteExplorer("YOUR_API_KEY");

Use your Ahrefs API key in place of YOUR_API_KEY.

To retrieve a domain rating information:

const currentDate = new Date();

const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, "0");
const day = String(currentDate.getDate()).padStart(2, "0");

const formattedDate = `${year}-${month}-${day}`;
const url = "w3schools.com";

explorer.domainRating.get(url, formattedDate).then((response) => {
  const { domain_rating, ahrefs_rank } = response.data.domain_rating;
  console.log(url + " Domain Rating:", domain_rating);
  console.log(url + " Ahrefs Rank:", ahrefs_rank);
});

Optionally you can send "output" and "protocol" parameters.

To examine in more detail Ahrefs Api V3 Documentation

In this example, the domainRating.get function fetches a domain rating and prints the information to the console.

Feedback

If you have any feedback, please reach out to [email protected]

License

This project is licensed under the MIT License.

About

A user-friendly Node.js client for the Ahrefs API v3.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published