npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gscilp

v1.0.2

Published

GSCILP - Google Search Console Indexing Link Publisher - is a tool to automatically or semi-automatically updating your URLs in search console using Google API

Downloads

10

Readme

GSCILP

GSCILP - Google Search Console Indexing Link Publisher - is a tool to automatically or semi-automatically updating your URLs in search console using Google API.

!!! ATTENTION !!!

Before use make sure you understand how Google API quota works. You can find limits here. To apply for more quota go to Google Cloud Console > APIs & Services > Web Search Indexing API > Quotas & System Limits choose needed quota nad click "EDIT QUOTAS"

Note: this package need access to scopes:

'https://www.googleapis.com/auth/webmasters'
'https://www.googleapis.com/auth/webmasters.readonly'
'https://www.googleapis.com/auth/indexing'

Preparing

First of all you will need to create a Service Account Key:

  1. Enable the API in the Google Cloud Console
  2. Create a Service Account in the Google Developers Console
  3. For this newly created Service Account, navigate to 'Keys', create a new key, and save the JSON file somewhere secure. Your Node.js application will use these credentials to access the API .
  4. Add the email address of this newly created Service Account as an owner in the Google Search Console

Note: Only a verified owner of the property can perform this step.

thanks @fusebit for this instruction. Origin repo

Basic usage

import { GSCILP } from 'gscilp';

const gscilpSitemap = new GSCILP({
    googleKeyPath: '/path/to/key/file.json',
    sitemapPath: '../sitemap.xml'
});

// OR

const gscilpLinks = new GSCILP({
    googleKeyPath: '/path/to/key/file.json',
    linksToUpdate: ['link1', 'link2', ..., 'link-n']
});

gscilpSitemap.sendLinks();
gscilpLinks.sendLinks();

This examples will update up to 200 links by default from sitemap (1 option) or from array of links (2 ooption).

Note: you can provide only one link source (sitemap or array), if provided both will used sitemap.

Config

const config: IConfig = {
    googleKeyPath: '/path/to/key/file.json', // path to your key
    linksPerDayLimit: 200, //default 200 link per day - it's a default Google quota
    delayPerRequest: 0, //default 0 in ms - can be set to avoid 600 rpm Google quota
    sitemapPath: '/path/to/key/file.xml', // if provided will parse sitemap and convert it to links array
    // or
    linksToUpdate: ['link1', 'link2', ..., 'link-n'], //can provide regular array of links to update them
} 

Methods

After initialization you will have access to this list of methods:

parseSitemap

// will parse provided sitemap and save it in gscilp.linksToUpdate property. 
// No need to call - will be called in init
gscilp.parseSitemap() 

initGoogle

// will init google instanse with provided key and save it in gscilp.googleInstance
// No need to call will be checked before sending
gscilp.initGoogle() 

checkWebsitesList

// Optional method to ensure you have access to right account. 
// Will show in console for what resources this key have access
gscilp.checkWebsitesList() 

validateLinks

// Method will call before sending links. 
// And will remove bad links from gscilp.linksToUpdate
gscilp.validateLinks() 

cutExtraLinks

// If provided more than linksPerDayLimit (default 200) will cut all extra links 
// Called before sending links 
gscilp.cutExtraLinks() 

delay

// Optional method. Needed to avoid reaching rpm quota. 
// if provided config.delayPerRequest !== 0 in ms 
// for each request will be delay 
gscilp.delay() 

sendLinks

// Will send links to google api from gscilp.linksToUpdate
gscilp.sendLinks() 

PS

Future plans to implement cron job for big sitemaps (more than 200 links) and local storage. So you can run it and it will update all links from sitemap in some amount of days Feel fre to contribute and create issues.

If you want to help - it will be great to implement a good logger :)