workingxx92 / submit-urls

Bash scripts that refer to sitemap and submit URLs through Bing Webmaster or Yandex.Webmaster API

Home Page:https://carmine560.blogspot.com/2020/12/bash-scripting-to-submit-urls-through.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

submit-urls

Bash scripts that refer to the sitemap and submit the URLs of newer entries than the last submission through the Bing Webmaster API or Yandex.Webmaster API.

Prerequisites

These scripts have been tested for Blogger on Debian bullseye on WSL 1 and use the following packages:

  • curl to retrieve the sitemap and submit URLs
  • xq included in the yq package to transcode XML to JSON
  • jq to filter JSON data
  • GnuPG to encrypt the configuration file

Install each package as needed. For example:

sudo apt install curl
pip install yq
sudo apt install jq
sudo apt install gpg

Installation

Make sure that Bash can find these scripts in the directories of the PATH. For example:

PATH=$HOME/path/to/submit-urls:$PATH

or

cp -i *.sh ~/.local/bin

Usage

If the configuration file ~/.config/SCRIPT_BASENAME.cfg.gpg does not exist, the following scripts will create and encrypt it assuming that the default key of GnuPG is your OpenPGP key pair.

Bing Webmaster

Prepare an API key for authorization, and replace the values of the following variables in the configuration file with yours:

  • SITEMAP
  • SITE_URL
  • API_KEY

Then:

submit-urls-bing.sh

A screenshot of GNOME Terminal where submit-urls-bing.sh was executed.

Yandex.Webmaster

Prepare an access token, user ID, and host ID for authorization and using the API, and replace the values of the following variables in the configuration file with yours:

  • SITEMAP
  • access_token
  • USER_ID
  • HOST_ID

Then:

submit-urls-yandex.sh

A screenshot of GNOME Terminal where submit-urls-yandex.sh was executed.

Common Options

  • -n (dry run) retrieves the sitemap and shows newer entries than the last submission but does not submit them.
  • -s (silent) does not show any output except for an error message from curl.

Known Issue

The script submit-urls-yandex.sh repeats a request for each URL because the queue method of the API does not seem to support arrays.

License

MIT

Links

Blog posts for more details:

About

Bash scripts that refer to sitemap and submit URLs through Bing Webmaster or Yandex.Webmaster API

https://carmine560.blogspot.com/2020/12/bash-scripting-to-submit-urls-through.html

License:MIT License


Languages

Language:Shell 100.0%