https://github.com/steebchen/website-fetcher
Easily retrieve statistics about any website. Uses the free Alexa API.
https://github.com/steebchen/website-fetcher
Last synced: 4 months ago
JSON representation
Easily retrieve statistics about any website. Uses the free Alexa API.
- Host: GitHub
- URL: https://github.com/steebchen/website-fetcher
- Owner: steebchen
- License: mit
- Created: 2016-12-02T12:09:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-03T02:39:11.000Z (almost 6 years ago)
- Last Synced: 2024-12-31T01:39:23.968Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://circleci.com/gh/steebchen/website-info)
# install
```sh
npm i website-info --save
```
# usage
```js
const ws = require('website-info')
ws('https://www.google.com', (err, result) => {
if (err) console.error(err) // handle error
console.log(result)
// result:
// {
// rank: 1, // global website rank. 1 means most popular website
// views: 104943144672, // estimated monthly pageviews
// rankF: '1', // formatted rank
// viewsF: '104.943.144.672' // formatted views
// }
})
// when a website has too little pageviews
ws('http://this-website.is/not-really/popular', (err, result) => {
if (err) console.error(err) // handle error
console.log(result)
// result:
// {
// notEnough: true, // not enough data to estimate rank/pageviews
// rank: Infinity,
// views: 0
// }
})
```
You can also use Promises – simply leave off the callback:
```js
ws('https://www.google.com').then(console.log).catch(console.error)
```