2019-09-30 15:38:41 +03:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Fetch Google Analytics Pageviews reporting cache
|
|
|
|
# and save as 'assets/data/pagevies.json'
|
|
|
|
#
|
|
|
|
# Requirement:
|
|
|
|
# - jq
|
|
|
|
# - wget
|
|
|
|
#
|
2020-01-02 16:17:49 +03:00
|
|
|
# v2.0
|
|
|
|
# https://github.com/cotes2020/jekyll-theme-chirpy
|
2019-09-30 15:38:41 +03:00
|
|
|
# © 2019 Cotes Chung
|
|
|
|
# MIT Licensed
|
|
|
|
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2020-01-01 20:21:43 +03:00
|
|
|
WORK_DIR=$(dirname $(dirname $(realpath "$0")))
|
|
|
|
URL_FILE=${WORK_DIR}/assets/data/proxy.json
|
|
|
|
PV_CACHE=${WORK_DIR}/assets/data/pageviews.json
|
|
|
|
|
|
|
|
|
2019-09-30 15:38:41 +03:00
|
|
|
PROXY_URL=$(jq -r '.proxyUrl' $URL_FILE)
|
|
|
|
|
|
|
|
wget $PROXY_URL -O $PV_CACHE
|