Adds the new API endpoint

This commit is contained in:
Llewellyn van der Merwe 2023-06-01 05:28:07 +02:00
parent 12f2658f9f
commit 93253ee5a1
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
2 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ if [[ "$BOOK_NAME" =~ $re ]]; then
BOOK_NR="${BOOK_NAME}"
else
# get the list of books from the API to get the book number
BOOKS=$(curl -s "https://getbible.net/v2/${VERSION}/books.json")
BOOKS=$(curl -s "https://api.getbible.net/v2/${VERSION}/books.json")
BOOK_NR=$(echo "$BOOKS" | jq -r ".[] | select(.name == \"${BOOK_NAME}\") | .nr")
fi
# get chapter and verses numbers
@ -77,7 +77,7 @@ CHAPTER_NR=$(echo "${NUMBERS%:*}" | xargs echo -n)
# get verses numbers
VERSES_NR=$(echo "${NUMBERS#*:}" | xargs echo -n)
# get chapter text from getBible API
CHAPTER=$(curl -s "https://getbible.net/v2/${VERSION}/${BOOK_NR}/${CHAPTER_NR}.json")
CHAPTER=$(curl -s "https://api.getbible.net/v2/${VERSION}/${BOOK_NR}/${CHAPTER_NR}.json")
# read verses into array by comma separator
IFS=',' read -ra VERSES_NR_ARRAY <<<"${VERSES_NR}"
# start the scripture array

View File

@ -64,7 +64,7 @@ BOOK_NAME=$(echo "${BOOK_NAME%%[0-9]:*}" | xargs echo -n)
re='^[0-9]+$'
if [[ "$BOOK_NAME" =~ $re ]]; then
# get the list of books from the API to get the book number
BOOKS=$(curl -s "https://getbible.net/v2/${VERSION}/books.json")
BOOKS=$(curl -s "https://api.getbible.net/v2/${VERSION}/books.json")
BOOK_FULL_NAME=$(echo "$BOOKS" | jq -r ".[] | select(.nr == ${BOOK_NAME}) | .name")
# get chapter and verses numbers
NUMBERS=$(echo "${SCRIPTURE/$BOOK_NAME/}" | xargs echo -n)