mirror of
https://github.com/getbible/getverse.git
synced 2024-11-21 20:05:10 +00:00
Adds the new API endpoint
This commit is contained in:
parent
12f2658f9f
commit
93253ee5a1
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user