Last active
September 15, 2020 05:35
-
-
Save hide24/2df6d4cb955250f59d4bd3635a2ffc75 to your computer and use it in GitHub Desktop.
embernized GakuNin DS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
WAYF_URL="https://ds.gakunin.nii.ac.jp/WAYF/embedded-wayf.js" | |
LOCAL_FILENAME_BASE="embedded-wayf_js" | |
SUGGEST_URL="https://ds.gakunin.nii.ac.jp/GakuNinDS/incsearch/suggest.js" | |
SUGGEST_LOCAL_PATH="/ember_osf_web/suggest_js" | |
LOCALES=( ja en ) | |
for locale in "${LOCALES[@]}" | |
do | |
LOCAL_FILENAME=$LOCAL_FILENAME_BASE.$locale | |
echo $LOCAL_FILENAME | |
LANG='Accept-Language:'$locale';' | |
echo $LANG | |
curl -H $LANG $WAYF_URL -o $LOCAL_FILENAME | |
sed -i -e "s/var safekind = '2'/var safekind = '1'/" $LOCAL_FILENAME | |
sed -i -e "s#${SUGGEST_URL}#${SUGGEST_LOCAL_PATH}#" $LOCAL_FILENAME | |
sed -i -e "s/document\.write/\$('#dsTag').append/" $LOCAL_FILENAME | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment